sig
module type MONOID =
sig
type t
val empty : CCCat.MONOID.t
val append : CCCat.MONOID.t -> CCCat.MONOID.t -> CCCat.MONOID.t
end
module type FUNCTOR =
sig
type +'a t
val map : ('a -> 'b) -> 'a CCCat.FUNCTOR.t -> 'b CCCat.FUNCTOR.t
end
module type APPLICATIVE =
sig
type +'a t
val map : ('a -> 'b) -> 'a t -> 'b t
val pure : 'a -> 'a CCCat.APPLICATIVE.t
val ( <*> ) :
('a -> 'b) CCCat.APPLICATIVE.t ->
'a CCCat.APPLICATIVE.t -> 'b CCCat.APPLICATIVE.t
end
module type MONAD_BARE =
sig
type +'a t
val return : 'a -> 'a CCCat.MONAD_BARE.t
val ( >>= ) :
'a CCCat.MONAD_BARE.t ->
('a -> 'b CCCat.MONAD_BARE.t) -> 'b CCCat.MONAD_BARE.t
end
module type MONAD =
sig
type +'a t
val return : 'a -> 'a t
val ( >>= ) : 'a t -> ('a -> 'b t) -> 'b t
val map : ('a -> 'b) -> 'a t -> 'b t
val pure : 'a -> 'a t
val ( <*> ) : ('a -> 'b) t -> 'a t -> 'b t
end
module type MONAD_TRANSFORMER =
sig
type +'a t
val return : 'a -> 'a t
val ( >>= ) : 'a t -> ('a -> 'b t) -> 'b t
val map : ('a -> 'b) -> 'a t -> 'b t
val pure : 'a -> 'a t
val ( <*> ) : ('a -> 'b) t -> 'a t -> 'b t
module M : MONAD
val lift : 'a M.t -> 'a t
end
type 'a sequence = ('a -> unit) -> unit
module type FOLDABLE =
sig type 'a t val to_seq : 'a CCCat.FOLDABLE.t -> 'a CCCat.sequence end
module type TRAVERSE =
functor (M : MONAD) ->
sig
type +'a t
val sequence_m : 'a M.t CCCat.TRAVERSE.t -> 'a CCCat.TRAVERSE.t M.t
val fold_m :
('b -> 'a -> 'b M.t) -> 'b -> 'a CCCat.TRAVERSE.t -> 'b M.t
val map_m :
('a -> 'b M.t) -> 'a CCCat.TRAVERSE.t -> 'b CCCat.TRAVERSE.t M.t
end
module type FREE_MONAD =
sig
module F : FUNCTOR
type 'a t = Return of 'a | Roll of 'a CCCat.FREE_MONAD.t F.t
val return : 'a -> 'a t
val ( >>= ) : 'a t -> ('a -> 'b t) -> 'b t
val map : ('a -> 'b) -> 'a t -> 'b t
val pure : 'a -> 'a t
val ( <*> ) : ('a -> 'b) t -> 'a t -> 'b t
val inj : 'a F.t -> 'a CCCat.FREE_MONAD.t
end
module WrapMonad :
functor (M : MONAD_BARE) ->
sig
type 'a t = 'a M.t
val return : 'a -> 'a t
val ( >>= ) : 'a t -> ('a -> 'b t) -> 'b t
val map : ('a -> 'b) -> 'a t -> 'b t
val pure : 'a -> 'a t
val ( <*> ) : ('a -> 'b) t -> 'a t -> 'b t
end
module MakeFree :
functor (F : FUNCTOR) ->
sig
module F :
sig type 'a t = 'a F.t val map : ('a -> 'b) -> 'a t -> 'b t end
type 'a t = Return of 'a | Roll of 'a t F.t
val return : 'a -> 'a t
val ( >>= ) : 'a t -> ('a -> 'b t) -> 'b t
val map : ('a -> 'b) -> 'a t -> 'b t
val pure : 'a -> 'a t
val ( <*> ) : ('a -> 'b) t -> 'a t -> 'b t
val inj : 'a F.t -> 'a t
end
module MakeFreeFold :
functor
(FM : FREE_MONAD) (Fold : sig
type 'a t = 'a FM.F.t
val to_seq : 'a t -> 'a sequence
end) ->
sig type 'a t = 'a FM.t val to_seq : 'a t -> 'a sequence end
end