arbiter-core-0.1.0.0
arbiter-core
Safe HaskellNone
LanguageGHC2024

Arbiter.Core.Selector

Description

A selector reads job fields and applies policies. Evaluation returns the selected result. Static inspection returns all reachable policies for migration initialization.

Synopsis

Documentation

Source #type Selector policy payload = Select (Prim policy payload)

A selective description over a payload. Evaluation for a job returns an a. Static inspection returns the reachable policies.

Source #field :: (payload -> a) -> Selector policy payload a

Read a field of the job (for predicates or key suffixes).

Source #usePolicy :: policy -> Selector policy payload policy

Record a policy for initialization and return it for key construction.

Source #runSelector :: forall policy payload a. payload -> Selector policy payload a -> a

Run a selector against a concrete job to get its result.

Source #collectPolicies :: Ord policy => Selector policy payload a -> Set policy

All policies that a selector can reach across all branches.

Source #usesAnyPolicy :: Selector policy payload a -> Bool

Test for a reachable policy. Stop at the first match.

Source #chooseWhen :: (payload -> Bool) -> Selector policy payload a -> Selector policy payload a -> Selector policy payload a

Select between two selectors with a job predicate. Policy collection inspects both branches.

Source #selectByCase :: (Bounded k, Enum k, Eq k) => (payload -> k) -> (k -> Selector policy payload a) -> Selector policy payload a

N-way chooseWhen. Maps the job to a finite tag, then each tag to its selector. Policy collection evaluates every tag in [minBound..maxBound]. The tag's Bounded/Enum and the selector must be total over k.