package odds

  1. Overview
  2. Docs

Module Odds.DiceSource

Sourcetype Effect.t +=
  1. | Roll : int -> int Effect.t

The Odds library never handles Randomness. Instead, it is up to the user of the library to install a handler for this Roll faces effect, continuing with a random number from 1 to faces inclusive.

Sourceval fold : ('a -> int -> 'a) -> 'a -> int -> int -> 'a

fold f init rolls faces folds f over rolls rolls of a faces-faced die starting with init.

E.g., fold max 0 2 20 takes the best of two d20 rolls.

Sourcetype unop =
  1. | Neg
Sourcetype binop =
  1. | Add
  2. | Sub
  3. | Mul
  4. | Div
  5. | Max
  6. | Min
Sourcetype formula =
  1. | Constant of int
  2. | Dice of int * int
  3. | Binop of binop * formula * formula
  4. | Unop of unop * formula
Sourceval eval : formula -> int