Module Gist.Expr

Type expressions for gist processors.

This is typegist's view on the OCaml type expression language.

type 'a t =
  1. | Scalar : 'a Scalar.t -> 'a t
  2. | Tuple : 't Tuple.t -> 't t
  3. | Record : 'r Record.t -> 'r t
  4. | Variant_like : 'v Variant_like.t -> 'v t
  5. | Array_like : ('elt, 'array) Array_like.t -> 'array t
  6. | Map_like : ('k, 'v, 'map) Map_like.t -> 'map t
  7. | Cell_like : ('a, 'cell) Cell_like.t -> 'cell t
  8. | Func : ('a, 'b) Func.t -> ('a -> 'b) t
  9. | Abstract : 'a Abstract.t -> 'a t
  10. | View : ('a, 'b) View.t -> 'a t
  11. | Rec : 'a gist lazy_t -> 'a t

The type for type expressions.

val fold_gists : ('a. 'acc -> 'a gist -> 'acc) -> 'acc -> 'b t -> 'acc

fold_gists f acc expr recursively folds over all unique (as per Gist.id) gists occurences in expr. A gist with given identity and its definition are folded over only once even if it is present multiple times.

val map_gists : ('a. 'a gist -> 'a gist) -> 'b t -> 'b t

map_gists f expr recursively maps all gists in expr. Expressions of gists returned by f g are also mapped.

val pp : Stdlib.Format.formatter -> 'a t -> unit

pp formats a likely valid OCaml type expression for the type gist expression. Named typed gists found in the expression are not expanded to their definition.