error messages in Nov 2003 release

Ross Paterson ross at soi.city.ac.uk
Tue Jan 6 16:01:36 EST 2004


On Tue, Jan 06, 2004 at 02:09:42PM +0000, Alastair Reid wrote:
> I'm not quite sure when it happened but error messages in the Nov 2003
> release are much less informative than they used to be.  In particular,
> I was hoping to see a line number and filename in this message.
> 
>   Program error: pattern match failure
> 
> In contrast, ghci reports:
> 
>   *** Exception: gen_effect.hs:502: Non-exhaustive patterns in function
>       writeResult
> 
> I'm guessing that what's happened is we're using non-deterministic
> exceptions in more of Hugs and the error object created in response
> to a pattern match failure doesn't record the line number, etc.

That's right.  Hugs never reported line numbers and filenames, but it used
to print the failing redex with the internal printer, and the Nov 2003
release does that too (by filling in the String in the PatternMatchFail
exception):

  Program error: pattern match failure: head []

(Maybe you have a pre-release version?)

Hugs also used to print the failing redex for several other things that
now go through the Exception type from Control.Exception:

- undefined method exceptions now include the name of the method, which
  is a bit less information than before:

    Program error: undefined member: my_method

- missing field exceptions are similar, but report only the constructor:

    Program error: undefined field: Constr

  Maybe they should report both constructor and field, as GHC does.

- arithmetic errors now have no extra info, because the ArithException
  type now thrown has no String in it:

    Program error: divide by zero

- undefined array element (UndefinedElement) exceptions have a String
  field, but currently don't use it:

    Program error: undefined array element

  The problem is that that the primitive has only the raw integer array
  index (as the result of convergence with Data.Array.*), which isn't
  much use to the user.


More information about the Hugs-Bugs mailing list