# ContingentClaims.Core.Claim¶

## Functions¶

zero

: Claim t x a o

Constructs a claim without rights or obligations.

one

: a -> Claim t x a o

Constructs a claim that delivers one unit of `a` immediately to the bearer.

give

: Claim t x a o -> Claim t x a o

Constructs a claim that reverses the obligations of the bearer and their counterparty.

and

: Claim t x a o -> Claim t x a o -> Claim t x a o

Used to additively combine two claims together. In order to use this, you must import this module qualified or hide the `and` operator from `Prelude`.

or

: Electable t x a o -> Electable t x a o -> Claim t x a o

Gives the bearer the right to choose between the input claims. In order to use this, you must import this module qualified or hide the `or` operator from `Prelude`.

andList

: [Claim t x a o] -> Claim t x a o

Used to additively combine a list of claims together. It is equivalent to applying the `and` builder recursively.

orList

: [Electable t x a o] -> Claim t x a o

Gives the bearer the right to choose between the input claims. It is equivalent to applying the `or` builder recursively.

cond

: Inequality t x o -> Claim t x a o -> Claim t x a o -> Claim t x a o

Gives the bearer the right to the first claim if predicate is true, else the second claim.

scale

: Observation t x o -> Claim t x a o -> Claim t x a o

Multiplies the input claim by a scaling factor (which can be non-deterministic).

when

: Inequality t x o -> Claim t x a o -> Claim t x a o

Acquires the input claim on the first instant that `predicate` is true.

anytime

: Inequality t x o -> Text -> Claim t x a o -> Claim t x a o

Gives the bearer the right to enter a claim at any time `predicate` is true.

until

: Inequality t x o -> Claim t x a o -> Claim t x a o

Expires the input claim on the first instant that `predicate` is true.

mapParams

: (t -> i) -> (i -> t) -> (a -> a’) -> (o -> o’) -> (x -> x’) -> Claim i x a o -> Claim t x’ a’ o’

Replaces parameters in a claims using the input mapping functions. This can be used to e.g. map the time parameter in a claim from `Date` to `Time`, or to map the asset type parameter from an abstract `Text` to a concrete `InstrumentKey`.

at

: t -> Inequality t x o

Given `t`, constructs a predicate that is `True` for time ≥ `t`, `False` otherwise.

upTo

: t -> Inequality t x a

Given `t`, constructs a predicate that is `True` for time ≤ `t`, `False` otherwise.

(<=)

: Observation t x o -> Observation t x o -> Inequality t x o

Given observations `o1` and `o2`, constructs the predicate `o1 ≤ o2`. In order to use this, you must import this module qualified or hide the `(<=)` operator from `Prelude`.

compare

: (Ord t, Ord x, Number x, Divisible x, CanAbort m) => (o -> t -> m x) -> Inequality t x o -> t -> m Bool

Reify the `Inequality` into an observation function. This function is used to convert an abstract predicate, e.g. `S ≤ 50.0` to the actual boolean observation function `t -> m Bool`.