Re: improving error messages

2000-04-04 Thread Leon Smith
Why doesn't the implementation simply tack on a line number to the error message? One easy way to do this is to give an address/offset to where the error occurred, and then recompile the module to find the line number. This is a fairly common strategy among traditional compilers, especially Bor

Re: improving error messages

2000-04-03 Thread Koen Claessen
People have written: | Or you can do what hbc has done for donkey's years | and include 'showType' in Show. : | Incidentally, nhc98 also has had 'showType' in class | Show since the year dot - only Hugs and ghc lack it. | (Does anyone know why this idea didn't make it into | Haskell'98?)

Re: improving error messages

2000-04-03 Thread George Russell
Malcolm Wallace wrote: > > > > class ShowType a where > > > showType :: a -> String > > > > Or you can do what hbc has done for donkey's years and > > include 'showType' in Show. > > Incidentally, nhc98 also has had 'showType' in class Show since the > year dot - only Hugs and ghc la

RE: improving error messages

2000-04-03 Thread Malcolm Wallace
> > class ShowType a where > > showType :: a -> String > > Or you can do what hbc has done for donkey's years and > include 'showType' in Show. Incidentally, nhc98 also has had 'showType' in class Show since the year dot - only Hugs and ghc lack it. (Does anyone know why this idea d

RE: improving error messages

2000-03-31 Thread Sigbjorn Finne
[EMAIL PROTECTED] writes: > ... > > Although you can't show the value (because there isn't one), you can > at least show the type of the expression: > > class ShowType a where > showType :: a -> String Or you can do what hbc has done for donkey's years and include 'showType'

Re: improving error messages

2000-03-31 Thread Malcolm Wallace
> instance ShowType a => ShowType [a] >where >showsType xs = ('[':) . showsType x . (']':) where ~(x:_) = xs > > Looks like ~(x:_) gives access to a constant instance operation > on the type of an element of xs even when xs is empty. > > Looks like it works. But I do not understan

Re: improving error messages

2000-03-31 Thread Keith Wansbrough
Malcom and Sergey write: > instance ShowType a => ShowType [a] > where > showsType xs = ('[':) . showsType x . (']':) where ~(x:_) = xs Perhaps where [x] = [error "not used"] `asTypeOf` xs gives the idea better. --KW 8-) -- : Keith Wansbrough, MSc, BSc(Hons) (Auckland) --

RE: improving error messages

2000-03-31 Thread Simon Peyton-Jones
| To: Simon Peyton-Jones | Cc: '[EMAIL PROTECTED]'; [EMAIL PROTECTED] | Subject: Re: improving error messages | | | On 30-Mar-2000, Simon Peyton-Jones <[EMAIL PROTECTED]> wrote: | > | What do you think of improving the error messages like | > | Prelu

Re: improving error messages

2000-03-31 Thread Fergus Henderson
On 30-Mar-2000, Simon Peyton-Jones <[EMAIL PROTECTED]> wrote: > | What do you think of improving the error messages like > | Prelude.take: negative argument > | (for say, take (-1) [(0,'b'),(1,'a')] ) > > That would be splendid. But I don't see how to do it. > >

improving error messages

2000-03-31 Thread S.D.Mechveliani
Malcolm Wallace <[EMAIL PROTECTED]> writes >> And for (head []) there's really no useful info to hand. So I'm stumped. > Although you can't show the value (because there isn't one), you can > at least show the type of the expression: Printing the type is very desirable in this situation. But

Re: improving error messages

2000-03-31 Thread Jan Skibinski
On Fri, 31 Mar 2000, S.J.Thompson wrote: > To help students I have compiled a list of messages and examples of code that > provoke them. In many cases a little effort would, I guess, lead to vastly > more informative error messages. I'd be interested to hear what you (and the > Hugs gro

improving to improving error messages

2000-03-31 Thread S.D.Mechveliani
To my suggestion on the error messages Ketil Malde <[EMAIL PROTECTED]> writes > [..] > e.g instead of Hugs' Prelude head: > >head :: [a] -> a >head (x:_)= x > > we can use: > >head :: [a] -> a >head [] = error "Error: tak

RE: improving error messages

2000-03-31 Thread Malcolm Wallace
> take :: Int -> [a] -> [a] >If you want to define your own take > mytake :: Show a => Int -> [a] -> [a] >that's fine, but it's a different function. > >And for (head []) there's really no useful info to hand. So I'm stumped. Although you can't show the value (because there isn't one)

Re: improving error messages

2000-03-31 Thread S.J.Thompson
Sergey, I could not agree more. I sent the following message to the Hugs implementors a few months ago. I have taught Hugs for a couple of years and enjoy using it. Students like to have a system they can take home and install for free, and the system seems pretty robust. One problem s

RE: improving error messages

2000-03-30 Thread Simon Peyton-Jones
| What do you think of improving the error messages like | Prelude.take: negative argument | (for say, take (-1) [(0,'b'),(1,'a')] ) That would be splendid. But I don't see how to do it. take :: Int -> [a] -> [a] Since take is polymorphic in a, I can't

Re: improving error messages

2000-03-30 Thread Ketil Malde
As a relative novice who's been bitten by these things, I'd like to second the request for more detailed "program error" messages. When the question was last raised on comp.lang.functional, I think it sort of concluded with a suggestion to add an 'error' case to some Prelude functions, e.g inst

improving error messages

2000-03-30 Thread S.D.Mechveliani
Dear Haskell implementors, What do you think of improving the error messages like Prelude.head: empty list (for say, head [] :: (Int,Char) ) Prelude.take: negative argument (for say, take (-1) [(0,'b'),(1,'a')] ) ? As