|
|
|
|
|
by chombier
2123 days ago
|
|
This is one example of a monad, probably not the most compelling if your language supports exceptions already (apart from having more explicit types). But there are many other examples that are useful in practice (IO, streams, parsers, lists, operations in context, futures, etc as mentioned in other threads). A monad is the interface you need to implement for each of these to compose nicely. Then one day you'll need to compose Foo's, so you'll ask yourself "is there a monad for Foo's?" and if there is the code generally writes itself. |
|