Main> :t baz baz :: Foo a => Char' a -> a Main> :t v v :: Char' BW Main> :t test1 test1 :: Bool Main> :t (baz v) baz v :: Foo a => a
Why doesn't the typechecker unify Char' BW with a and therefore the type of test1 = baz v becomes Char' BW resulting in a type error by not being able to unify Char' BW with Char' Bool?
Dominic.
class Foo a where foo :: Char -> a
instance Foo Bool where foo 'F' = False foo 'T' = True
data BW = Black | White deriving Show
instance Foo BW where foo 'B' = Black foo 'W' = White
type Char' a = Char
baz :: Foo a => Char' a -> a baz x = foo x
v :: Char' BW v = 'B'
test1 :: Bool test1 = baz v _______________________________________________ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell