Dear ghc-team,


At the moment I think it is only possible that
error messages about functions can refer to line
numbers and names of source files at the points
of *definition* of these functions. These error
messages are the ones that ghc automatically
generates when there is a pattern matching error.

I think it would be useful to have error messages
about functions that refer to the line number and
the name of the source files at the moment these
functions are *used*. This would make it a lot
easier to locate errors.

I also think it would be handy to give the user
more control about line numbers and file names.
One possibility (modulo newlines in the RULES section)
would be an extension as follows:

{-# RULES
"lookupFM.range check" forall m key . rdMap m key =
 maybe (lookupFmError #LINE #FILE)
       id
       (#lookupFM m key)
#-}  --  ^^^^^^^^

lookupFmError line file
  = error $ concat ["lookupFM :: key not in range in line ",line," in ",file]

The function #lookupFM would be the ``real''
lookupFM function. The idea is that after debugging
of a function one can just disable a rule in the
RULES section.


Just a thought.

Regards,


Marc van Dongen
-- 
     Marc van Dongen, CS Dept | phone:  +353 21 4903578
University College Cork, NUIC | Fax:    +353 21 4903113
  College Road, Cork, Ireland | Email: [EMAIL PROTECTED]

Reply via email to