Instance checking and phantom types

Nick Name at
Mon Sep 15 15:38:38 EDT 2003

Hi all, I have an example wich I don't understand:

class C t
data T = T
instance C T

data C t => T1 t = T1

f1 :: T1 ()
f1 = T1

data C t => T2 t = T2 t

f2 :: T2 ()
f2 = T2 ()

The first function, f1, is accepted both by hugs and ghc, unlike the 
second wich is rejected.

Why does this happen? Shouldn't f1 be rejected with "no instance C ()"

Thanks for help


More information about the Haskell-Cafe mailing list