| License | Apache-2.0 |
|---|---|
| Safe Haskell | None |
| Language | GHC2021 |
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
- data BatchSelection a b = BatchSelection {
- selectedRequests :: [a]
- requestsLeft :: Int
- selectedBuild :: b
- nextCapacity :: Maybe CapacityLimit
- orderByTake :: (Ord bid, Ord reference) => (a -> bid) -> (a -> reference) -> [a] -> [a]
- largestFittingPrefix :: Monad m => ([a] -> m (Either Refusal b)) -> Maybe Word32 -> [a] -> m (Either Refusal (BatchSelection a b))
Documentation
data BatchSelection a b Source #
The selected prefix, the rest counted, and the actual builder result.
Constructors
| BatchSelection | |
Fields
| |
Instances
| (Show a, Show b) => Show (BatchSelection a b) Source # | |
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 # | |
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.