No title

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
class Foo (m :: * -> *)

newtype HiddenCtx a = HiddenCtx (forall m. Foo m => m a)

hideResult :: forall a b. (forall m. Foo m => Either a (m b)) -> Either a (HiddenCtx b)
hideResult = \case
    -- Left e -> Left e
    Right (x :: forall m. Foo m => m b) -> Right $ HiddenCtx x


-- ERROR:
 Couldn't match type m0 with m
            because type variable m would escape its scope
          This (rigid, skolem) type variable is bound by
            a pattern type signature:
              Foo m => m b
            at Test.hs:149:12-38
          Expected type: forall (m :: * -> *). Foo m => m b
            Actual type: m0 b
         When checking that the pattern signature:
              forall (m :: * -> *). Foo m => m b
            fits the type of its context: m0 b
          In the pattern: x :: forall m. Foo m => m b
          In the pattern: Right (x :: forall m. Foo m => m b)