package prbnmcn-dagger-test

  1. Overview
  2. Docs
type 'a t

'a t is the type of computations of type 'a

val return : 'a -> 'a t

return x injects a value x as a computation

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

Monadic bind

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

Functorial map

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

Applicative structure

val map_array : 'a t array -> ('a array -> 'b) -> 'b t

N-ary applicative structure

val if_ : bool t -> (bool -> 'a t) -> 'a t

If-then-else, mostly useful for monads featuring incremental computation. Allows to efficiently bind on a boolean computation.

module Infix : Dagger.Intf.Infix with type 'a t := 'a t
val sample : 'a Dagger.Dist.t -> 'a t

sample dist builds a computation that samples from dist. Note that dist must be a pure computation.

val samplei : 'a Dagger.Dist.t t -> 'a t

samplei dist is similar to sample except that dist can be an impure computation (ie computing the distribution can involve sampling from other distributions).

val map_score : 'a t -> ('a -> float) -> 'a t

map_score m f behaves similarly to m except that the associated computation will be reweighted according to the result of evaluating f on the value of m.

val map_log_score : 'a t -> ('a -> Dagger.Log_space.t) -> 'a t

Same as map_score excepts that a log-space likelihood is expected.

val score : float -> unit t

score s reweights the computation by s.

  • raises Invalid_arg

    if s < 0

val log_score : Dagger.Log_space.t -> unit t

log_score behaves as score except that a log-space weight is expected.

module List_ops : Dagger.Intf.Foldable with type 'a t = 'a list and type 'a m := 'a t
module Array_ops : Dagger.Intf.Foldable with type 'a t = 'a array and type 'a m := 'a t
module Seq_ops : Dagger.Intf.Foldable with type 'a t = 'a Seq.t and type 'a m := 'a t
OCaml

Innovation. Community. Security.