summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_compile/tc228.hs
blob: 79896748471a7d5b1b15009e24c6e08cc3259e6e (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 TcSimplify


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