1 {-# OPTIONS -fglasgow-exts #-}
3 module ShouldFail where
5 -- A stripped down functional-dependency
6 -- example that causes GHC 4.08.1 to crash with:
7 -- "basicTypes/Var.lhs:194: Non-exhaustive patterns in function readMutTyVar"
8 -- Reported by Thomas Hallgren Nov 00
11 primDup :: Int -> IO Int
16 -- call :: Call c h => c -> h
18 -- call primDup :: {Call (Int -> IO Int) h} => h with
19 -- Using the instance decl gives
20 -- call primDup :: {Call (IO Int) h'} => Int -> h'
21 -- The functional dependency means that h must be constant
22 -- Hence program is rejected because it can't find an instance
23 -- for {Call (IO Int) h'}
25 class Call c h | c -> h where
28 instance Call c h => Call (Int->c) (Int->h) where