package orsetto

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Use this monad to compose encoding schemes where intermediate values emitted earlier in the octet stream are used to select encoding schemes for the values emitted later in the stream.

For example, the pair scheme composer above is equivalent to this:

let pair sa sb = eval begin fun (va, vb) ->
    seal sa va >>= fun () ->
    seal sb vb
end
include Cf_monad.Unary.Profile with type +'r t = private (unit scheme, 'r) Cf_seqmonad.t
type +'r t = private (unit scheme, 'r) Cf_seqmonad.t

The abstract type of a monad.

Module inclusions from Cf_monad_core and Cf_seqmonad.

include Cf_monad.Core.Unary.Profile with type 'r t := 'r t
val return : 'r -> 'r t

Use return a to apply the binding to a.

val bind : 'a t -> ('a -> 'b t) -> 'b t

Use bind m f to bind f to the value returned by m.

val map : 'a t -> f:('a -> 'b) -> 'b t

Use map m ~f to return the result of applying f to the value returned by m.

val product : 'a t -> 'b t -> ('a * 'b) t

Use product a b to return the monoidal product of a and b.

module Affix : Cf_monad_core.Unary.Affix with type 'r t := 'r t

Open Affix to include the affix monad operators.

val disregard : 'r t -> unit t

Use disregard m to ignore the value returned by m and apply the unit value to the bound function.

module Infix = Affix

Deprecated module alias.

include Cf_seqmonad.Functor.Unary with type 'r t := 'r t
val collect : 'r t Seq.t -> (int * 'r list) t

Use collect s to bind in sequence every monad value in the finite sequence s and collect all the returned values. Returns (n, s) where n is the number of values collected and s is the list of values in reverse order, i.e. from last collected to first collected. Never returns and exhausts all memory if s never terminates.

val serial : unit t Seq.t -> unit t

Use serial s to bind in sequence every monad value in the sequence s.

val seal : 'a scheme -> 'a -> unit t

Use seal s v to enclose the encoding of v with s before the values encoded in the monad bound to the result.

val eval : ?sz:int -> ('a -> unit t) -> 'a scheme

Use eval f to encapsulate the monad into a scheme that applies f to the emitted value to obtain its sequence of sealed schemes. If a positive integer ~sz is provided, then it specifies the minimum size of any emitted value.

OCaml

Innovation. Community. Security.