either.ml

Either type for errors etc.

Definitions

Definitions / Working with Either

data Either a b = Left a | Right b
unRight : Either a b -> b
fromMaybe : b -> Maybe a -> Either b a

Monad definition

bind : Either e a -> (a -> Either e b) -> Either e b
flatMap : (a -> Either e b) -> Either e a -> Either e b
fmap : (a -> b) -> Either e a -> Either e b
pure : a -> Either e a