Module Mlsem_types.PEnv

Printing environment: the type aliases to fold back when printing a type, so that a type built from type list('a) = … prints as list(int) rather than as its expansion.

The environment is carried as an effect rather than threaded explicitly: register performs an Update, and printing performs a Get. Both are therefore only usable inside a sequential_handler, and raise Effect.Unhandled outside one.

Printing environment: the type aliases to fold back when printing a type, so that a type built from type list('a) = … prints as list(int) rather than as its expansion.

The environment is carried as an effect rather than threaded explicitly: register performs an Update, and printing performs a Get. Both are therefore only usable inside a sequential_handler, and raise Effect.Unhandled outside one.

type t
type Stdlib.Effect.t +=
  1. | Update : t -> unit Stdlib.Effect.t
type Stdlib.Effect.t +=
  1. | Get : t Stdlib.Effect.t
val sequential_handler : t -> ('a -> 'b) -> 'a -> 'b * t

sequential_handler penv f x runs f x with penv as the ambient printing environment, and returns its result together with the environment as the registrations performed by f left it.

val empty : t
val merge : t -> t -> t

Adds the aliases of the second environment to the first, dropping any earlier alias that has the same name or denotes an equivalent type.

val merge' : t list -> t
val register : string -> Sstt.Ty.t -> unit

Registers a name for a type. Must be called under a sequential_handler.

val register_parametrized : string -> Sstt.Ty.t list -> Sstt.Ty.t -> unit

register_parametrized name args ty registers ty under the display form name(args). Type variables occurring in args are recorded as holes, so that the alias still prints correctly when those variables are renamed at printing time. Must be called under a sequential_handler.

val printer_params : unit -> Sstt.Printer.params

Printer parameters for the ambient environment. Must be called under a sequential_handler.

val printer_params' : Sstt.Subst.t -> Sstt.Printer.params

Like printer_params, for printing types to which the given substitution is applied — the aliases are substituted accordingly.