darcs patch: Improve Control.Monad.filterM:

Spencer Janssen sjanssen at cse.unl.edu
Tue Aug 8 11:58:19 EDT 2006


On Aug 8, 2006, at 10:24 AM, Simon Marlow wrote:
> It may well be better, but it doesn't have the same laziness  
> properties, so it isn't the same function.  eg. try this:
>
>  do filterM (\x -> return undefined) [1]; return ()
Ah yes, I missed that.

> Of course we may discuss whether the extra laziness is useful, but  
> I can't apply the patch as it stands because it would break Haskell  
> 98.
Data.List uses "#ifdef USE_REPORT_PRELUDE" in places to choose  
between original and improved implementations.  Is that an option in  
this case?

> > But the foldr is not needed:
>
> The foldr was there to allow fusion, I believe.
>
> Cheers,
> 	Simon



More information about the Libraries mailing list