module Type: sig end
Type constructors are given by the module Type
.
type 'a
t
A type constructor (with its arguments) is represented by a
value of type 'a t
, where 'a
is the type of the arguments.
val ldestr_inv : bool
The boolean constant ldestr_inv
tells wether there exists a
type constructor for which the left destructor propagates on
an invariant argument.
val rdestr_inv : bool
The boolean constant ldestr_inv
tells wether there exists a
type constructor for which the right destructor propagates on
an invariant argument.
val ldestr : 'a t -> bool
ldestr t
returns false
if the type t
cannot be an argument
of the left destructor.
val rdestr : 'a t -> bool
rdestr t
returns false
if the type t
cannot be an argument
of the right destructor.
val compatible : 'a t -> 'a t -> bool
compatible t1 t2
indicates wether the type constructors
t1
and t2
are compatible.
val map : (Dalton_aux.constructor_arg -> 'a -> 'b) ->
'a t -> 'b t
map f t
returns the constructor t'
obtained by replacing
every son x
of t
by f i x
(where i
is the information
of variance, kind and destructor propagation associated to the
argument x
in t
).
val iter : (Dalton_aux.constructor_arg -> 'a -> unit) ->
'a t -> unit
iter f t
applies f
on every son x
of t
.
val iter2 : (Dalton_aux.constructor_arg -> 'a -> 'b -> unit) ->
'a t -> 'b t -> unit
Given two compatible constructors t1
and t2
, iter2 f t1 t2
applies f
on every pair of corresponding sons of t1
and t2
.
The result is not specified if t1
and t2
do not correspond.
val map2 : (Dalton_aux.constructor_arg -> 'a -> 'b -> 'c) ->
'a t ->
'b t -> 'c t
Given two compatible constructors t1
and t2
, map2 f t1 t2
...
The result is not specified if t1
and t2
do not correspond.
val for_all2 : (Dalton_aux.constructor_arg -> 'a -> 'b -> bool) ->
'a t -> 'b t -> bool
Given two compatible constructors t1
and t2
, for_all f t1 t2
tests wether for all pair of sons x1
and x2
, f i x1 x2
is
true
.
val hash : int t -> int
hash t
returns a hash integer of the type constructor t
which
carries hashes of its sons.
type position
Values of type position
represents a context of pretty-print.
Distinguishing different contexts allows fine parenthesizing of
imbricated terms.
val parenthesize : position -> 'a t -> bool
parenthesize pos t
returns a boolean indication wether the
type constructor t
must be parenthesized in context pos
.
val fprint : Format.formatter ->
('a -> bool) ->
(Dalton_aux.constructor_arg ->
position -> Format.formatter -> 'a -> unit) ->
'a t -> unit
fprint ppf skip f t
pretty-prints the type constructor
t
on the formatter
ppf
. This function may
- Apply
skip
on each of t
's sons. If skip x
is true then
the son x
does not carry any relevant information and may
be skipped.
- Apply
f pos ppf x
on each of t
's sons in order to
pretty-print it.