Module ContingentClaims.Lifecycle.Lifecycle

Data Types

data Pending t a

Used to specify pending payments.

Pending

Field Type Description
t t Payment time.
amount Decimal Amount of asset to be paid.
asset a Asset in which the payment is denominated.

instance (Eq t, Eq a) => Eq (Pending t a)

instance (Show t, Show a) => Show (Pending t a)

data Result t a o

Returned from a lifecycle operation.

Result

Field Type Description
pending [Pending t a] Payments requiring settlement.
remaining C t a o The tree after lifecycled branches have been pruned.

instance (Eq a, Eq o, Eq t) => Eq (Result t a o)

instance (Show t, Show a, Show o) => Show (Result t a o)

Functions

lifecycle

: (Ord t, Eq a, CanAbort m) => (o -> t -> m Decimal) -> C t a o -> t -> t -> m (Result t a o)

Collect claims falling due into a list, and return the tree with those nodes pruned. m will typically be Update. It is parametrised so it can be run in a Script. The first argument is used to lookup the value of any Observables. Returns the pruned tree + pending settlements up to the provided market time.

exercise

: (Ord t, Eq a, Eq o, CanAbort m) => (o -> t -> m Decimal) -> (Bool, C t a o) -> C t a o -> t -> t -> m (C t a o)

Acquire Anytime and Or nodes, by making an election. Import this qualified to avoid clashes with Prelude.exercise.