package bap-knowledge

  1. Overview
  2. Docs
include Monads.Std.Monad.Syntax.S with type 'a t := 'a t
val (>>=) : 'a t -> ('a -> 'b t) -> 'b t

m >>= f is bind m f

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

m >>= f is map m ~f

val (>=>) : ('a -> 'b t) -> ('b -> 'c t) -> 'a -> 'c t

f >=> g is fun x -> f x >>= g

val (!!) : 'a -> 'a t

!!x is return x

val (!$) : ('a -> 'b) -> 'a t -> 'b t

!$f is Lift.unary f

val (!$$) : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t

!$$f is Lift.binary f

val (!$$$) : ('a -> 'b -> 'c -> 'd) -> 'a t -> 'b t -> 'c t -> 'd t

!$$$f is Lift.ternary f

val (!$$$$) : ('a -> 'b -> 'c -> 'd -> 'e) -> 'a t -> 'b t -> 'c t -> 'd t -> 'e t

!$$$$f is Lift.quaternary f

val (!$$$$$) : ('a -> 'b -> 'c -> 'd -> 'e -> 'f) -> 'a t -> 'b t -> 'c t -> 'd t -> 'e t -> 'f t

!$$$$$f is Lift.quinary f

the monadic let-binding operators.

Brings let* for bind and let+ for map to the scope of the Syntax module.

  • since 2.4.0 (before that an explicit [open Knowledge.Let] was

required.

include Monads.Std.Monad.Syntax.Let.S with type 'a t := 'a t
val let* : 'a t -> ('a -> 'b t) -> 'b t

let* r = f x in b is f x >>= fun r -> b

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

monoidal product

val let+ : 'a t -> ('a -> 'b) -> 'b t

let+ r = f x in b is f x >>| fun r -> b

val and+ : 'a t -> 'b t -> ('a * 'b) t

monoidal product

val let*? : 'a option t -> ('a -> 'b option t) -> 'b option 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 >>=?

  • since 2.4.0
val let+? : 'a option t -> ('a -> 'b option) -> 'b option 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 >>|?

  • since 2.4.0
val (-->) : 'a obj -> ('a, 'p) slot -> 'p t

x-->p is collect p x.

Example,

let* addr = label-->address in
...
val (-->?) : 'a obj -> ('a, 'p option) slot -> 'p t

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.

val (<--) : ('a, 'p) slot -> ('a obj -> 'p t) -> unit

p <-- f is promise p f

val (//) : ('a, _) cls -> string -> 'a obj t

c // s is Object.read c s

val (>>=?) : 'a option t -> ('a -> 'b option t) -> 'b option t

x >>=? f evaluates to f y if x evaluates to Some y.

val (>>|?) : 'a option t -> ('a -> 'b option) -> 'b option t

x >>|? f evaluates to f y if x evaluates to Some y.

val (.$[]) : ('a, _) cls value -> ('a, 'p) slot -> 'p

x.$[p] is the propery p of x.

  • since 2.4.0
val (.$[]<-) : ('a, 'b) cls value -> ('a, 'p) slot -> 'p -> ('a, 'b) cls value

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.

  • since 2.4.0
val (.?[]) : ('a, _) cls value -> ('a, 'p option) slot -> 'p knowledge

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.

  • since 2.4.0
val (.![]) : ('a, _) cls value -> ('a, 'p) slot -> 'p knowledge

x.![p] returns the property p or fails if it is empty.

The result is return r if not Domain.is_empty dom r, where dom is Slot.domain p.

  • since 2.4.0
OCaml

Innovation. Community. Security.