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 ('cases, 'case, 'tag) t

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) part

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 make : ?dec:('case -> 'cases) -> 'tag -> ('case, 'case) mems -> ('cases, 'case, 'tag) t

case ~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 part : ('cases, 'case, 'tag) t -> ('cases, 'tag) part

part c is c as a part.

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

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