[Haskell-beginners] Re: let indenting problems

Miguel Pignatelli miguel.pignatelli at uv.es
Tue Mar 3 04:31:47 EST 2009



7stud wrote:
> 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:
> 

Yes, sorry about that, it is an issue with indentation while 
copy/pasting the code

M;

> -- 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. 
> 
> 
> 
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
> 


More information about the Beginners mailing list