Module Mylib.Ocamlary
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
module EmptyAlias = EmptyA plain module alias of
Empty
EmptySig
module type EmptySig = sig ... endA plain, empty module signature
module type EmptySigAlias = EmptySigA plain, empty module signature alias of
module ModuleWithSignature : EmptySigA plain module of a signature of
EmptySig(reference)
module ModuleWithSignatureAlias : EmptySigAliasA 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 ... endmodule Buffer : sig ... endBuffer.t
Basic exception stuff
After exception title.
Basic type and value stuff with advanced doc comments
type ('a, 'b) a_function= 'a -> 'ba_functionis general buta_functionis this type anda_functionis the value below.
val a_function : x:int -> intThis is
a_functionwith param and return type.- parameter x
the
xcoordinate
- returns
the
ycoordinate
val fun_fun_fun : a_functionval fun_maybe : ?yes:unit -> unit -> intval not_found : unit -> unit- raises Not_found
That's all it does
val ocaml_org : string- see http://ocaml.org/
The OCaml Web site
Some Operators
Advanced Module Stuff
module CollectionModule : sig ... endThis comment is for
CollectionModule.
module type COLLECTION = module type of CollectionModulemodule type of
module Recollection : functor (C : COLLECTION) -> COLLECTION with type collection = list and type element = C.collectionmodule type MMM = sig ... endmodule type RECOLLECTION = MMM with module C = Recollection(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 : functor (Collection : module type of CollectionModule) -> sig ... endThis comment is for
FunctorTypeOf.
module type IncludeModuleType = sig ... endThis comment is for
IncludeModuleType.
module type ToInclude = sig ... endAdvanced Type Stuff
type record={field1 : int;This comment is for
field1.field2 : int;This comment is for
field2.}This comment is for
record.This comment is also for
record.
type mutable_record={mutable a : int;ais first and mutableb : unit;bis second and immutablemutable c : int;cis third and mutable}type universe_record={nihilate : a. 'a -> unit;}type variant=This comment is for
variant.This comment is also for
variant.
type poly_variant=[|`TagAThis comment is for
`TagA.|`ConstrB of intThis comment is for
`ConstrB.]This comment is for
poly_variant.Wow! It was a polymorphic variant!
type (_, _) full_gadt=|Tag : full_gadt|First : 'a -> full_gadt|Second : 'a -> full_gadt|Exist : 'a * 'b -> full_gadtThis comment is for
full_gadt.Wow! It was a GADT!
type 'a partial_gadt=|AscribeTag : partial_gadt|OfTag of partial_gadt|ExistGadtTag : ('a -> 'b) -> partial_gadtThis comment is for
partial_gadt.Wow! It was a mixed GADT!
type _ record_arg_gadt=|With_rec :{foo : int;}-> record_arg_gadt|With_poly_rec :{bar : a. 'a -> 'a;}-> record_arg_gadtThis comment is for
record_arg_gadt.Wow! It was a GADT with record arguments
type alias= variantThis comment is for
alias.
type variant_alias= variant=|TagA|ConstrB of int|ConstrC of int * int|ConstrD of int * intThis comment is for
variant_alias.
type record_alias= record={field1 : int;field2 : int;}This comment is for
record_alias.
type poly_variant_union=[|poly_variant|`TagC]This comment is for
poly_variant_union.
type 'a poly_poly_variant=[|`TagA of 'a]type ('a, 'b) bin_poly_poly_variant=[|`TagA of 'a|`ConstrB of 'b]type 'a open_poly_variant= [> `TagA ] as atype 'a open_poly_variant2= [> `ConstrB of int ] as atype 'a open_poly_variant_alias= open_poly_variant2type 'a poly_fun= [> `ConstrB of int ] as a -> 'atype 'a poly_fun_constraint= 'a -> 'aconstraint 'a = [> `TagA ]type 'a closed_poly_variant= [< `One | `Two ] as atype 'a clopen_poly_variant= [< `One | `Two of int | `Three Two Three ] as atype nested_poly_variant=[|`A|`B of [ `B1 | `B2 ]|`C|`D of [ `D1 of [ `D1a ] ]]type ('a, 'b) full_gadt_alias= full_gadt=|Tag : full_gadt_alias|First : 'a -> full_gadt_alias|Second : 'a -> full_gadt_alias|Exist : 'a * 'b -> full_gadt_aliasThis comment is for
full_gadt_alias.
type 'a partial_gadt_alias= partial_gadt=|AscribeTag : partial_gadt_alias|OfTag of partial_gadt_alias|ExistGadtTag : ('a -> 'b) -> partial_gadt_aliasThis comment is for
partial_gadt_alias.
type mutual_constr_a=|A|B_ish of mutual_constr_bThis comment is between
mutual_constr_aandmutual_constr_b.This comment is for
mutual_constr_athenmutual_constr_b.
and mutual_constr_b=|B|A_ish of mutual_constr_aThis comment must be here for the next to associate correctly.
This comment is for
mutual_constr_bthenmutual_constr_a.
type rec_obj= < f : int; g : unit -> unit; h : rec_obj; >type 'a open_obj= < f : int; g : unit -> unit; .. > as atype 'a oof= < a : unit; .. > as a -> 'atype 'a any_obj= < .. > as atype empty_obj= < >type one_meth= < meth : unit; >type ext=..A mystery wrapped in an ellipsis
type ext +=ExtAtype ext +=ExtBtype ext +=ExtC of unit|ExtD of exttype ext +=ExtEtype ext +=ExtF
module ExtMod : sig ... endtype my_mod= (module 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= param_classtype 'a my_unit_class= unit param_class as a
module Dep1 : sig ... endtype dep1= Dep2(Dep1).B.c
module Dep3 : sig ... endmodule Dep4 : sig ... endtype dep2= Dep5(Dep4).Z.X.btype dep3= Dep5(Dep4).Z.Y.a
module Dep6 : sig ... endtype dep4= Dep7(Dep6).M.Y.d
module Dep8 : sig ... endmodule type Dep10 = Dep9(Dep8).T with type t = intmodule Dep11 : sig ... endmodule Dep13 : Dep12(Dep11).Ttype dep5= Dep13.c
module type With1 = sig ... endmodule With2 : sig ... endtype with1= With3.N.t
type with2= With4.N.t
module With5 : sig ... endmodule With6 : sig ... endmodule With9 : sig ... endmodule With10 : sig ... endmodule type With11 = With7(With10).T with module M = With9 and type N.t = intmodule type NestedInclude1 = sig ... endinclude NestedInclude1
module type NestedInclude2 = sig ... endinclude NestedInclude2 with type nested_include = int
module DoubleInclude1 : sig ... endmodule DoubleInclude3 : sig ... endinclude module type of DoubleInclude3.DoubleInclude2
module IncludeInclude1 : sig ... endinclude module type of IncludeInclude1
module type IncludeInclude2 = sig ... endinclude 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.XDocOckTypesOcamlary.IncludeInclude1Ocamlary
Weirder usages involving module types
IncludeInclude1.IncludeInclude2Dep4.TA.Q
Playing with @canonical paths
module CanonicalTest : sig ... endval test : CanonicalTest.Base.List.t -> unitSome ref to
CanonicalTest.Base__Tests.C.t andCanonicalTest.Base__Tests.L.id. But also toCanonicalTest.Base__.List andCanonicalTest.Base__.List.t
Aliases again
module Aliases : sig ... endSection 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}:SuperSig.SubSigA:subSig{!Aliases.incl}:Aliases:incl
And just to make sure we do not mess up:
New reference syntax
module type M = sig ... endmodule M : sig ... endmodule Only_a_module : sig ... end