Skip to content
Search

Scala:Monad

lastmod 2024-11-05created 2024-11-052 edits

Monad Laws

The monad laws in Scala.

To qualify as a monad, a type has to satisfy three laws:

  • Associativity - m flatMap f flatMap g == m flatMap (x => f(x) flatMap g)
  • Left unit - unit(x) flatMap f == f(x)
  • Right unit - m flatMap unit == m

See also

author Zer0 sitemap