module Make_named_for_closure:functor (X:sigtype'ainputtype'aoutputtype'at ='a input ->
'a outputend) ->Namedwith type 'a computation := 'a X.t
'a computation = Type_struct.t
'a computation = Type_hash.t
However, arrow types computation such as of_sexp, sexp_of, json_of, etc. are
such a standard case that is seems reasonable to share this extra layer of functor for
it to build the Named module.
| Parameters: |
|
type 'a computation
module Context:sig..end
type 'a t
val init : Context.t -> 'a Typename.t -> 'a t
val get_wip_computation : 'a t -> 'a computation
val set_final_computation : 'a t ->
'a computation -> 'a computation
: 'a Std_internal.Typerep.t -> boolshare = true means no inlining.
Note that not sharing recursive types will lead the of_typerep function to loop
forever. Be careful when setting this.
An example where it is not suitable to share everything for example is
typestruct. The typestruct of an int is a simple constructor called Int, naming it
once and using the name to refere to it later within the typestruct does not lead to
a shorter typestruct, and is in fact less readable. The benefit of the sharing
depends on the computation, its memory and building costs.