stdune

Dune's unstable standard library
Legend:
Library
Module
Module type
Parameter
Class
Class type
Library stdune
Module Stdune . State . Make

Parameters

module S : sig ... end
module M : Monad.S

Signature

include Monad.S
type 'a t
val return : 'a -> 'a t
val bind : 'a t -> f:( 'a -> 'b t ) -> 'b t
val map : 'a t -> f:( 'a -> 'b ) -> 'b t
module O : sig ... end
val run : 'a t -> S.t -> (S.t * 'a) M.t

run t state runs computation t with state as the initial state. The final state and the computed result are returned

val get : S.t t

get returns the current state

val set : S.t -> unit t

set s sets the current state to s

val lift : 'a M.t -> 'a t

lift m lifts m into the transformer

val modify : ( S.t -> S.t ) -> unit t

modify f lifts f into the monad. f is executed with the current state to produce a new state.