Scala:Monad
Monad Laws
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