singular-registry
LicenseApache-2.0
Safe HaskellNone
LanguageGHC2021

Singular.State.Batch

Description

Selection reads only the supplied values. Every larger prefix is tried before the selected one, so a later success cannot be missed by assuming a cost law. Only a typed capacity refusal permits a shorter attempt.

Synopsis

Documentation

data BatchSelection a b Source #

The selected prefix, the rest counted, and the actual builder result.

Constructors

BatchSelection 

Fields

  • selectedRequests :: [a]

    Every request included in the successful probe, in its build order.

  • requestsLeft :: Int

    All supplied requests beyond the selected prefix, including the cap.

  • selectedBuild :: b

    The result returned by that successful probe.

  • nextCapacity :: Maybe CapacityLimit

    The actual refusal of the next prefix, absent at the whole set or cap.

Instances

Instances details
(Show a, Show b) => Show (BatchSelection a b) Source # 
Instance details

Defined in Singular.State.Batch

Methods

showsPrec :: Int -> BatchSelection a b -> ShowS Source #

show :: BatchSelection a b -> String Source #

showList :: [BatchSelection a b] -> ShowS Source #

(Eq a, Eq b) => Eq (BatchSelection a b) Source # 
Instance details

Defined in Singular.State.Batch

Methods

(==) :: BatchSelection a b -> BatchSelection a b -> Bool Source #

(/=) :: BatchSelection a b -> BatchSelection a b -> Bool Source #

orderByTake :: (Ord bid, Ord reference) => (a -> bid) -> (a -> reference) -> [a] -> [a] Source #

Greatest take first; equal takes use the output reference ascending.

largestFittingPrefix :: Monad m => ([a] -> m (Either Refusal b)) -> Maybe Word32 -> [a] -> m (Either Refusal (BatchSelection a b)) Source #

Try prefixes in descending size, stopping on the first success or any noncapacity refusal. The next-prefix boundary is the immediately preceding failed probe; all still larger prefixes have also been refused for capacity.