Module Cduce_types__AbstractSet

Sets of abstract types whose content cannot be inspected. An abstract type represents the whole sets of its values, and does not provide any way to represent subsets. These abstract types behave like atoms and are used to represent e.g. OCaml types such as float.

module V : sig ... end
module T : module type of Custom.String
include Cduce_types.Tset.S with type elem = T.t
include Cduce_types.Tset.Tset_base
type elem

The type of the values in the set

The type of the set, with mandatory custom operations.

include Custom.T
type t
val dump : Stdlib.Format.formatter -> t -> unit
val check : t -> unit
val equal : t -> t -> bool
val hash : t -> int
val compare : t -> t -> int
val empty : t

The empty set

val any : t

The full set, containing all possible values for this kind.

val atom : elem -> t

atom e creates a singleton set containing element e.

Set operations :

val cup : t -> t -> t

cup t1 t2 returns the unions of t1 and t2.

val cap : t -> t -> t

cap t1 t2 returns the intersection of t1 and t2.

val diff : t -> t -> t

diff t1 t2 returns the set of elements of t1 not in t2.

val neg : t -> t

neg t returns the set diff any t.

module Infix : sig ... end

Membership:

val is_empty : t -> bool

is_empty t checks wheter t is the empty set.

val contains : elem -> t -> bool

contains s t checks whether the type label s belongs to t

val disjoint : t -> t -> bool

disjoint t1 t2 checks whether t1 and t2 have an empty intersection.

val sample : t -> elem option

sample t returns a sample for t. If t is not finite, returns None. If t is finite and non empty, returns one of its elements.

raises [Not_found]

if t is empty.

val contains_sample : elem option -> t -> bool

contains_sample s t checks whether the given sample represents an element of t.

Formatting functions :

val print : t -> (Stdlib.Format.formatter -> unit) list

print t returns a list of functions that can print the combination of abstract types in t. Each abstract typename is prefixed by ! to differenciate it from a type identifier. If t is any, the set is simply printed as Abstract.