package orsetto
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=f64814687276bad56483b2b8dfaaf70d0d6485f67fe5d44bff34bfa47af1896e
md5=3a15a377800cf988a310b4082406c685
doc/orsetto.cf/Cf_encode/Monad/index.html
Module Cf_encode.Monad
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
.
Use map m f
to return the result of applying f
to the value returned by m
.
module Infix : Cf_monad_core.Unary.Infix with type 'r t := 'r t
Open Infix
to include the infix monad operators.
include Cf_seqmonad.Functor.Unary with type 'r t := 'r 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.
Use seal s v
to enclose the encoding of v
with s
before the values encoded in the monad bound to the result.