Monads.


Maybe & Either

Monads model computations with context (e.g., errors or absence of value). Maybe represents optional values; Either e a represents error e or result a.

Maybe example:

Either example: