std.option

A type that can represent the abscence of a value

Types

type Option a = 
    | None
    | Some a

Option represents a value which may not exist.

Values

let unwrap opt : forall a . std.types.Option a -> a

let semigroup a : forall a .
    std.semigroup.Semigroup a -> std.semigroup.Semigroup (std.types.Option a)

let monoid a : forall a . std.semigroup.Semigroup a -> std.monoid.Monoid (std.types.Option a)

let former : {
    semigroup : forall a . std.semigroup.Semigroup (std.types.Option a),
    monoid : forall a . std.monoid.Monoid (std.types.Option a)
}

let latter : {
    semigroup : forall a . std.semigroup.Semigroup (std.types.Option a),
    monoid : forall a . std.monoid.Monoid (std.types.Option a)
}

let eq ?a : forall a . [std.cmp.Eq a] -> std.cmp.Eq (std.types.Option a)

Eq a defines equality (==) on a

let ord ?a : forall a . [std.cmp.Ord a] -> std.cmp.Ord (std.types.Option a)

Ord a defines an ordering on a

let functor : std.functor.Functor std.types.Option

A Functor represents an action on a parameterized type which does not change the structure with the mapped type.

The following laws should hold:

  • map id == id
  • map (f << g) == map f << map g

let applicative : std.applicative.Applicative std.types.Option

A Functor with application.

The following laws should hold:

  • wrap id <*> v = v
  • wrap (<<) <> u <> v <> w = u <> (v <*> w)
  • wrap f <*> wrap x = wrap (f x)
  • u <> wrap y = wrap (\g -> g x) <> u

let alternative : std.alternative.Alternative std.types.Option

A monoid on applicative functors.

let monad : std.monad.Monad std.types.Option

A generalised interface for imperatively sequencing actions

let show ?d : forall a . [std.show.Show a] -> std.show.Show (std.types.Option a)

Show a represents a conversion function from a to a readable string.

let foldable : std.foldable.Foldable std.types.Option

Operations over a data structure that can be folded which means that a functions gets called on each element to reduce the structure to a single value (Array, List and Map are all Foldable)

let traversable : std.traversable.Traversable std.types.Option