Module Ocamlary
This is an interface with all of the module system features. This documentation demonstrates:
- comment formatting
- unassociated comments
- documentation sections
module system documentation including
- submodules
- module aliases
- module types
- module type aliases
- modules with signatures
- modules with aliased signatures
A numbered list:
- 3
- 2
- 1
David Sheets is the author.
You may find more information about this HTML documentation renderer at github.com/dsheets/ocamlary.
This is some verbatim text:
verbatim
This is some verbatim text:
[][df[]]}}
Here is some raw LaTeX:
Here is an index table of Empty modules:
EmptyA plain, empty moduleEmptyAliasA plain module alias ofEmpty
Odoc doesn't support {!indexlist}.
Here is some superscript: x2
Here is some subscript: x0
Here are some escaped brackets: { [ @ ] }
Here is some emphasis followed by code.
An unassociated comment
Level 1
Level 2
Level 3
Level 4
Basic module stuff
module Empty : sig ... endA plain, empty module
module type Empty = sig ... endAn ambiguous, misnamed module type
module type MissingComment = sig ... endAn ambiguous, misnamed module type
Section 9000
module EmptyAlias = Ocamlary.EmptyA plain module alias of Empty
EmptySig
module type EmptySig = sig ... endA plain, empty module signature
module type EmptySigAlias = Ocamlary.EmptySigA plain, empty module signature alias of
module ModuleWithSignature : Ocamlary.EmptySigA plain module of a signature of EmptySig (reference)
A plain module with an alias signature
module One : sig ... endmodule type SigForMod = sig ... endThere's a signature in a module in this signature.
module type SuperSig = sig ... endFor a good time, see A Labeled Section Header Inside of a Signature or Another Labeled Section Header Inside of a Signature or SuperSig.EmptySig. Section Section 9000 is also interesting. EmptySig is the section and EmptySig is the module signature.
module Buffer : sig ... endReferences are resolved after everything, so {!Buffer.t} won't resolve.
Some text before exception title.
Basic exception stuff
After exception title.
EmptySigAlias is this exception.
Basic type and value stuff with advanced doc comments
a_function is this type and a_function is the value below.
val fun_fun_fun :
((int, int) Ocamlary.a_function, (unit, unit) Ocamlary.a_function)
Ocamlary.a_functionSome Operators
Advanced Module Stuff
module CollectionModule : sig ... endThis comment is for CollectionModule.
module type COLLECTION = module type of Ocamlary.CollectionModulemodule type of
module Recollection
(C : Ocamlary.COLLECTION) :
Ocamlary.COLLECTION
with type collection = C.element list
and type element = C.collectionThis comment is for CollectionModule.
module type MMM = sig ... endmodule type RECOLLECTION =
Ocamlary.MMM with module C = Ocamlary.Recollection(Ocamlary.CollectionModule)module type RecollectionModule = sig ... endmodule type A = sig ... endmodule type B = sig ... endmodule type C = sig ... endThis module type includes two signatures.
module FunctorTypeOf
(Collection : module type of Ocamlary.CollectionModule) :
sig ... endThis comment is for FunctorTypeOf.
module type IncludeModuleType = sig ... endThis comment is for IncludeModuleType.
module type ToInclude = sig ... endAdvanced Type Stuff
This comment is for poly_variant.
Wow! It was a polymorphic variant!
type (_, _) full_gadt = | Tag : (unit, unit) Ocamlary.full_gadt| First : 'a -> ('a, unit) Ocamlary.full_gadt| Second : 'a -> (unit, 'a) Ocamlary.full_gadt| Exist : 'a * 'b -> ('b, unit) Ocamlary.full_gadt
This comment is for full_gadt.
Wow! It was a GADT!
type 'a partial_gadt = | AscribeTag : 'a Ocamlary.partial_gadt| OfTag of 'a Ocamlary.partial_gadt| ExistGadtTag : ('a -> 'b) -> 'a Ocamlary.partial_gadt
This comment is for partial_gadt.
Wow! It was a mixed GADT!
type alias = Ocamlary.variantThis comment is for alias.
type tuple =
(Ocamlary.alias * Ocamlary.alias)
* Ocamlary.alias
* (Ocamlary.alias * Ocamlary.alias)This comment is for tuple.
type variant_alias = Ocamlary.variant = This comment is for variant_alias.
This comment is for record_alias.
This comment is for poly_variant_union.
type 'a open_poly_variant_alias =
'a Ocamlary.open_poly_variant Ocamlary.open_poly_variant2type ('a, 'b) full_gadt_alias = ('a, 'b) Ocamlary.full_gadt = | Tag : (unit, unit) Ocamlary.full_gadt_alias| First : 'a -> ('a, unit) Ocamlary.full_gadt_alias| Second : 'a -> (unit, 'a) Ocamlary.full_gadt_alias| Exist : 'a * 'b -> ('b, unit) Ocamlary.full_gadt_alias
This comment is for full_gadt_alias.
type 'a partial_gadt_alias = 'a Ocamlary.partial_gadt = | AscribeTag : 'a Ocamlary.partial_gadt_alias| OfTag of 'a Ocamlary.partial_gadt_alias| ExistGadtTag : ('a -> 'b) -> 'a Ocamlary.partial_gadt_alias
This comment is for partial_gadt_alias.
This comment is for Exn_arrow.
This comment is for mutual_constr_a then mutual_constr_b.
and mutual_constr_b = | B| A_ish of Ocamlary.mutual_constr_a(*This comment must be here for the next to associate correctly.
*)
This comment is for mutual_constr_b then mutual_constr_a.
type rec_obj = < f : int ; g : unit -> unit ; h : Ocamlary.rec_obj >module ExtMod : sig ... endtype my_mod = (module Ocamlary.COLLECTION)A brown paper package tied up with string
class empty_class : object ... endclass one_method_class : object ... endclass two_method_class : object ... endclass 'a param_class : 'a -> object ... endtype my_unit_object = unit param_classtype 'a my_unit_class = unit param_class as 'amodule Dep1 : sig ... endtype dep1 = Dep2(Dep1).B.cmodule Dep3 : sig ... endmodule Dep4 : sig ... endtype dep2 = Ocamlary.Dep5(Ocamlary.Dep4).Z.X.btype dep3 = Dep5(Dep4).Z.Y.amodule Dep6 : sig ... endtype dep4 = Ocamlary.Dep7(Ocamlary.Dep6).M.Y.dmodule Dep8 : sig ... endmodule type Dep10 = Ocamlary.Dep9(Ocamlary.Dep8).T with type t = intmodule Dep11 : sig ... endmodule Dep13 : Ocamlary.Dep12(Ocamlary.Dep11).Ttype dep5 = Ocamlary.Dep13.cmodule type With1 = sig ... endmodule With2 : sig ... endmodule With3 : Ocamlary.With1 with module M = Ocamlary.With2type with1 = Ocamlary.With3.N.tmodule With4 : Ocamlary.With1 with module M := Ocamlary.With2type with2 = Ocamlary.With4.N.tmodule With5 : sig ... endmodule With6 : sig ... endmodule type With8 =
Ocamlary.With7(Ocamlary.With6).T
with module M = Ocamlary.With5
and type M.N.t = Ocamlary.With5.N.tmodule With9 : sig ... endmodule With10 : sig ... endmodule type With11 =
Ocamlary.With7(Ocamlary.With10).T
with module M = Ocamlary.With9
and type N.t = intmodule type NestedInclude1 = sig ... endinclude Ocamlary.NestedInclude1
module type NestedInclude2 = sig ... endinclude Ocamlary.NestedInclude2 with type nested_include = int
module DoubleInclude1 : sig ... endmodule DoubleInclude3 : sig ... endinclude module type of Ocamlary.DoubleInclude3.DoubleInclude2
module IncludeInclude1 : sig ... endinclude module type of Ocamlary.IncludeInclude1
module type IncludeInclude2 = sig ... endmodule IncludeInclude2_M : sig ... endinclude Ocamlary.IncludeInclude2
Trying the {!modules: ...} command.
With ocamldoc, toplevel units will be linked and documented, while submodules will behave as simple references.
With odoc, everything should be resolved (and linked) but only toplevel units will be documented.
Dep1.XOcamlary.IncludeInclude1OcamlaryThis is an interface with all of the module system features. This documentation demonstrates:
Weirder usages involving module types
Playing with @canonical paths
module CanonicalTest : sig ... endSome ref to CanonicalTest.Base_Tests.C.t and CanonicalTest.Base_Tests.L.id. But also to CanonicalTest.Base.List and CanonicalTest.Base.List.t
Aliases again
module Aliases : sig ... endLet's imitate jst's layout.
Section title splicing
I can refer to
{!section:indexmodules}: Trying the {!modules: ...} command.{!aliases}: Aliases again
But also to things in submodules:
{!section:SuperSig.SubSigA.subSig}: A Labeled Section Header Inside of a Signature{!Aliases.incl}: include of Foo
And just to make sure we do not mess up:
{{!section:indexmodules}A}: A{{!aliases}B}: B{{!section:SuperSig.SubSigA.subSig}C}: C{{!Aliases.incl}D}: D
New reference syntax
module type M = sig ... endmodule M : sig ... endHere goes:
module Only_a_module : sig ... end{!Only_a_module.t}:Only_a_module.t{!module-Only_a_module.t}:Only_a_module.t{!module-Only_a_module.type-t}:Only_a_module.t{!type:Only_a_module.t}:Only_a_module.t
module type TypeExt = sig ... endmodule type TypeExtPruned = Ocamlary.TypeExt with type t := Ocamlary.new_tmodule Op : sig ... end