package libsail
Module Libsail.SpecializeSource
Rewrites for removing polymorphism from specifications
Only specialize Type- kinded polymorphism.
(experimental) specialise Int-kinded definitions
(experimental) specialise Int-kinded definitions, including externs
Returns an IdSet with the function ids that have X-kinded parameters, e.g. val f : forall ('a : X). 'a -> 'a. The first argument specifies what X should be - it should be one of: is_int_kopt, is_order_kopt, or is_typ_kopt from Ast_util, or some combination of those.
val specialize :
specialization ->
Type_check.Env.t ->
Type_check.typed_ast ->
Effects.side_effect_info ->
Type_check.typed_ast * Type_check.Env.t * Effects.side_effect_infospecialize returns an AST with all the Order and Type polymorphism removed, as well as the environment produced by type checking that AST with Type_check.initial_env. The env parameter is the environment to return if there is no polymorphism to remove, in which case specialize returns the AST unmodified.
val specialize_passes :
int ->
specialization ->
Type_check.Env.t ->
Type_check.typed_ast ->
Effects.side_effect_info ->
Type_check.typed_ast * Type_check.Env.t * Effects.side_effect_infospecialize' n performs at most n specialization passes. Useful for int_specialization which is not guaranteed to terminate.
val instantiations_of :
specialization ->
Ast.id ->
Type_check.typed_ast ->
Ast.typ_arg Ast_util.KBindings.t listreturn all instantiations of a function id, with the instantiations filtered according to the specialization.