Preface_make.State
Building a Preface_specs.State
, a State transformer
.
Build an Preface_specs.STATE
over an Inner Preface_specs.MONAD
.
module Over_monad
(M : Preface_specs.MONAD)
(State : Preface_specs.Types.T0) :
Preface_specs.STATE with type state = State.t and type 'a monad = 'a M.t
If there are complementary implementations to Preface_specs.MONAD
attached to the Inner Preface_specs.MONAD
type, it is possible to promote the Preface_specs.STATE
API with these complementary implementations
If the Inner Preface_specs.MONAD
is also a Preface_specs.FUNCTOR
, the State monad
is also a Preface_specs.FUNCTOR
.
module Functor
(F : Preface_specs.FUNCTOR)
(State : Preface_specs.Types.T0) :
Preface_specs.FUNCTOR with type 'a t = State.t -> ('a * State.t) F.t
If the Inner Preface_specs.MONAD
is also an Preface_specs.MONAD
, the State monad
is also an Preface_specs.APPLICATIVE
.
module Applicative
(M : Preface_specs.MONAD)
(State : Preface_specs.Types.T0) :
Preface_specs.APPLICATIVE with type 'a t = State.t -> ('a * State.t) M.t
If the Inner Preface_specs.MONAD
is also an Preface_specs.MONAD_PLUS
, the State monad
is also an Preface_specs.ALTERNATIVE
.
module Alternative
(M : Preface_specs.MONAD_PLUS)
(State : Preface_specs.Types.T0) :
Preface_specs.ALTERNATIVE with type 'a t = State.t -> ('a * State.t) M.t
If the Inner Preface_specs.MONAD
is also a Preface_specs.MONAD
, the State monad
is also a Preface_specs.MONAD
(this is this functor which is used in the full API definition).
module Monad
(M : Preface_specs.MONAD)
(State : Preface_specs.Types.T0) :
Preface_specs.MONAD with type 'a t = State.t -> ('a * State.t) M.t
If the Inner Preface_specs.MONAD
is also a Preface_specs.MONAD_PLUS
, the State monad
is also a Preface_specs.MONAD_PLUS
.
module Monad_plus
(M : Preface_specs.MONAD_PLUS)
(State : Preface_specs.Types.T0) :
Preface_specs.MONAD_PLUS with type 'a t = State.t -> ('a * State.t) M.t
Advanced way to build an Preface_specs.STATE
, constructing and assembling a component-by-component of Preface_specs.STATE
. (In order to provide your own implementation for some features.)
module Core_over_monad
(M : Preface_specs.MONAD)
(State : Preface_specs.Types.T0) :
Preface_specs.State.CORE with type state = State.t and type 'a monad = 'a M.t