package monads

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

The binary fail monad interface.

Implemented by:

type 'a error

a type of error

type ('a, 'e) t

a monad type, where 'a is a value type, and 'e is a type parameter of the error type.

val fail : 'e error -> ('a, 'e) t

fail err diverges the computation, possibly providing an extra information in a value of type 'e error.

val catch : ('a, 'e) t -> ('e error -> ('a, 'e) t) -> ('a, 'e) t

catch m f if m diverges with some bottom value err, the f err is a result of the whole computation, otherwise returns m.