Preface_specs.Free_monad
A Free monad
allows you to build a Preface_specs.Monad
from a given Preface_specs.Functor
.
Such Preface_specs.Monad
is equipped with two additional functions: one dedicated to the creation of a new data and another one for the effect handling.
Although free constructs are elegant, they introduce an execution cost due to the recursive nature of defining the type of a Free Monad
. There are cheaper encodings like Preface_specs.Freer_monad
, which removes the requirement for the Free monad
parameter to be a Preface_specs.Functor
and therefore does not increase its complexity.
module type TO_MONAD = sig ... end
The natural transformation for Free Monad
to Monad
.
module type CORE = sig ... end
The Free Monad
API without the Preface_specs.Monad
API.
module type API = sig ... end
The complete interface of a Free monad
.