want better error msg with Class Read

Iavor S. Diatchki diatchki@cse.ogi.edu
Thu, 07 Nov 2002 08:52:00 -0800


hi,

Johannes Waldmann wrote:

> This is correct, but I would like to show (in the error message)
> the prefix that *was* parsed as well.
> If `read' was a class method, I could override it.
> (Compare class Show, where there is the method `showsPrec',
> but since H98 (?), `show' is a class method as well.)
>
> In my application, the type to parse is not Integer,
> but some expression type that might contain parentheses.
> Its Read instance uses the Parsec library,
> but I think this is irrelevant to the above question.


why bother with the read class?  it seems to be only good for quick 
hacks.  if you already have a parsec parser and worry about the quality 
of error messages you should probably use something different.  if you 
want to overload the parsing function you could create your own class,
with perhaps a more useful monad than the fixed combination of state and 
lists offered by Read.

bye
iavor


-- 
==================================================
| Iavor S. Diatchki, Ph.D. student               |
| Department of Computer Science and Engineering |
| School of OGI at OHSU                          |
| http://www.cse.ogi.edu/~diatchki               |
==================================================