> > : Marc.hs:7:
> > :     Cannot unify the type-signature variable `p' with the 
> type `[]'
> > :   Expected type: [a]
> > :   Inferred type: p a1
> > :     In the first argument of `ci', namely `a'
> > :     In the scrutinee of a case expression: ci a
> > 
> > Great!
> 
> But shouldn't the expected type and inferred type be reversed?

Actually, no.  The rationale (and implementation) is this:
        * the "expected type" describes the context
        * the "inferred type" describes the term

class C p a where
   ci :: p a -> p a

f :: (C p a) => (p a) -> (p a)
f a = case ci a of
         [] -> a


Here, the context of "ci a" is a case expression that has
list-typed patterns.  So we *infer* the type 
        ci a :: p a1
but the list context disagrees.

I don't see how to swap the roles without giving even more confusion.

Simon

Reply via email to