[Haskell-cafe] for = flip map

Matthew Steele mdsteele at alum.mit.edu
Wed Mar 28 22:05:10 CEST 2012


Doesn't for already exist, in Data.Traversable?   Except that for =
flip traverse.

http://www.haskell.org/hoogle/?hoogle=for

Cheers,
-Matthew

On Wed, Mar 28, 2012 at 3:58 PM, Johannes Waldmann
<waldmann at imn.htwk-leipzig.de> wrote:
> Good: we have  mapM, and we have forM ( = flip mapM )  .
>
> Sure this is just a convenience, and indeed
> "forM xs $ \ x -> do ..." is quite handy,
> especially if "xs" is really small,
> and "..." is some larger expression.
>
> Bad: we have  map,  but we are missing:  for ( = flip map ) .
>
> The function is very convenient, for the same reasons as above.
> I can't remember how often I typed "for = flip map" in a source file.
> I never put this definition in a module either,
> since the import statement would be longer than the definition.
>
> So, I'm all for "for" .
>
> In Data.List? In the Prelude? (Should put it right next to "map".)
>
> - J.W.
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe



More information about the Haskell-Cafe mailing list