std.result

Error handling type.

Types

type Result e t = 
    | Err e
    | Ok t

Result represents either success (Ok) or an error (Err)

Values

let unwrap_ok res : forall a a0 . std.types.Result a a0 -> a0

let unwrap_err res : forall a a0 . std.types.Result a a0 -> a

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

Eq a defines equality (==) on a

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

Ord a defines an ordering on a

let functor : forall a . std.functor.Functor (std.types.Result a)

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 : forall a . std.applicative.Applicative (std.types.Result a)

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 monad : forall a . std.monad.Monad (std.types.Result a)

A generalised interface for imperatively sequencing actions

let foldable : forall a . std.foldable.Foldable (std.types.Result a)

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 : forall a . std.traversable.Traversable (std.types.Result a)

let show ?e ?t : forall a a0 .
    [std.show.Show a]
        -> [std.show.Show a0]
        -> std.show.Show (std.types.Result a a0)

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