The FunctorM library

Remi Turk rturk at science.uva.nl
Wed Mar 23 18:58:19 EST 2005


On Wed, Mar 23, 2005 at 01:28:28PM -0800, Iavor Diatchki wrote:
> 
> > >   3) rename FunctorM class to ForEach
> I was suggesting here that we rename the method to "forEach" and swap
> the order of the arguments.   The reason I suggested this is that I
> find myself writing code like this a lot:
> 
> mapM (\x ->
>   do ... some monadic ...
>      ... code goes here ...
> ) xs
> 
> this look better in this form:
> 
> forEach xs (\x ->
>   do ... some monadic ...
>      ... code goes here ...
> )

why not just define a normal function: forEach = flip fmapM ?
Calling the whole class ForEach makes the connection to
Functor/Monad less clear, and renaming only the method seems
rather inconsequent to me.

Remi

P.S. Then we can finally start a Holy War about the One True "Brace" Style.
     I'm usually writing:
     forEach xs $ \x -> do
     	...
     ;)

-- 
Nobody can be exactly like me. Even I have trouble doing it.


More information about the Libraries mailing list