module Transform:sig..end
type'aprinter ='a CCFormat.printer
Set of features that characterize a logic,
as a record of individual features
module Features:sig..end
type ('a, 'b, 'c, 'd) t =
| |
Ex : |
'a to 'b, with reverse transformation from 'c
to 'd. The transformation make choices by
lazily returning several values. It is also allowed to store data
in a internal "state" type, to be able to perform the reverse
transformation.type ('a, 'b, 'c, 'd, 'st) inner = {
|
name : |
(* |
name for the transformation, used for debug, CLI options, etc.
| *) |
|
encode : |
|||
|
decode : |
|||
|
input_spec : |
|||
|
map_spec : |
|||
|
mutable on_input : |
|||
|
mutable on_encoded : |
|||
|
mutable on_decoded : |
|||
|
print_state : |
(* |
Debugging
| *) |
type('a, 'b, 'c, 'd)transformation =('a, 'b, 'c, 'd) t
Transform.tval make : ?print:(Format.formatter -> 'st -> unit) ->
?on_input:('a -> unit) list ->
?on_encoded:('b -> unit) list ->
?on_decoded:('d -> unit) list ->
?input_spec:Features.t ->
?map_spec:(Features.t -> Features.t) ->
name:string ->
encode:('a -> 'b * 'st) ->
decode:('st -> 'c -> 'd) -> unit -> ('a, 'b, 'c, 'd) tval backward : name:string -> ('b -> 'c) -> ('a, 'a, 'b, 'c) tbackward f is the identity in the direct way, and the same as f
in the way backval nop : unit -> ('a, 'a, 'b, 'b) tval on_encoded : ('a, 'b, 'c, 'd) t -> f:('b -> unit) -> uniton_encoded tr ~f registers f to be called on every value
obtained by encoding through trval on_input : ('a, 'b, 'c, 'd) t -> f:('a -> unit) -> unit
Allows chaining the transformations in a type-safe way
module Pipe:sig..end
val run : pipe:('a, 'b, 'c, 'd) Pipe.t -> 'a -> ('b * ('c -> 'd)) Lazy_list.trun ~pipe x runs x through the pipe pipe, in a lazy way,
and yields values of type 'b along with a conversion function back