I'm having trouble getting GHC to type in the place where this should be obvious. The following is a complete snippet demonstrating the problem.
{-
In test1 I can print c without specifying c and an explicit type, as I expected. Type c is inferred by an explicit signature on x , namely, the first element in the HList is of type Int .
In test2 , however, explicit signature on c is required. If I just print $ untag c in test2 , I get
Test.hs:22:32: Couldn't match type `s0' with `s' `s0' is untouchable inside the constraints (as ~ '[] *) bound at a pattern with constructor HNil :: HList ('[] *), in a case alternative `s' is a rigid type variable bound by a type expected by the context: Reifies * s Bool => Proxy * s -> IO () at Test.hs:19:9 Expected type: Tagged * s0 Int Actual type: a In the pattern: HNil In the pattern: HCons w HNil In a case alternative: (HCons w HNil) -> w
Why can't GHC deduce type c from an explicit type specified in x , like in test1 ?
source share