Re:Swift Evolution acceptances: The big three
by cballard on Friday March 04, 2016 @09:53AM
(#11224063)
Both Optional and Array have flatMap, i.e.
However, you cannot write a protocol for "things that can be flatMapped", because you cannot refer to a Self<T> specialized with a different type (Self<R>). With HKTs, you can do that, which would let you write something like this:
That's not useful on its own, but it means that you can now write functions and extensions that reason about the general concept of anything FlatMappable (this is most of the way to what is known as monads, FWIW).
[ Parent
| on HN ]
There are no comments on this comment yet.