On Fri, Sep 10, 1999 at 07:40:03PM +0200, Jose Emilio Labra Gayo wrote:
> I have 3 wishes for Haskell (specially Hugs)
>
> 1.- Show "some" Warnings
> -------------------------
> Hugs only reports when a program is wrong, but it could also
> try to detect common mistakes and report them as warnings.
>
> Of course, there are a lot of possible warnings, but it would be
> nice to include the most common (I can't be more precise)
>
> As an example, suppose you write a long program and you define:
>
> > f = "First definition . . . ."
>
> And you define two or more pages below a second and different
> (while type correct) definition for f
>
> > f = "Second definition . . ."
>
> Suppose that:
> 1.- You load the program and it compiles
> 2.- When you run it, it crashes!
> 3.- You don't remember the first definition of 'f'
> and you try to repair the second definition
> 4.- and you go back a little more desperate to step (1)
> . . .
>
> The Hugs system could help the programmer with a little warning telling
> that f's definition was repeated
Have you ever actually had this happen to you? I tried to load the following
program into hugs:
l [] = 0
f 1 = 1
f x = x * (f (x -1))
l (x:xs) = 1 + (l xs)
And the result I got:
ERROR "/tmp/foo.hs" (line 1): "l" multiply defined
I think having function definitions in multiple places is forbidden by the
report (though I haven't checked).
(For the record the version of hugs I'm using is 1.4)
Also, when was the last time something you wrote in Haskell crashed? ;)
>
>
> 2.- Try to recover from the first error
> ---------------------------------------
> Hugs could give a list of [line number]-[error message] instead
> of reporting only the first error.
>
>
My experience with this in C compiliers (Older version of Symantic C/C++
springs to mind, and also gcc) is that often fixing the first error clears
up some of the subsequent error reports (ie they were caused by parsing
breaking down). I think this would be especially true with the layout rule
and all.
--
-Simon Raahauge DeSantis