Re: [Haskell-cafe] Re: Error message reform (was: Strange type error with associated type synonyms)

2009-05-31 Thread Henning Thielemann


On Thu, 28 May 2009, Claus Reinke wrote:


Just, please, keep in mind that there is no one-size-fits-all:
improving a message for one group of users might well make
it less useful for another group.


I once thought, that error messages must be configurable by libraries, 
too. This would be perfect for EDSLs that shall be used by non-Haskellers. 
But I have no idea how to design that.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Error message reform (was: Strange type error with associated type synonyms)

2009-05-29 Thread Johan Tibell
On Fri, May 29, 2009 at 2:17 AM, Simon Michael si...@joyful.com wrote:

 Achim Schneider wrote:

 expected/encountered


 Expected/actual ? Familiar to users of test frameworks.


That does sound better than expected/inferred to me.

-- Johan
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Error message reform (was: Strange type error with associated type synonyms)

2009-05-28 Thread Claus Reinke

One user's view of error message history, perhaps helpful to reformers:-)

Once upon a time, Hugs tended to have better error messages than GHC.

They still weren't perfect, mostly when begginners where confronted with
messages referring to advanced concepts - eg, Simon Thompson had a list 
of translations of the kind if Hugs reports this, it most likely means that,
especially targetted to beginners in his courses, ie users who where unlikely 
to want things like 'Num (a-b)' instances, or find non-existing semicolons. 

(the advice to focus on the error location usually means that either the 
error message is misleading or too difficult for the user to interpret - it

is a standard fallback in all programming language implementations,
but no more than that; if we rely on it too often, the messages aren't
doing their job)

Even for more advanced users, it was helpful to get messages from
several implementations (at least Hugs and GHC) for tricky cases, just
to get different views from which to piece together a picture. This, sadly,
is not as well supported these days as it used to be, but getting multiple
opinions on type errors is still useful advice (if your code can be handled
by multiple implementations, or if a single implementation can offer multiple
views, eg, beginner/advanced or top-down/bottom-up or ..).

Then Simon PJ invested a lot of energy into improving GHC's error 
messages, so the balance changed. Error message complaints didn't
stop, though, and the error messages were improved further, with 
more text, and suggestions for possible fixes, etc.


The suggestions are sometimes misleading, and I've felt there has 
been too much weight on narrative text, to the exclusion of actual 
type information (it is a programming language, after all, so why 
don't the error messages give type signatures for context instead of 
trying to talk me through it in natural language, without further 
references to types!-), but discussions like the present show that 
Simon has been on the right track with that, for many users.


Still, I would really like a just the facts, please mode for GHC, 
with less text and more type signatures (especially for the contexts 
of type mismatches). Error messages simply not including the

information I need has become my main issue with GHC messages,
and seems to be a common thread over many tickets and threads
apparently discussing phrasing (eg, expected/inferred: who expects
and why, and what is the inference based on?).

Somewhere in between, much research has focussed on type errors,
and how to report them in general, and implementations like Helium 
have set out to target beginners with simpler error messages. (*)


As for fixes, concrete suggestions are most likely to be adopted,
but sometimes it just isn't clear how to improve the situation, and
sometimes, there is no single best solution (which has spawned
countless interesting papers on type-error reporting;-).

It you want to help, file tickets for messages you find unhelpful,
and make suggestions for possible improvements. Unfortunately,
there doesn't seem to be an error message component in GHC's
trac, so querying for relevant tickets is not straightforward. Simon
keeps a partial list of error message related tickets here (keeping
track of trac tickets - meta-trac?-):

http://hackage.haskell.org/trac/ghc/wiki/Status/SLPJ-Tickets

Just, please, keep in mind that there is no one-size-fits-all:
improving a message for one group of users might well make
it less useful for another group.

Claus

(*) A beginner mode for Haskell systems has often been suggested,
   even before Helium. Instead, error messages, and even language
   design decisions have been constrained by trying to serve everyone
   with a single mode. I'd have thought that Helium, and Dr Scheme,
   have sufficiently demonstrated the value of having separate levels
   of a language and the corresponding error messages.


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Error message reform (was: Strange type error with associated type synonyms)

2009-05-27 Thread Jeff Wheeler
On Thu, 2009-05-28 at 01:45 +0400, Bulat Ziganshin wrote:

 for me, it was better than ghc errmsg. main thing is that i don't feel
 automatically what is expected and what is inferred. here Hugs says
 that True is Bool and the remaining is Int, so i feel the situation

I absolutely agree about expected/inferred. I always forget which is
which, because I can figure both could apply to each.

Say, in this simple example:

 Prelude let f = (+5)
 Prelude f abc
 
 interactive:1:2:
 Couldn't match expected type `Integer'
against inferred type `[Char]'
 In the first argument of `f', namely `abc'
 In the expression: f abc
 In the definition of `it': it = f abc

Does expected mean that, based on the type signature, it should be an
Integer, or based on the argument that I provided, it should be a
String? The same goes for the inferred type: it knows what the type of
the literal argument (String), so I would assume the inferred type was
the type in the function's signature. Unfortunately, my reasoning in
both cases can go the wrong way . . .

Better language may be much more helpful, although I'm not sure what may
be easier to interpret.

Jeff Wheeler

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Error message reform (was: Strange type error with associated type synonyms)

2009-05-27 Thread Max Rabkin
On Thu, May 28, 2009 at 12:03 AM, Jeff Wheeler j...@nokrev.com wrote:
 I absolutely agree about expected/inferred. I always forget which is
 which, because I can figure both could apply to each.

That's actually true for me too. When you say it like that, I remember
times when I've had the same confusion.

 Better language may be much more helpful, although I'm not sure what may
 be easier to interpret.

I think one big improvement (demonstrated in Bulat's proposal) is to
put the two types near where those types come from. GHC gives you the
two types, and then the context in which they arose. Hugs gives the
context and then two types, but doesn't say which type is which.

So we say: you have here `True', it is a `Bool'. But the first
argument of `f' should be an `Int'.

Thus it's clearly indicated where the two types came from.

My preference is still to include the words expected and inferred
which indicate (to me) that *either* could be wrong. And they don't
seem to me to be compiler writers' jargon. They're both ordinary (if
not everyday) English words. But definitely we should use language
which more clearly indicates which is which.

I'll pay more attention to error messages in the future.

GHC devs: would patches for error message language be considered?

--Max
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe