[Haskell-beginners] Top beginner mistakes

Daniel Fischer daniel.is.fischer at web.de
Thu Mar 5 13:47:35 EST 2009


Am Donnerstag, 5. März 2009 19:13 schrieb Francesco Bochicchio:
> 2009/3/4 7stud <bbxx789_05ss at yahoo.com>
>
> > Here are my top three:
> >
> > ...
> >
> > 3) Not putting parentheses around arguments of the form x:xs
> >
> > dosomething x:xs = head xs
>
> I have a variation here:
>
> function [] = ...
> function [x:xs] = ...
>
> Another of mine is the classical:
>
> print function arguments -- or variations
>
> but I finally learned to use '$' here .
>
> > In all three cases, the error messages don't help spot the problem.
> >

At least they give a source position, so you know where to look.
But yes, "parse error" is not very specific.

> >
> > I think that part of the problem  is that haskell syntax is powerful but
>
> terse, and therefore is not easy for a compiler to guess the intentions in
> the programmers.
> For instance, in any other language the expression 'map f'  would give the
> error "missing second parameter",  while in haskell could be a partial
> function application.
>
> However, some of ghc messages could probably  be made more
> 'beginners-friendly'.

Create a ticket if you encounter a particularly unhelpful error message.
If you can suggest a better message, all the better.

>
> Ciao
> ---------
> FB

Cheers,
Daniel



More information about the Beginners mailing list