Module CCCat

module CCCat: sig .. end

Categorical Constructs

Attempt to copy some structures from Haskell and the likes. Disclaimer: I don't know much about category theory, only about type signatures ;).



Signatures


module type MONOID = sig .. end
module type FUNCTOR = sig .. end
module type APPLICATIVE = sig .. end
module type MONAD_BARE = sig .. end
module type MONAD = sig .. end
module type MONAD_TRANSFORMER = sig .. end
type 'a sequence = ('a -> unit) -> unit 
Cheating: use an equivalent of "to List" with a sequence
module type FOLDABLE = sig .. end
module type TRAVERSE = (M : MONAD) sig .. end
module type FREE_MONAD = sig .. end
The free monad is built by nesting applications of a functor F.

Some Implementations


module WrapMonad (M : MONAD_BARE) : MONAD  with type 'a t = 'a M.t
Implement the applicative and functor modules from only return and bind
module MakeFree (F : FUNCTOR) : FREE_MONAD  with module F = F
module MakeFreeFold (FM : FREE_MONAD)  (Fold : FOLDABLE  with type 'a t = 'a FM.F.t) : FOLDABLE  with type 'a t = 'a FM.t