3 ms·
In a language that supports Monads (e.g. Haskell or Scala), the above could be implemented as a library.
by willtim 6y ago
In a language that supports Monads (e.g. Haskell or Scala), the above could be implemented as a library.
- artemonster 6y agocan you recommend something to read to be able to understand more parctically HOW to implement those with monads? thank you
- willtim 6y agoMonads are a pattern for sequential composition of effectful computations (i.e. statements). Some expessive languages, such as F#, Haskell and Scala support a special overloadable syntax for any arbitrary monad, therefore giving a fully programmable notion of statements. For background reading in this area, perhaps start with "A poor man's concurrency Monad" by Claessen, it's a very easy read and shows how green threads can be written as a user library allowing pluggable schedulers. F# also implements its asynchronous workflows using essentially this technique, see "The F# Asynchronous Programming Model". LINQ and the reactive library Rx from C# are also great examples of Monads.