[Hugs-users] Re: Constraint depth cut off

Neil Mitchell ndmitchell at gmail.com
Wed Apr 18 12:10:27 EDT 2007


Hi

I have now reduced this bug to a smallish test case:


test :: T1 -> T1
test = test2

test2 :: C3 (T2 a) a => a -> a
test2 = undefined

data T1 = C1 deriving Show
data T2 a = T2 a deriving Show

class C1 a where
class C2 a where
class C3 a b where

instance C1 T1 where
instance C1 a => C1 (T2 a) where
instance (C1 a, C2 a) => C3 T1 a where
instance (C3 a (T2 a)) => C2 (T2 a) where
instance (C2 (T2 a)) => C3 (T2 a) b where

In Hugs I get (overlapping instances and unsafe overlapping instances
turned on):

*** The type checker has reached the cutoff limit while trying to
*** determine whether:
***     C1 T1
*** can be deduced from:
***     ()

The explicit instance for this type makes it surprising that it fails
to find an instance.

In GHC with -fglasgow-exts -fallow-undecidable-instances, it works fine.

Thanks

Neil


More information about the Hugs-Users mailing list