Module Pipeline.Make
Parameters
Signature
Type definitions
type ('st, 'a, 'b) opAn operator from values of type
'ato value sof type'b, and where a state value of type'stis carried throughout.
type ('st, 'a, 'b) tThe type of pipelines from values of type
'ato values of type'b, with state values of type'st.
type 'st merge= 'st -> 'st -> 'stMerge function used at the end of a fixpoint to get the resulting state.
type ('st, 'a) fix=[|`Ok|`Gen of 'st merge * 'a Gen.t]Type used to fixpoint expanding statements such as includes.
Creating operators
val op : ?name:string -> ('st -> 'a -> 'st * 'b) -> ('st, 'a, 'b) opBase constructor function for operators.
val apply : ?name:string -> ('a -> 'b) -> (_, 'a, 'b) opCreate an operator from a function
val iter_ : ?name:string -> ('a -> unit) -> (_, 'a, 'a) opPerform the function's side-effect and return the same input.
Creating pipelines
val _end : (_, 'a, 'a) tval (@>>>) : ('st, 'a, 'b) op -> ('st, 'b, 'c) t -> ('st, 'a, 'c) tAdd an operator at the beginning of a pipeline.
val (@>|>) : ('st, 'a, ('b, 'c) cont) op -> ('st, 'c, 'b) t -> ('st, 'a, 'b) tAdd a continuation operator, allowing to stop evaluation of the pipeline early.
Evaluating pipelines
val eval : exn:'st k_exn -> ('st, 'a, 'b) t -> 'st -> 'a -> 'st * 'bEvaluate a pipeline to a function.
val run : finally:(State.t -> exn option -> State.t) -> (State.t -> 'a option) -> State.t -> (State.t, 'a, unit) t -> State.tLoop the evaluation of a pipeline over a generator, and starting options.
- parameter finally
a function called at the end of every iteration (even if an exception has been raised)