Re: Confusing error message

1998-02-17 Thread Simon L Peyton Jones

 
> 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.

Does that make sense?  Any suggestions for improving the error
message in a way that would have made sense to you at the time?

Simon





GHC3.00:stranal/SaAbsInt.lhs:665: Non-exhaustive patterns in ...

1998-02-17 Thread Jon Mountjoy

Hello People,

Compiling with ghc-3.00 I get:
TypeDt.lhs:189: 
Pattern match(es) are overlapped
in the definition of function `showType'
x = ...
 
 
NOTE: Simplifier still going after 4 iterations; bailing out.
 
stranal/SaAbsInt.lhs:665: Non-exhaustive patterns in function `absApply'
*** Error code 1



This bug occured in 2.03 as well(May 20), and Simon I think sent me a
patch.  I guess the patch didn't get through to the distribution...

Jon



Confusing error message

1998-02-17 Thread Manuel Chakravarty

Hi GHC-Developers!

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 .

with 

  ** ghc 2.05 **

(maybe things changed in the meanwhile.)

The problem in the program is clear, we cannot have an
instance of a type synonym, but that's far from obvious from
the error message.

Cheers,

Manuel