[Haskell-cafe] Problems interpreting

Andrea Rossato mailing_list at istitutocolli.org
Mon Sep 18 06:43:56 EDT 2006

On Mon, Sep 18, 2006 at 02:51:34AM -0700, Carajillu wrote:
> Hi, I'm a student and I have to do a program with Haskell. This is the first
> time I use this languaje, and I'm having problems with the indentation. I
> want to check if this function is correct, but when I try to make the GHCi
> interpret it, I get "line 18:parse error (possibly incorrect indentation)"
> The function is:
> 		if x == e then return l2

I did not understand what you are trying to do, anyway the error
message is due to the expression above, and not to indentation.
The Haskell if constructions is: "if ... then ... else", and else
cannot be missing.

Moreover, "return" is not a way to return a value. It is a special
function that works with the monad class. Actually it is one of the
two methods of the monad class, and it inserts a value into a monad.

As far as your code goes, I'd suggest you to read some tutorials, like
"The Gentle Introduction", or "Hasekll for C Programmers".

Have a look here:
and here

Hope this helps.


More information about the Haskell-Cafe mailing list