blob: 67703a2a9127c0d13fa044b7134a99dcfecacabc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
{-# LANGUAGE ExistentialQuantification #-}
-- Without a type sig this is slightly tricky.
-- See #1430
-- Reason: we get an implication constraint (forall a. Typeable a => Typeable b),
-- when generalising unExTypeable. We want to infer a context for the
-- whole thing of (Typeable b).
-- See Note [Inference and implication constraints] in GHC.Tc.Solver
module Foo where
import Data.Typeable
data ExTypeable = forall a. Typeable a => ExTypeable a
-- unExTypeable :: Typeable h => ExTypeable -> Maybe h
unExTypeable (ExTypeable a) = cast a
|