# monad laws

All monads should follow (and in practice, all built-ins do), with respect to the above three operations,

**left identity**`return a >>= k = k a`

`k`

will be a function that acceps`a`

and gives`m a`

, so instead of wrapping`a`

to bind it to k, we should be able to apply.

**right identity**`m >>= return = m`

- returning an "empty" monad should just give the monad instance itself

**associativity**`(m a >>= f) >>= g = m a >>= (\x -> f x >>= g)`

- On the LHS;
`f`

is of type`a -> m b`

, so the first term is`m b`

`g`

is of type`b -> m c`

, result is`m c`

- On the RHS:
`\x -> f x`

immediately takes type`a`

and gives`m b`

- bound to
`g`

to give`m c`

- in this sense, the bracket part is a lambda wrapper on simply
`f >>= g`

that allows it to be a function that fits the`bind`

typesig.

- On the LHS;