Re:Swift Functors, Applicatives, and Monads in Pictures
by jbooth on Wednesday July 15, 2015 @12:06PM
(#9892074)
I'd call a Future a threadsafe queue with one element going thru it IMO, it's just as much of a collection as Optional.
[ Parent
| on HN ]
Re:Swift Functors, Applicatives, and Monads in Pictures
by AdieuToLogic on Wednesday July 15, 2015 @01:28PM
(#9892713)
That's the beautiful thing about types which satisfy the Monad laws. Because both Future and Option (in Scala if not other languages) satisfy these laws, I think it perfectly valid to consider a Future to be collection type with a cardinality of 0 or 1 that also abstracts latency.
Re:Swift Functors, Applicatives, and Monads in Pictures
by jbooth on Wednesday July 15, 2015 @03:02PM
(#9893345)
Yeah, but I can do that without category theory, it's just obvious. I still don't understand what 'monad' offers over 'flatMappable' besides the ability to use 'endofunctor' in the same sentence.
Re:Swift Functors, Applicatives, and Monads in Pictures
by dragonwriter on Wednesday July 15, 2015 @03:07PM
(#9893366)
> I still don't understand what 'monad' offers over 'flatMappable'
Its several characters and syllables shorter, and doesn't appeal to an intuition which is distant from many of the productive uses of construct.