> > I encountered a confusing error message, which you can
> > reproduce with 
> > 
> >   type P a = Maybe a
> > 
> >   instance Monad P where
> >     (>>=)  = error "foo"
> >     return = error "bar"
> > 
> > I get 
> > 
> >   bug.hs:5: `P' should have 1 argument, but has been given 0 .
> 
> Would it be better if it said 
> 
>       Type synonym constructor P should have 1 argument,
>       but has been given 0
> 
> Haskell requires that type synonyms are never partially applied;
> that's what's being complained about here.
> 
> If you did fully apply it, GHC 3.1 (without -fglasow-exts) would
> then complain about making an instance of a type synonym.
> At the moment, though, it trips over the mal-formed type expression first.

That's what I guessed, but I reckon that it may be a bit
difficult to spot for people who are not so familiar with
the details of constructor classes.  But, maybe it is too
much fuzz to check for this special situation explicitly.

I wonder whether it would be helpful to add a comment like

  (or if this is a instance declaration, type synonyms are
  not allowed)

to the message.

Manuel

Reply via email to