diff options
author | whitequark <whitequark@whitequark.org> | 2018-06-21 02:46:16 +0000 |
---|---|---|
committer | whitequark <whitequark@whitequark.org> | 2018-06-21 04:54:49 +0000 |
commit | d8dd112aeea7b615bee416ee3ae18149b839b519 (patch) | |
tree | 4a01fb0e50fd48aae92c926a3afc40a467e40f5e /clib | |
parent | 0f6762ac80cc8d1f37918e9e8f0bb39692979630 (diff) |
Add documentation for Dyn.
Diffstat (limited to 'clib')
-rw-r--r-- | clib/dyn.mli | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/clib/dyn.mli b/clib/dyn.mli index 28dac5d6c..ff9762bd6 100644 --- a/clib/dyn.mli +++ b/clib/dyn.mli @@ -37,18 +37,37 @@ end module type S = sig type 'a tag + (** Type of dynamic tags *) + type t = Dyn : 'a tag * 'a -> t + (** Type of dynamic values *) + val create : string -> 'a tag + (** [create n] returns a tag describing a type called [n]. + [create] raises an exception if [n] is already registered. + Type names are hashed, so [create] may raise even if no type with + the exact same name was registered due to a collision. *) + val eq : 'a tag -> 'b tag -> ('a, 'b) CSig.eq option + (** [eq t1 t2] returns [Some witness] if [t1] is the same as [t2], [None] otherwise. *) + val repr : 'a tag -> string + (** [repr tag] returns the name of the type represented by [tag]. *) val dump : unit -> (int * string) list + (** [dump ()] returns a list of (tag, name) pairs for every type tag registered + in this [Dyn.Make] instance. *) type any = Any : 'a tag -> any + (** Type of boxed dynamic tags *) + val name : string -> any option + (** [name n] returns [Some t] where t is a boxed tag previously registered + with [create n], or [None] if there is no such tag. *) module Map(Value : ValueS) : MapS with type 'a key = 'a tag and type 'a value = 'a Value.t + (** Map from type tags to values parameterized by the tag type *) module Easy : sig (* To create a dynamic type on the fly *) |