Instance checking and phantom types

Nick Name nick.name at inwind.it
Mon Sep 15 15:38:38 EDT 2003


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

---------------begin
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 ()
----------------end

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

Vincenzo



More information about the Haskell-Cafe mailing list