Module Obj.Case

Case objects.

Case objects are used to describe objects whose member list depend on the tag value of a distinguished case member. See an example.

type ('o, 'dec) obj_map := ('o, 'dec) map

Cases

type ('cases, 'case, 'tag) map

The type for a case object represented by 'case belonging to a type represented by 'cases depending on the value of a case member of type 'tag.

type ('cases, 'tag) t

The type for a case part of the type 'cases. This is t with its 'case representation hidden.

type ('cases, 'tag) value

The type for case values. This holds a case value and its t. Use value to construct them.

val map : ?dec:('case -> 'cases) -> 'tag -> ('case, 'case) obj_map -> ('cases, 'case, 'tag) map

map ~dec v obj defines the object map obj as being the case for the tag value v of the case member. dec indicates how to inject the object case into the type for cases.

val make : ('cases, 'case, 'tag) map -> ('cases, 'tag) t

part cm is cm as a case.

val value : ('cases, 'case, 'tag) map -> 'case -> ('cases, 'tag) value

value c cv is a case value cv described by c.