Knowledge.Syntax
include Monads.Std.Monad.Syntax.S with type 'a t := 'a t
val (!!) : 'a -> 'a t
!!x
is return x
!$$$$f
is Lift.quaternary f
the monadic let-binding operators.
Brings let*
for bind
and let+
for map
to the scope of the Syntax
module.
required.
include Monads.Std.Monad.Syntax.Let.S with type 'a t := 'a t
let*? v = x in f
evaluates to f y
if v
is Some r
.
Otherwise evaluates to return None
.
This let-binding operator is synonumous to >>=?
let+? v = x in f
evaluates to !!(f y)
if v
is Some r
.
Otherwise evaluates to return None
.
This let-binding operator is synonumous to >>|?
x-->p
is collect p x
.
Example,
let* addr = label-->address in
...
x-->?p
returns property p
if it is not empty.
Otherwise, if x-->p
evaluates to empty or to None
fails with the empty value conflict.
Example,
let* addr = label-->?address in
...
See also with_empty
.
x >>=? f
evaluates to f y
if x
evaluates to Some y
.
x >>|? f
evaluates to f y
if x
evaluates to Some y
.
x.$[p] <- r
updates the property p
of x
to r
.
Returns the value x
with the new property. The previous value is ignored so there is no merging or monotonicity check involved.
x.?[p]
returns the non-None
property p
or fails.
The result is return r
when x.$[p]
is Some r
or a knowledge base conflict otherwise.