[Haskell-cafe] for = flip map
mdsteele at alum.mit.edu
Wed Mar 28 22:05:10 CEST 2012
Doesn't for already exist, in Data.Traversable? Except that for =
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
More information about the Haskell-Cafe