package clarity

  1. Overview
  2. Docs

State monad

include Monad.S2
type (_, _) t
include Monad.Basic2 with type ('p, 'a) t := ('p, 'a) t
include Applicative.Basic2 with type ('p, 'a) t := ('p, 'a) t
include Functor.Basic2 with type ('p, 'a) t := ('p, 'a) t
val bind : ('a -> ('p, 'b) t) -> ('p, 'a) t -> ('p, 'b) t
include Applicative.S2 with type ('p, 'a) t := ('p, 'a) t
include Applicative.Basic2 with type ('p, 'a) t := ('p, 'a) t
include Functor.Basic2 with type ('p, 'a) t := ('p, 'a) t
val pure : 'a -> ('p, 'a) t
val ap : ('p, 'a -> 'b) t -> (unit -> ('p, 'a) t) -> ('p, 'b) t
include Functor.S2 with type ('p, 'a) t := ('p, 'a) t
include Functor.Basic2 with type ('p, 'a) t := ('p, 'a) t
val map : ('a -> 'b) -> ('p, 'a) t -> ('p, 'b) t
val (>|=) : ('p, 'a) t -> ('a -> 'b) -> ('p, 'b) t
val replace : 'a -> ('p, 'b) t -> ('p, 'a) t
val void : ('p, 'a) t -> ('p, unit) t
val ap' : ('p, 'a -> 'b) t -> ('p, 'a) t -> ('p, 'b) t
val (<*>) : ('p, 'a -> 'b) t -> ('p, 'a) t -> ('p, 'b) t
val (<~>) : ('p, 'a -> 'b) t -> (unit -> ('p, 'a) t) -> ('p, 'b) t
val discard_left : ('p, 'a) t -> (unit -> ('p, 'b) t) -> ('p, 'b) t
val discard_right : ('p, 'a) t -> (unit -> ('p, 'b) t) -> ('p, 'a) t
val repeat : int -> ('p, 'a) t -> ('p, 'a list) t
val repeat_ : int -> ('p, 'a) t -> ('p, unit) t
val forever : ('p, 'a) t -> ('p, 'b) t
val (>>=) : ('p, 'a) t -> ('a -> ('p, 'b) t) -> ('p, 'b) t
val join : ('p, ('p, 'a) t) t -> ('p, 'a) t
val mcompose : ('b -> ('p, 'c) t) -> ('a -> ('p, 'b) t) -> 'a -> ('p, 'c) t
val run : ('s, 'a) t -> 's -> 's * 'a
val state : ('s -> 's * 'a) -> ('s, 'a) t
val get : ('s, 's) t
val gets : ('s -> 'a) -> ('s, 'a) t
val put : 's -> ('s, unit) t
val modify : ('s -> 's) -> ('s, unit) t