[Haskell-beginners] let indenting problems
Miguel Pignatelli
miguel.pignatelli at uv.es
Mon Mar 2 04:46:23 EST 2009
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
M;
7stud wrote:
> I get indenting errors with the following attempts to use let:
>
> -----
> import Data.List (sortBy)
>
> mySort xs = sortBy myCompare xs
> let lx = length x
> ly = length y
> in where myCompare x y
> | lx < ly = LT
> | lx == ly = EQ
> | lx > ly = GT
>
> ------------------
>
> import Data.List (sortBy)
>
> mySort xs = sortBy myCompare xs
> where myCompare x y
> let lx = length x
> ly = length y
> in
>
> | lx < ly = LT
> | lx == ly = EQ
> | lx > ly = GT
>
> -------------
>
> import Data.List (sortBy)
>
> mySort xs = sortBy myCompare xs
> where myCompare x y
> let lx = length x
> ly = length y
> in | lx < ly = LT
> | lx == ly = EQ
> | lx > ly = GT
>
> -------------
>
>
> This is what I ended up with:
>
> -------
> import Data.List (sortBy)
>
> mySort xs = sortBy myCompare xs
> where myCompare x y
> | lx < ly = LT
> | lx == ly = EQ
> | lx > ly = GT
> where lx = length x
> ly = length y
> -------
>
> But I would like to know how to use let.
>
>
>
>
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
More information about the Beginners
mailing list