package telegraml

  1. Overview
  2. Docs

Used for representing results of various actions where a success or failure can occur. Contains helper functions to implement a monadic and functorial interface.

type 'a result =
  1. | Success of 'a
  2. | Failure of string

Stores the return value if a function succeeded or a string if the function failed

val return : 'a -> 'a result

Raise a normal value into a Success : result

val default : 'a -> 'a result -> 'a

Take the value of the result, if it succeeded, or the other argument by default and return that

val (>>=) : 'a result -> ('a -> 'b result) -> 'b result

Bind Successes through the given function

val (<$>) : ('a -> 'b) -> 'a result -> 'b result

Map Successes through the given function