Skip to main content

DA.Action

Action

Module Snapshot

Lifecycle

Stable.

Notices

Status: active Introduced in: 3.4.9 Removed in: - Warnings: 0 Deprecations: 0 Deprecated since: -

Functions

when

when : Applicative f => Bool -> f () -> f () Conditional execution of Action expressions. For example,
will archive the contract contractId if the Boolean value final is True, and otherwise do nothing. This function has short-circuiting semantics, i.e., when both arguments are present and the first arguments evaluates to False, the second argument is not evaluated at all.

unless

unless : Applicative f => Bool -> f () -> f () The reverse of when. This function has short-circuiting semantics, i.e., when both arguments are present and the first arguments evaluates to True, the second argument is not evaluated at all.

foldrA

foldrA : Action m => (a -> b -> m b) -> b -> [a] -> m b The foldrA is analogous to foldr, except that its result is encapsulated in an action. Note that foldrA works from right-to-left over the list arguments.

foldr1A

foldr1A : Action m => (a -> a -> m a) -> [a] -> m a foldr1A is like foldrA but raises an error when presented with an empty list argument.

foldlA

foldlA : Action m => (b -> a -> m b) -> b -> [a] -> m b foldlA is analogous to foldl, except that its result is encapsulated in an action. Note that foldlA works from left-to-right over the list arguments.

foldl1A

foldl1A : Action m => (a -> a -> m a) -> [a] -> m a The foldl1A is like foldlA but raises an errors when presented with an empty list argument.

filterA

filterA : Applicative m => (a -> m Bool) -> [a] -> m [a] Filters the list using the applicative function: keeps only the elements where the predicate holds. Example: given a collection of Iou contract IDs one can find only the GBPs.

replicateA

replicateA : Applicative m => Int -> m a -> m [a] replicateA n act performs the action n times, gathering the results.

replicateA_

replicateA_ : Applicative m => Int -> m a -> m () Like replicateA, but discards the result.

>=>

>=> : Action m => (a -> m b) -> (b -> m c) -> a -> m c Left-to-right composition of Kleisli arrows.

<=<

<=< : Action m => (b -> m c) -> (a -> m b) -> a -> m c Right-to-left composition of Kleisli arrows. @(’>=>’)@, with the arguments flipped.