Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Constrained.Spec.Size
Contents
Synopsis
- genFromSizeSpec ∷ MonadGenError m ⇒ Specification Integer → GenT m Integer
- data SizeW (s ∷ Symbol) (dom ∷ [Type]) rng ∷ Type where
- sizeOfFn ∷ ∀ a. (HasSpec a, Sized a) ⇒ Fun '[a] Integer
- sizeOf_ ∷ (HasSpec t, Sized t) ⇒ Term t → Term Integer
- rangeSize ∷ Integer → Integer → SizeSpec
- between ∷ (HasSpec a, TypeSpec a ~ NumSpec a) ⇒ a → a → Specification a
- maxSpec ∷ Specification Integer → Specification Integer
- type SizeSpec = NumSpec Integer
- class Sized t where
- sizeOf ∷ t → Integer
- liftSizeSpec ∷ HasSpec t ⇒ SizeSpec → [Integer] → Specification t
- liftMemberSpec ∷ HasSpec t ⇒ [Integer] → Specification t
- sizeOfTypeSpec ∷ HasSpec t ⇒ TypeSpec t → Specification Integer
- hasSize ∷ (HasSpec t, Sized t) ⇒ SizeSpec → Specification t
Documentation
genFromSizeSpec ∷ MonadGenError m ⇒ Specification Integer → GenT m Integer Source #
Because Sizes should always be >= 0, We provide this alternate generator that can be used to replace (genFromSpecT @Integer), to ensure this important property
data SizeW (s ∷ Symbol) (dom ∷ [Type]) rng ∷ Type where Source #
Instances
Semantics SizeW Source # | |
Syntax SizeW Source # | |
(Sized t, HasSpec t) ⇒ Logic "sizeOf_" SizeW '[t] Integer Source # | |
Defined in Constrained.Spec.Size Methods info ∷ SizeW "sizeOf_" '[t] Integer → String Source # propagate ∷ Context "sizeOf_" SizeW '[t] Integer hole → Specification Integer → Specification hole Source # rewriteRules ∷ SizeW "sizeOf_" '[t] Integer → List Term '[t] → Evidence (AppRequires "sizeOf_" SizeW '[t] Integer) → Maybe (Term Integer) Source # mapTypeSpec ∷ ('[t] ~ '[a], Integer ~ b, HasSpec a, HasSpec b) ⇒ SizeW "sizeOf_" '[a] b → TypeSpec a → Specification b Source # saturate ∷ SizeW "sizeOf_" '[t] Bool → List Term '[t] → [Pred] Source # | |
Show (SizeW s d r) Source # | |
Eq (SizeW s ds r) Source # | |
maxSpec ∷ Specification Integer → Specification Integer Source #
The widest interval whose largest element is admitted by the original spec
Minimal complete definition
Nothing
Methods
liftSizeSpec ∷ HasSpec t ⇒ SizeSpec → [Integer] → Specification t Source #
default liftSizeSpec ∷ (HasSpec t, HasSimpleRep t, Sized (SimpleRep t), HasSpec (SimpleRep t), TypeSpec t ~ TypeSpec (SimpleRep t)) ⇒ SizeSpec → [Integer] → Specification t Source #
liftMemberSpec ∷ HasSpec t ⇒ [Integer] → Specification t Source #
default liftMemberSpec ∷ (HasSpec t, HasSpec (SimpleRep t), HasSimpleRep t, Sized (SimpleRep t), TypeSpec t ~ TypeSpec (SimpleRep t)) ⇒ [Integer] → Specification t Source #
sizeOfTypeSpec ∷ HasSpec t ⇒ TypeSpec t → Specification Integer Source #
Instances
Ord a ⇒ Sized (Set a) Source # | |
Defined in Constrained.Spec.Set Methods sizeOf ∷ Set a → Integer Source # liftSizeSpec ∷ SizeSpec → [Integer] → Specification (Set a) Source # liftMemberSpec ∷ [Integer] → Specification (Set a) Source # sizeOfTypeSpec ∷ TypeSpec (Set a) → Specification Integer Source # | |
Sized [a] Source # | |
Defined in Constrained.Spec.ListFoldy Methods sizeOf ∷ [a] → Integer Source # liftSizeSpec ∷ SizeSpec → [Integer] → Specification [a] Source # liftMemberSpec ∷ [Integer] → Specification [a] Source # sizeOfTypeSpec ∷ TypeSpec [a] → Specification Integer Source # | |
Ord a ⇒ Sized (Map a b) Source # | |
Defined in Constrained.Spec.Map Methods sizeOf ∷ Map a b → Integer Source # liftSizeSpec ∷ SizeSpec → [Integer] → Specification (Map a b) Source # liftMemberSpec ∷ [Integer] → Specification (Map a b) Source # sizeOfTypeSpec ∷ TypeSpec (Map a b) → Specification Integer Source # |
Orphan instances
(Sized t, HasSpec t) ⇒ Logic "sizeOf_" SizeW '[t] Integer Source # | |
Methods info ∷ SizeW "sizeOf_" '[t] Integer → String Source # propagate ∷ Context "sizeOf_" SizeW '[t] Integer hole → Specification Integer → Specification hole Source # rewriteRules ∷ SizeW "sizeOf_" '[t] Integer → List Term '[t] → Evidence (AppRequires "sizeOf_" SizeW '[t] Integer) → Maybe (Term Integer) Source # mapTypeSpec ∷ ('[t] ~ '[a], Integer ~ b, HasSpec a, HasSpec b) ⇒ SizeW "sizeOf_" '[a] b → TypeSpec a → Specification b Source # saturate ∷ SizeW "sizeOf_" '[t] Bool → List Term '[t] → [Pred] Source # |