Module Type_shape
module Uid = Shape.Uidmodule Layout = Jkind_types.Sort.Consttype base_layout = Jkind_types.Sort.basemodule Type_shape : sig ... endmodule Type_decl_shape : sig ... endmodule Evaluation_diagnostics : sig ... endval unfold_and_evaluate :
?diagnostics:Type_shape.Evaluation_diagnostics.t ->
Shape.t ->
Shape.tunfold_and_evaluate performs call-by-value evaluation of shapes. It should be applied after reduce (from shape_reduce.ml) has already been used. More specifically, when producing a type shape with of_type_expr, the resulting shape is not a normal form. A normal form---at least for the emission into DWARF debug information---should no longer contain structures (from modules), lambdas (from functors and parametric types), application (from functor instantiation and type application), mutually recursive declarations and their projections (Constr and Proj_decl). (Due to missing information, it might still contain compilation units Comp_unit and projections Proj from them.)
We reach the normal form of a type shape (e.g., during the emission of DWARF information) in two steps:
1. We execute shape_reduce, which will substitute compilation units with their shapes loaded from .cms files and then reduce away projections Proj and functor applications. It will also, partially, deal with instantiation of type variables. That is, of_type_declaration inserts lambdas for non-recursive types with type arguments. These are reduced away via shape_reduce. (For (mutually-)recursive types, the next step handles the instantiation.) 2. After shape reduction, the type declaration can still contain recursive or mutually-recursive declarations, which have not been unfolded. Since we cannot directly emit these into DWARF, we then unfold recursive declarations applied to type shape arguments into recursive types with unfold_and_evaluate. For example, type 'a list = [] | :: of 'a * 'a list applied to int becomes the type shape Mu (Variant [] | :: of int * #0).
val all_type_shapes : Type_shape.shape_with_layout Uid.Tbl.tval add_to_type_decls :
(Ident.t * Types.type_declaration) list ->
Type_shape.path_lookup ->
unitval add_to_type_shapes :
Uid.t ->
Types.type_expr ->
Layout.t ->
name:string ->
Type_shape.path_lookup ->
unitval print_table_all_type_decls : Stdlib.Format.formatter -> unitval print_table_all_type_shapes : Stdlib.Format.formatter -> unitval print_debug_uid_tables : Stdlib.Format.formatter -> unit