[swift-evolution] [Proposal] Higher Kinded Types (Monads, Functors, etc.)

Andrey Tarantsov andrey at tarantsov.com
Thu Dec 17 05:43:41 CST 2015


>> Optional.map and Array.map do different things, and unifying them seems harmful.
> 
> They actually don’t do different things. Optional can be thought of as an array of zero or one elements; from that point of view, operations like `map` and `flatMap` which are supported on both actually do the same thing.

I understand that reasoning, but it's completely contrary to how I (and presumably many other people) normally think. To me, optional is not a 0..1 array, it's just an optional. I don't want a flatMap on optionals (which, I believe, was thankfully removed in Swift 2).

A.



More information about the swift-evolution mailing list