# Monad

Monad is an actively used design pattern created in 1980. 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...

39Years Old |

- Monad ranks in the top 25% of entities I track
- the Monad wikipedia page
- Monad first appeared in 1980
- Have a question about Monad not answered here? 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 January 24th, 2020