[swift-evolution] [SHORT Review] SE-0133: Rename `flatten()` to `joined()`

Jacob Bandes-Storch jtbandes at gmail.com
Mon Jul 25 16:39:14 CDT 2016


On Mon, Jul 25, 2016 at 2:09 PM, David Rönnqvist <swift-evolution at swift.org>
wrote:
>
> Haskell calls the general *m (m a) -> m a* function for "join", but also
> has a specialized *[[a]] -> [a]* function called "concat". (The function
> corresponding to "flatMap" is called "bind" in Haskell (although used as an
> operator), so since neither is called flatten or flatMap it doesn't have
> the confusion where one of them would be named so).
>

There's also mapMaybe
<http://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Maybe.html#v:mapMaybe>
and concatMap
<http://hackage.haskell.org/package/base-4.9.0.0/docs/Prelude.html#v:concatMap>
and
mapM
<http://hackage.haskell.org/package/base-4.9.0.0/docs/Prelude.html#v:mapM> and
probably others. "concat" is just "concatMap id". Similarly, concatMap can
be seen as equivalent to bind with its arguments reversed, "flip (>>=)". I
personally find the plethora of similar functions confusing, but I'm not
totally fluent in Haskell's standard libraries.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160725/332393ad/attachment.html>


More information about the swift-evolution mailing list