Cardinality-0.2: Measure container capacity. Use it to safely change container.





cardinalityRange :: CardinalityRange_From -> CardinalityRange_To -> CardinalityRangeSource

CardinalityRange data constructor. The range is always including it's boundaries. F.e., range CardinalityRange (preciseC 1) (preciseC 4) contains cardinalities [1,2,3,4]. First cardinality MUST always be less or equal to second one. However, we do not fully guard from such type of error - we do not refine refinableC, if it participates in the constriction.

cFitsInCR_Proto :: LazyCardinality -> CardinalityRange -> (Ordering, LazyCardinality, CardinalityRange)Source

Root prototype for all subsequent "FitsIn" functions. Returns probably refined cardinality and range, which is useful for reuse. If returns EQ then subject cardinality is between boundaries (including) of cardinality range.

Uses almostStrictCompare2LCs function.

fitsInCR :: HasCard a => a -> CardinalityRange -> BoolSource

Wrapper around cFitsInCR.

fitsInCR_T :: HasCardT c => c a -> CardinalityRange -> BoolSource

Wrapper around cFitsInCR.

data FirstOrSecond Source




data Compare2CRsError Source

Error, that may occur, when performing compare2CRs

compare2CRs :: CardinalityRange -> CardinalityRange -> (Either Compare2CRsError (SetsFit CardinalityRange), CardinalityRange, CardinalityRange)Source

This function is made hard, but fast. It tends to make minimal amount of comparisons, reusing refinements.

Popular cardinality ranges constructors

cr0 :: CardinalityRangeSource

Only zero elements.

cr1 :: CardinalityRangeSource

Only one element.

cr0_1 :: CardinalityRangeSource

Zero or one element.

cr0_Inf :: CardinalityRangeSource

Any count of elements.

cr1_Inf :: CardinalityRangeSource

Any nonzero count of elements.

crX :: PreciseCardinality -> CardinalityRangeSource

Concrete count of elements.