Monad is an actively used design pattern. In functional programming, a monad is a design pattern that allows structuring programs generically while automating away boilerplate code needed by the program logic. Monads achieve this by providing their own data type, which represents a specific form of computation, along with one procedure to wrap values of any basic type within the monad (yielding a monadic value) and another to compose functions that output monadic values (called monadic functions).This allows monads to simplify a wide range of problems, like handling potential undefined values (with the Maybe monad), or keeping values within a flexible, well-formed list (using the List monad). With a monad, a programmer can turn a complicated sequence of functions into a succinct pipeline that abstracts away auxiliary data management, control flow, or side-effects.Both the concept of a monad and the term originally come from category theory, where it is defined as a functor with additional structure. Read more on Wikipedia...
- Monad ranks in the top 50% of entities I track
- the Monad wikipedia page
- I have 15 facts about Monad. what would you like to know? email me and let me know how I can help.
Languages with Monad include haskell
Example from haskell:
-- https://stackoverflow.com/questions/44965/what-is-a-monad parseExpr = parseString <|> parseNumber parseString = do char '"' x <- many (noneOf "\"") char '"' return (StringValue x) parseNumber = do num <- many1 digit return (NumberValue (read num))
Last updated July 8th, 2019