[Haskell-beginners] Error in converting the function from let in clause to where

Yitzchak Gale gale at sefer.org
Mon Jul 18 21:56:20 CEST 2011


Hi Mukesh,

mukesh tiwari wrote:
> ...I am trying to implement
> elliptic curve prime factorisation and initially wrote
> function "addPoints" using let in clause. It works fine. When i  converted
> the "addPoint" using where clause then its not working and not adding the
> points correctly ....
> In case of indentation problem
> , source code on http://hpaste.org/49174 .

Your suspicion is correct. It is an indentation problem.

The first "where" is indented more than "(_, d') -> Right d'"
so it is part of that case. It has no effect, because none
of the variables defined in the "where" is used in that case,
only d'.

The second "where" is indented less than the last case,
so it applies to the entire "addPoints" function, all the
way back to the beginning!

Regards,
Yitz



More information about the Beginners mailing list