package reason
Reason: Syntax & Toolchain for OCaml
Install
Dune Dependency
Authors
Maintainers
Sources
reason-3.8.0.tbz
sha256=9478724b01767320064ba950ddea24c5df0eefdcdd8ff1324ba9ccd646258979
sha512=c5dcec810a1981b78b19271a8a255f4087628514725d6818419b141be6346a62b28fe8d0f10855efe420ede2839bfe562aa5abf21f29d66250e5c0d02323d6d8
doc/reason.ocaml-migrate-parsetree/Reason_migrate_parsetree/Versions/index.html
Module Reason_migrate_parsetree.Versions
Source
Abstracting an OCaml frontend
Source
type 'a _types = 'a
constraint
'a =
< structure : _
; signature : _
; toplevel_phrase : _
; core_type : _
; expression : _
; pattern : _
; case : _
; type_declaration : _
; type_extension : _
; extension_constructor : _
; out_value : _
; out_type : _
; out_class_type : _
; out_module_type : _
; out_sig_item : _
; out_type_extension : _
; out_phrase : _
; mapper : _ >
A version of the OCaml frontend packs the ast with type witnesses so that equalities can be recovered dynamically.
migration_info
is an opaque type that is used to generate migration functions.
An OCaml frontend versions an Ast, version number and some witnesses for conversion.
Source
type 'types ocaml_version =
(module OCaml_version
with type Ast.Ast_mapper.mapper = 'types get_mapper
and type Ast.Outcometree.out_class_type = 'types get_out_class_type
and type Ast.Outcometree.out_module_type = 'types get_out_module_type
and type Ast.Outcometree.out_phrase = 'types get_out_phrase
and type Ast.Outcometree.out_sig_item = 'types get_out_sig_item
and type Ast.Outcometree.out_type = 'types get_out_type
and type Ast.Outcometree.out_type_extension = 'types get_out_type_extension
and type Ast.Outcometree.out_value = 'types get_out_value
and type Ast.Parsetree.case = 'types get_case
and type Ast.Parsetree.core_type = 'types get_core_type
and type Ast.Parsetree.expression = 'types get_expression
and type Ast.Parsetree.extension_constructor =
'types get_extension_constructor
and type Ast.Parsetree.pattern = 'types get_pattern
and type Ast.Parsetree.signature = 'types get_signature
and type Ast.Parsetree.structure = 'types get_structure
and type Ast.Parsetree.toplevel_phrase = 'types get_toplevel_phrase
and type Ast.Parsetree.type_declaration = 'types get_type_declaration
and type Ast.Parsetree.type_extension = 'types get_type_extension)
Representing an ocaml version in type language
Concrete frontend instances
Migrating between different versions
Source
type ('a, 'b) type_comparison =
| Lt : ('a, 'b) type_comparison
| Eq : ('a, 'a) type_comparison
| Gt : ('a, 'b) type_comparison
Source
type ('from, 'to_) migration_functions = {
copy_structure : 'from get_structure -> 'to_ get_structure;
copy_signature : 'from get_signature -> 'to_ get_signature;
copy_toplevel_phrase : 'from get_toplevel_phrase -> 'to_ get_toplevel_phrase;
copy_core_type : 'from get_core_type -> 'to_ get_core_type;
copy_expression : 'from get_expression -> 'to_ get_expression;
copy_pattern : 'from get_pattern -> 'to_ get_pattern;
copy_case : 'from get_case -> 'to_ get_case;
copy_type_declaration : 'from get_type_declaration -> 'to_ get_type_declaration;
copy_type_extension : 'from get_type_extension -> 'to_ get_type_extension;
copy_extension_constructor : 'from get_extension_constructor -> 'to_ get_extension_constructor;
copy_out_value : 'from get_out_value -> 'to_ get_out_value;
copy_out_type : 'from get_out_type -> 'to_ get_out_type;
copy_out_class_type : 'from get_out_class_type -> 'to_ get_out_class_type;
copy_out_module_type : 'from get_out_module_type -> 'to_ get_out_module_type;
copy_out_sig_item : 'from get_out_sig_item -> 'to_ get_out_sig_item;
copy_out_type_extension : 'from get_out_type_extension -> 'to_ get_out_type_extension;
copy_out_phrase : 'from get_out_phrase -> 'to_ get_out_phrase;
copy_mapper : 'from get_mapper -> 'to_ get_mapper;
}
A record for migrating each AST construct between two known versions
Migrating to the same version is no-op
Source
val migration_compose :
('a, 'b) migration_functions ->
('b, 'c) migration_functions ->
('a, 'c) migration_functions
Migrations can be composed
Represent the next or previous version of an Ast
Source
type 'from immediate_migration =
| No_migration : 'from immediate_migration
(*Cannot migrate earliest or latest supported version
*)| Immediate_migration : ('from, 'to_) migration_functions * 'to_ ocaml_version -> 'from immediate_migration
(*Pack the migration functions and the new version
*)
Source
val immediate_migration :
'types ocaml_version ->
[< `Next | `Previous ] ->
'types immediate_migration
Convenience definitions
Module level migration
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page