std.alternative

Implementation of the Alternative type

Types

#[implicit]
type Alternative f = {
    applicative : Applicative f,
    empty : forall a . f a,
    or : forall a . f a -> f a -> f a
}

A monoid on applicative functors.

Values

let empty ?alt : forall a f . [Alternative f] -> f a

The identify of or

let or ?alt : forall a f . [Alternative f] -> f a -> f a -> f a

An associative binary operation.

Evaluates to the first argument if it is not empty, otherwise evaluates to the second argument.

#[infix(left, 3)]
let <|> : forall a f . [Alternative f] -> f a -> f a -> f a

An associative binary operation. Alias of or.

Evaluates to the first argument if it is not empty, otherwise evaluates to the second argument.