[swift-evolution] Add an ifPresent function to Optional

Erica Sadun erica at ericasadun.com
Mon Mar 14 17:44:05 CDT 2016

> No.  My argument is that map on collections and on optionals are two
> completely different things.  They unify on a level that does not
> exist in Swift (higher-kinded types).  We could name Optional.map()
> differently, and that would be a separate decision from renaming
> Collection.map(), but we used the name `map` primarily because of
> precedent, not because there is a HKT notion of these two operations
> being the same.

Convergent evolution then, like tenrecs and hedgehogs?

Because the way I've been thinking of it is like a teeny tiny collection that either can fit one thing snugly into it or not.
You're going to make me have completely different mental images when I use Optional.map now, and I don't even
have a mental metaphor to replace it with.

-- E

More information about the swift-evolution mailing list