| There's no doubt that Hugs could produce better error messages in this
| situation and perhaps offer some advice to the user.  But I don't
| think it would be wise to treat these top-level expressions
| differently from those in scripts.  If the user types in [], should
| Hugs print [] or ""?  Without invoking some sort of defaulting not
| specified in the report, you can't know.  If the user types
| (reverse "") should the system print []?  That's confusing too.

I don't buy this argument. Look

Prelude> reverse ""
""
Prelude> ""
""

The type of `reverse ""' is `[Char]', so there is no problem here.  The
point is that if the type involves a type variable we can substitute an
arbitrary dictionary because it is never used! And honestly, don't you
think the current behaviour is weird from a beginner's view? Actually,
in a beginner's course this was the first hurdle for a student of mine.

| Problems with a missing "deriving Show" don't bother me: the error is
| easily understood and corrected.  It would bother me if code that
| works fine from the command line didn't typecheck in a program.

Sorry, I was probably unclear. The example was intended to demonstrate that
the error message is _not_ caused by a missing "deriving Show".

| I'm not saying these are real concerns; I just think the issue here is
| better error messages rather than any sort of semantic change in Hugs.

No! I don't agree.

Cheers, Ralf

Reply via email to