Marc,

Yes, it is tricky isn't it?  I've worked quite hard at improving
GHC's error messages, but they are far from perfect.

So, in this case, what would you *like* the compiler to have said?
I'm the wrong person to answer that question -- you are the right one.

Do others have similar war stories?

Simon


> Consider the following silly module definition:
> 
> > module Proposal( C ) where
> 
> > class C p a where
> >   ci :: p a -> p a
> 
> > f :: (C p a) => f (p a) -> f (p a)
> > f a = case ci a of
> >         [] -> a
> 
> Compiling this leads to the following (ghc-4.02):
> 
> Proposal.lhs:6:
>     Inferred type is less polymorphic than expected
>         Quantified type variable `f' is unified with `[]'
>     When checking the type signature
>         f :: forall f1 p1 a1. {C p1 a1} => f1 (p1 a1) -> f1 (p1 a1)
> 
> Here it is not difficult to see what causes the problem.
> However, the more equations there are in the definition
> of a function, the more difficult I have found it to locate
> the cause of errors resulting in error messages as the one
> above.
> 
> Would it be possible to provide an explanation as to what
> could have caused such errors?
> 
> 
> 
> Regards,
> 
> 
> Marc van Dongen
> 

Reply via email to