Skip to main content
monad

monad

3 9.9
A programming way to keep data and actions together and control changes outside the program
  • noun
  • /ˈmɒnæd/
  • Specialized
translation icon : mónada
  • Using a monad can simplify complex operations by providing a structured way to handle data transformations.

Examples

  • The Haskell IO Monad could be regarded as a case of trying to force incompatible paradigms together.

    Blog text (8)
  • The starting point for me was the realization that in Haskell, pure code (outside of the IO monad) may raise an exception, and, importantly for my point, the exceptions are user-defined.

    Blog text (16)
  • One reason is that doing them properly puts exception allocation into the IO monad.

    Blog text (16)
  • If you don't know what a monad is, in Scala, it is something that has the map and flatMap methods.

    Blog text (11)
  • In this way, we use Future almost like an IO monad (see this post for an introduction to functional IO).

    Blog text (11)
  • There are languages I dabble in but don't know well (JavaScript), and there are ideas that I barely understand (monads).

    Blog text (3)
  • In functional programming, a monad helps manage side effects by wrapping values in a context.

  • The promise monad allows asynchronous computations to be written in a more readable manner.

Surface Forms

monad singular
monads plural

Etymology

Monad comes from the Greek words monas and monos, which mean 'single' or 'one'. So in programming a monad is a pattern that puts data and actions into one organized unit to keep code behaviour clear and predictable.