[Haskell-beginners] Re: let indenting problems
7stud
bbxx789_05ss at yahoo.com
Mon Mar 2 14:42:42 EST 2009
Miguel Pignatelli <miguel.pignatelli <at> uv.es> writes:
>
> What about...
>
> mySort xs = let myCompare x y
> | lx < ly = LT
> | lx == ly = EQ
> | lx > ly = GT
> where
> lx = length x
> ly = length y
> in sortBy myCompare xs
>
That doesn't work for me:
-- bhask.hs
mySort xs = let myCompare x y
| lx < ly = LT
| lx == ly = EQ
| lx > ly = GT
where
lx = length x
ly = length y
in sortBy myCompare xs
Prelude> :load bhask.hs
[1 of 1] Compiling Main ( bhask.hs, interpreted )
bhask.hs:4:16: parse error (possibly incorrect indentation)
Failed, modules loaded: none.
Prelude>
Line 4 is the first guard.
More information about the Beginners
mailing list