package higher_kinded
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=33c1e3c1272eae1201975d3281e8af2858045349d4a0b8e9573844760620f046
doc/higher_kinded/Higher_kinded/index.html
Module Higher_kindedSource
This library allows you to use higher-kinded types in OCaml. See the README for a short tutorial on what that means and how to use it.
Types
If A implements the signature S, (a, A.witness1) t is equivalent to a A.t.
If A implements the signature S, ('a, A.higher_kinded) t1 is equivalent to 'a A.t.
If A implements the signature S2, ('a, 'b, A.higher_kinded) t2 is equivalent to ('a, 'b) A.t.
If A implements the signature S3, ('a, 'b, 'c, A.higher_kinded) t3 is equivalent to ('a, 'b, 'c) A.t.
If A implements the signature S4, ('a, 'b, 'c, 'd, A.higher_kinded) t4 is equivalent to ('a, 'b, 'c, 'd) A.t.
If A implements the signature S5, ('a, 'b, 'c, 'd, 'e, A.higher_kinded) t5 is equivalent to ('a, 'b, 'c, 'd, 'e) A.t.
If A implements the signature S6, ('a, 'b, 'c, 'd, 'e, 'f, A.higher_kinded) t6 is equivalent to ('a, 'b, 'c, 'd, 'e, 'f) A.t.
If A implements the signature S7, ('a, 'b, 'c, 'd, 'e, 'f, 'g, A.higher_kinded) t7 is equivalent to ('a, 'b, 'c, 'd, 'e, 'f, 'g) A.t.
If A implements the signature S8, ('a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, A.higher_kinded) t8 is equivalent to ('a, 'b, 'c, 'd, 'e, 'f, 'g, 'h) A.t.
Signatures
include sig ... end
Functors
This is the meat of the library. Use these functors to implement the higher_kinded interface.
module Make_monad_using_witness
(M : Base.Monad.S)
(X : S with type 'a t := 'a M.t) :
Monad with type 'a t := 'a M.t with type higher_kinded := X.higher_kindedmodule Make_monad_using_witness2
(M : Base.Monad.S2)
(X : S2 with type ('a, 'b) t := ('a, 'b) M.t) :
Monad2
with type ('a, 'b) t := ('a, 'b) M.t
with type higher_kinded := X.higher_kindedmodule Make_monad_using_witness3
(M : Base.Monad.S3)
(X : S3 with type ('a, 'b, 'c) t := ('a, 'b, 'c) M.t) :
Monad3
with type ('a, 'b, 'c) t := ('a, 'b, 'c) M.t
with type higher_kinded := X.higher_kindedImplementations
Base, Core, and Async don't depend on Higher_kinded, so we put these implementations here instead of in the respective modules where they might have been a nicer fit.