package orsetto
Install
Dune Dependency
Authors
Maintainers
Sources
sha512=e260412b2dd0f98cfe3dc7ed5c31a694eb31c93cd207c51fa12675b790234ee0ad3bf07d9be17a4dc266fedfe55b14c967cad7bc0c9414063eef8afd59f3d0d1
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.