3 ms·
The maybe monad is good way to deal with computations that may fail. Here is a Swift walkthrough http://www.mokacoding.com/blog/functor-applicative-monads-in-pi
by sjtgraham 11y ago
The maybe monad is good way to deal with computations that may fail. Here is a Swift walkthrough http://www.mokacoding.com/blog/functor-applicative-monads-in-pictures/ http://www.mokacoding.com/blog/functor-applicative-monads-in...
- ashark 11y agoEvery time I read about monads I feel stupid, but it's not always for the same reason. Sometimes it's because I don't understand it. Other times it's because I'm pretty sure I do understand it but I can't see what the big deal is.
- runT1ME 11y agoAh. The big deal is some languages can abstract over the idea of an arbitrary monad. You are correct though, most monads are not a big deal and fall into the "oh neat that's useful" category, and not the "omfg" one. The abstracting over them is pretty mind blowing though.
- cballard 11y agoA monad in Swift terms is essentially just a container type with an initializer that lets you put something in it, and implements flatMap. In Haskell, the equivalents are return and >>=. You can do more with it in Haskell because Monad is essentially a protocol, so you can rely on monadic types having those functions defined in terms of them. Array and Optional are examples. RAC's SignalProducer is... maybe one? Maybe three? That's really all there is.