[Haskell-cafe] Code review: efficiency question

Brian Hulley brianh at metamilk.com
Tue May 2 03:45:01 EDT 2006


Evan Martin wrote:
> I remember reading a tutorial that pointed out that you can often
> avoid explicit recusion in Haskell and instead use higher-level
> operators.
>
> For your code, I think
>   drawModals = foldr (flip (>>)) (return ()) . map drawModal
> works(?).

I think it would be foldl so that the (return()) would be nested as the 
leftmost element.
Thanks for pointing out this point-free version of drawModals, although for 
readability at the moment I think I still prefer just to use mapM_ drawModal 
(reverse cs)

Best regards, Brian. 



More information about the Haskell-Cafe mailing list