package orsetto
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=6e6f59fc6a2c590b1b377e40f2120a548e6f09e61e7eb12ffa45cf2d517316b8
md5=533153cd4a9fe8093d3b98afc1073bc8
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 Affix : Cf_monad_core.Unary.Affix with type 'r t := 'r t
Open Affix
to include the affix monad operators.
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
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.