Commit f18c7113 authored by chak@cse.unsw.edu.au.'s avatar chak@cse.unsw.edu.au.

GADTs: T2040

parent 7738a0aa
{-# OPTIONS_GHC -Wall -fglasgow-exts #-}
module T2040 where
data Teq a b where Teq :: Teq a a
class C a b where proof :: Teq a b
data S a = S a
data W b where
-- This would make every version of GHC happy
-- W :: (C a c , c ~ S b) => W a -> W c
W :: C a (S b) => W a -> W (S b)
foo :: W (S ()) -> W (S ()) -> ()
foo (W (_ :: W a1)) (W (_ :: W a2)) =
case proof :: Teq a1 (S ()) of
Teq -> ()
foo2 :: W (S ()) -> W (S ()) -> ()
foo2 (W (_ :: W a1)) (W (_ :: W a2)) =
case proof :: Teq a1 (S ()) of
Teq -> case proof :: Teq a2 (S ()) of
Teq -> ()
\ No newline at end of file
......@@ -94,3 +94,4 @@ test('T1999', normal, compile, [''])
test('T1999a', normal, compile, [''])
test('T2587', normal, compile, [''])
test('T2040', normal, compile, [''])
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment