constrained-generators-0.2.0.0: Framework for generating constrained random data using a subset of first order logic
Safe HaskellSafe-Inferred
LanguageHaskell2010

Constrained.API

Synopsis

Types

data NonEmpty a #

Non-empty (and non-strict) list type.

Since: base-4.9.0.0

Constructors

a :| [a] infixr 5 

Instances

Instances details
Foldable NonEmpty

Since: base-4.9.0.0

Instance details

Defined in Data.Foldable

Methods

foldMonoid m ⇒ NonEmpty m → m #

foldMapMonoid m ⇒ (a → m) → NonEmpty a → m #

foldMap'Monoid m ⇒ (a → m) → NonEmpty a → m #

foldr ∷ (a → b → b) → b → NonEmpty a → b #

foldr' ∷ (a → b → b) → b → NonEmpty a → b #

foldl ∷ (b → a → b) → b → NonEmpty a → b #

foldl' ∷ (b → a → b) → b → NonEmpty a → b #

foldr1 ∷ (a → a → a) → NonEmpty a → a #

foldl1 ∷ (a → a → a) → NonEmpty a → a #

toListNonEmpty a → [a] #

nullNonEmpty a → Bool #

lengthNonEmpty a → Int #

elemEq a ⇒ a → NonEmpty a → Bool #

maximumOrd a ⇒ NonEmpty a → a #

minimumOrd a ⇒ NonEmpty a → a #

sumNum a ⇒ NonEmpty a → a #

productNum a ⇒ NonEmpty a → a #

Eq1 NonEmpty

Since: base-4.10.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftEq ∷ (a → b → Bool) → NonEmpty a → NonEmpty b → Bool #

Ord1 NonEmpty

Since: base-4.10.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftCompare ∷ (a → b → Ordering) → NonEmpty a → NonEmpty b → Ordering #

Read1 NonEmpty

Since: base-4.10.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftReadsPrec ∷ (IntReadS a) → ReadS [a] → IntReadS (NonEmpty a) #

liftReadList ∷ (IntReadS a) → ReadS [a] → ReadS [NonEmpty a] #

liftReadPrecReadPrec a → ReadPrec [a] → ReadPrec (NonEmpty a) #

liftReadListPrecReadPrec a → ReadPrec [a] → ReadPrec [NonEmpty a] #

Show1 NonEmpty

Since: base-4.10.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftShowsPrec ∷ (Int → a → ShowS) → ([a] → ShowS) → IntNonEmpty a → ShowS #

liftShowList ∷ (Int → a → ShowS) → ([a] → ShowS) → [NonEmpty a] → ShowS #

Traversable NonEmpty

Since: base-4.9.0.0

Instance details

Defined in Data.Traversable

Methods

traverseApplicative f ⇒ (a → f b) → NonEmpty a → f (NonEmpty b) #

sequenceAApplicative f ⇒ NonEmpty (f a) → f (NonEmpty a) #

mapMMonad m ⇒ (a → m b) → NonEmpty a → m (NonEmpty b) #

sequenceMonad m ⇒ NonEmpty (m a) → m (NonEmpty a) #

Applicative NonEmpty

Since: base-4.9.0.0

Instance details

Defined in GHC.Base

Methods

pure ∷ a → NonEmpty a #

(<*>)NonEmpty (a → b) → NonEmpty a → NonEmpty b #

liftA2 ∷ (a → b → c) → NonEmpty a → NonEmpty b → NonEmpty c #

(*>)NonEmpty a → NonEmpty b → NonEmpty b #

(<*)NonEmpty a → NonEmpty b → NonEmpty a #

Functor NonEmpty

Since: base-4.9.0.0

Instance details

Defined in GHC.Base

Methods

fmap ∷ (a → b) → NonEmpty a → NonEmpty b #

(<$) ∷ a → NonEmpty b → NonEmpty a #

Monad NonEmpty

Since: base-4.9.0.0

Instance details

Defined in GHC.Base

Methods

(>>=)NonEmpty a → (a → NonEmpty b) → NonEmpty b #

(>>)NonEmpty a → NonEmpty b → NonEmpty b #

return ∷ a → NonEmpty a #

NFData1 NonEmpty

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

liftRnf ∷ (a → ()) → NonEmpty a → () #

Generic1 NonEmpty 
Instance details

Defined in GHC.Generics

Associated Types

type Rep1 NonEmpty ∷ k → Type #

Methods

from1 ∷ ∀ (a ∷ k). NonEmpty a → Rep1 NonEmpty a #

to1 ∷ ∀ (a ∷ k). Rep1 NonEmpty a → NonEmpty a #

Lift a ⇒ Lift (NonEmpty a ∷ Type)

Since: template-haskell-2.15.0.0

Instance details

Defined in Language.Haskell.TH.Syntax

Methods

liftQuote m ⇒ NonEmpty a → m Exp #

liftTyped ∷ ∀ (m ∷ TypeType). Quote m ⇒ NonEmpty a → Code m (NonEmpty a) #

Arbitrary a ⇒ Arbitrary (NonEmpty a) Source # 
Instance details

Defined in Constrained.Core

Semigroup (NonEmpty a)

Since: base-4.9.0.0

Instance details

Defined in GHC.Base

Methods

(<>)NonEmpty a → NonEmpty a → NonEmpty a #

sconcatNonEmpty (NonEmpty a) → NonEmpty a #

stimesIntegral b ⇒ b → NonEmpty a → NonEmpty a #

Generic (NonEmpty a) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep (NonEmpty a) ∷ TypeType #

Methods

fromNonEmpty a → Rep (NonEmpty a) x #

toRep (NonEmpty a) x → NonEmpty a #

IsList (NonEmpty a)

Since: base-4.9.0.0

Instance details

Defined in GHC.IsList

Associated Types

type Item (NonEmpty a) #

Methods

fromList ∷ [Item (NonEmpty a)] → NonEmpty a #

fromListNInt → [Item (NonEmpty a)] → NonEmpty a #

toListNonEmpty a → [Item (NonEmpty a)] #

Read a ⇒ Read (NonEmpty a)

Since: base-4.11.0.0

Instance details

Defined in GHC.Read

Show a ⇒ Show (NonEmpty a)

Since: base-4.11.0.0

Instance details

Defined in GHC.Show

Methods

showsPrecIntNonEmpty a → ShowS #

showNonEmpty a → String #

showList ∷ [NonEmpty a] → ShowS #

NFData a ⇒ NFData (NonEmpty a)

Since: deepseq-1.4.2.0

Instance details

Defined in Control.DeepSeq

Methods

rnfNonEmpty a → () #

Eq a ⇒ Eq (NonEmpty a)

Since: base-4.9.0.0

Instance details

Defined in GHC.Base

Methods

(==)NonEmpty a → NonEmpty a → Bool #

(/=)NonEmpty a → NonEmpty a → Bool #

Ord a ⇒ Ord (NonEmpty a)

Since: base-4.9.0.0

Instance details

Defined in GHC.Base

Methods

compareNonEmpty a → NonEmpty a → Ordering #

(<)NonEmpty a → NonEmpty a → Bool #

(<=)NonEmpty a → NonEmpty a → Bool #

(>)NonEmpty a → NonEmpty a → Bool #

(>=)NonEmpty a → NonEmpty a → Bool #

maxNonEmpty a → NonEmpty a → NonEmpty a #

minNonEmpty a → NonEmpty a → NonEmpty a #

Pretty a ⇒ Pretty (NonEmpty a) 
Instance details

Defined in Prettyprinter.Internal

Methods

prettyNonEmpty a → Doc ann Source #

prettyList ∷ [NonEmpty a] → Doc ann Source #

type Rep1 NonEmpty

Since: base-4.6.0.0

Instance details

Defined in GHC.Generics

type Rep (NonEmpty a)

Since: base-4.6.0.0

Instance details

Defined in GHC.Generics

type Item (NonEmpty a) 
Instance details

Defined in GHC.IsList

type Item (NonEmpty a) = a

Type classes and constraints

class (Typeable a, Eq a, Show a, TypeSpecEqShow a) ⇒ HasSpec a where Source #

Minimal complete definition

Nothing

Associated Types

type TypeSpec a Source #

The `TypeSpec a` is the type-specific `Specification a`.

type Prerequisites a ∷ Constraint Source #

Prerequisites for the instance that are sometimes necessary when working with e.g. Specifications or functions in the universe.

type Prerequisites a = ()

Methods

emptySpecTypeSpec a Source #

combineSpecTypeSpec a → TypeSpec a → Specification a Source #

genFromTypeSpec ∷ (HasCallStack, MonadGenError m) ⇒ TypeSpec a → GenT m a Source #

Generate a value that satisfies the HasSpec. The key property for this generator is soundness: ∀ a ∈ genFromTypeSpec spec. a conformsTo spec

conformsToHasCallStack ⇒ a → TypeSpec a → Bool Source #

Check conformance to the spec.

shrinkWithTypeSpecTypeSpec a → a → [a] Source #

Shrink an a with the aide of a HasSpec

default shrinkWithTypeSpecGenericallyInstantiated a ⇒ TypeSpec a → a → [a] Source #

toPredsTerm a → TypeSpec a → Pred Source #

Convert a spec to predicates: The key property here is: ∀ a. a conformsTo spec == a conformsTo constrained (t -> toPreds t spec)

default toPredsGenericallyInstantiated a ⇒ Term a → TypeSpec a → Pred Source #

cardinalTypeSpecTypeSpec a → Specification Integer Source #

Compute an upper and lower bound on the number of solutions genFromTypeSpec might return

cardinalTrueSpecSpecification Integer Source #

A bound on the number of solutions `genFromTypeSpec TrueSpec` can produce. For a type with finite elements, we can get a much more accurate answer than TrueSpec

typeSpecHasErrorTypeSpec a → Maybe (NonEmpty String) Source #

alternateShowTypeSpec a → BinaryShow Source #

monadConformsTo ∷ a → TypeSpec a → Writer [String] Bool Source #

typeSpecOptTypeSpec a → [a] → Specification a Source #

For some types (especially finite ones) there may be much better ways to construct a Specification than the default method of just adding a large bad list to TypSpec. This function allows each HasSpec instance to decide.

guardTypeSpec ∷ [String] → TypeSpec a → Specification a Source #

This can be used to detect self inconsistencies in a (TypeSpec t) Note this is similar to typeSpecHasError, and the default value for typeSpecHasError is written in terms of guardTypeSpec Both typeSpecHasError and guardTypeSpec can be set individually.

prerequisitesEvidence (Prerequisites a) Source #

Materialize the Prerequisites dictionary. It should not be necessary to implement this function manually.

Instances

Instances details
HasSpec Int16 Source # 
Instance details

Defined in Constrained.NumOrd

Associated Types

type TypeSpec Int16 Source #

type Prerequisites Int16 Source #

HasSpec Int32 Source # 
Instance details

Defined in Constrained.NumOrd

Associated Types

type TypeSpec Int32 Source #

type Prerequisites Int32 Source #

HasSpec Int64 Source # 
Instance details

Defined in Constrained.NumOrd

Associated Types

type TypeSpec Int64 Source #

type Prerequisites Int64 Source #

HasSpec Int8 Source # 
Instance details

Defined in Constrained.NumOrd

Associated Types

type TypeSpec Int8 Source #

type Prerequisites Int8 Source #

HasSpec Word16 Source # 
Instance details

Defined in Constrained.NumOrd

Associated Types

type TypeSpec Word16 Source #

type Prerequisites Word16 Source #

HasSpec Word32 Source # 
Instance details

Defined in Constrained.NumOrd

Associated Types

type TypeSpec Word32 Source #

type Prerequisites Word32 Source #

HasSpec Word64 Source # 
Instance details

Defined in Constrained.NumOrd

Associated Types

type TypeSpec Word64 Source #

type Prerequisites Word64 Source #

HasSpec Word8 Source # 
Instance details

Defined in Constrained.NumOrd

Associated Types

type TypeSpec Word8 Source #

type Prerequisites Word8 Source #

HasSpec Foo Source # 
Instance details

Defined in Constrained.Examples.Basic

Associated Types

type TypeSpec Foo Source #

type Prerequisites Foo Source #

HasSpec Three Source # 
Instance details

Defined in Constrained.Examples.Basic

Associated Types

type TypeSpec Three Source #

type Prerequisites Three Source #

HasSpec FooBarBaz Source # 
Instance details

Defined in Constrained.Examples.CheatSheet

HasSpec Coin Source # 
Instance details

Defined in Constrained.Examples.ManualExamples

Associated Types

type TypeSpec Coin Source #

type Prerequisites Coin Source #

HasSpec Dimensions Source # 
Instance details

Defined in Constrained.Examples.ManualExamples

HasSpec Nested Source # 
Instance details

Defined in Constrained.Examples.ManualExamples

Associated Types

type TypeSpec Nested Source #

type Prerequisites Nested Source #

HasSpec Rectangle Source # 
Instance details

Defined in Constrained.Examples.ManualExamples

HasSpec Three Source # 
Instance details

Defined in Constrained.Examples.ManualExamples

Associated Types

type TypeSpec Three Source #

type Prerequisites Three Source #

HasSpec Integer Source # 
Instance details

Defined in Constrained.NumOrd

HasSpec Natural Source # 
Instance details

Defined in Constrained.NumOrd

HasSpec () Source # 
Instance details

Defined in Constrained.Base

Associated Types

type TypeSpec () Source #

type Prerequisites () Source #

HasSpec Bool Source #

NOTE: this instance means we have to use ifElse, whenTrue, and whenFalse instead of caseOn for Bool

Instance details

Defined in Constrained.Base

Associated Types

type TypeSpec Bool Source #

type Prerequisites Bool Source #

HasSpec Float Source # 
Instance details

Defined in Constrained.NumOrd

Associated Types

type TypeSpec Float Source #

type Prerequisites Float Source #

HasSpec Int Source # 
Instance details

Defined in Constrained.NumOrd

Associated Types

type TypeSpec Int Source #

type Prerequisites Int Source #

HasSpec (Ratio Integer) Source # 
Instance details

Defined in Constrained.NumOrd

(Ord a, HasSpec a) ⇒ HasSpec (NotASet a) Source # 
Instance details

Defined in Constrained.Examples.Set

Associated Types

type TypeSpec (NotASet a) Source #

type Prerequisites (NotASet a) Source #

HasSpec a ⇒ HasSpec (BinTree a) Source # 
Instance details

Defined in Constrained.Spec.Tree

Associated Types

type TypeSpec (BinTree a) Source #

type Prerequisites (BinTree a) Source #

(Ord a, HasSpec a) ⇒ HasSpec (Set a) Source # 
Instance details

Defined in Constrained.Spec.Set

Associated Types

type TypeSpec (Set a) Source #

type Prerequisites (Set a) Source #

HasSpec a ⇒ HasSpec (Tree a) Source # 
Instance details

Defined in Constrained.Spec.Tree

Associated Types

type TypeSpec (Tree a) Source #

type Prerequisites (Tree a) Source #

(IsNormalType a, HasSpec a) ⇒ HasSpec (Maybe a) Source # 
Instance details

Defined in Constrained.Spec.SumProd

Associated Types

type TypeSpec (Maybe a) Source #

type Prerequisites (Maybe a) Source #

(Sized [a], HasSpec a) ⇒ HasSpec [a] Source # 
Instance details

Defined in Constrained.TheKnot

Associated Types

type TypeSpec [a] Source #

type Prerequisites [a] Source #

(HasSpec a, IsNormalType a, HasSpec b, IsNormalType b) ⇒ HasSpec (Either a b) Source # 
Instance details

Defined in Constrained.Spec.SumProd

Associated Types

type TypeSpec (Either a b) Source #

type Prerequisites (Either a b) Source #

(HasSpec a, HasSpec b) ⇒ HasSpec (Prod a b) Source # 
Instance details

Defined in Constrained.TheKnot

Associated Types

type TypeSpec (Prod a b) Source #

type Prerequisites (Prod a b) Source #

(HasSpec a, HasSpec b, KnownNat (CountCases b)) ⇒ HasSpec (Sum a b) Source #

The HasSpec Sum instance

Instance details

Defined in Constrained.Generation

Associated Types

type TypeSpec (Sum a b) Source #

type Prerequisites (Sum a b) Source #

(Ord k, HasSpec (Prod k v), HasSpec k, HasSpec v, HasSpec [v], IsNormalType k, IsNormalType v) ⇒ HasSpec (Map k v) Source # 
Instance details

Defined in Constrained.Spec.Map

Associated Types

type TypeSpec (Map k v) Source #

type Prerequisites (Map k v) Source #

(HasSpec a, HasSpec b) ⇒ HasSpec (a, b) Source # 
Instance details

Defined in Constrained.Spec.SumProd

Associated Types

type TypeSpec (a, b) Source #

type Prerequisites (a, b) Source #

Methods

emptySpecTypeSpec (a, b) Source #

combineSpecTypeSpec (a, b) → TypeSpec (a, b) → Specification (a, b) Source #

genFromTypeSpec ∷ ∀ (m ∷ TypeType). (HasCallStack, MonadGenError m) ⇒ TypeSpec (a, b) → GenT m (a, b) Source #

conformsTo ∷ (a, b) → TypeSpec (a, b) → Bool Source #

shrinkWithTypeSpecTypeSpec (a, b) → (a, b) → [(a, b)] Source #

toPredsTerm (a, b) → TypeSpec (a, b) → Pred Source #

cardinalTypeSpecTypeSpec (a, b) → Specification Integer Source #

cardinalTrueSpecSpecification Integer Source #

typeSpecHasErrorTypeSpec (a, b) → Maybe (NonEmpty String) Source #

alternateShowTypeSpec (a, b) → BinaryShow Source #

monadConformsTo ∷ (a, b) → TypeSpec (a, b) → Writer [String] Bool Source #

typeSpecOptTypeSpec (a, b) → [(a, b)] → Specification (a, b) Source #

guardTypeSpec ∷ [String] → TypeSpec (a, b) → Specification (a, b) Source #

prerequisitesEvidence (Prerequisites (a, b)) Source #

(HasSpec a, HasSpec b, HasSpec c) ⇒ HasSpec (a, b, c) Source # 
Instance details

Defined in Constrained.Spec.SumProd

Associated Types

type TypeSpec (a, b, c) Source #

type Prerequisites (a, b, c) Source #

Methods

emptySpecTypeSpec (a, b, c) Source #

combineSpecTypeSpec (a, b, c) → TypeSpec (a, b, c) → Specification (a, b, c) Source #

genFromTypeSpec ∷ ∀ (m ∷ TypeType). (HasCallStack, MonadGenError m) ⇒ TypeSpec (a, b, c) → GenT m (a, b, c) Source #

conformsTo ∷ (a, b, c) → TypeSpec (a, b, c) → Bool Source #

shrinkWithTypeSpecTypeSpec (a, b, c) → (a, b, c) → [(a, b, c)] Source #

toPredsTerm (a, b, c) → TypeSpec (a, b, c) → Pred Source #

cardinalTypeSpecTypeSpec (a, b, c) → Specification Integer Source #

cardinalTrueSpecSpecification Integer Source #

typeSpecHasErrorTypeSpec (a, b, c) → Maybe (NonEmpty String) Source #

alternateShowTypeSpec (a, b, c) → BinaryShow Source #

monadConformsTo ∷ (a, b, c) → TypeSpec (a, b, c) → Writer [String] Bool Source #

typeSpecOptTypeSpec (a, b, c) → [(a, b, c)] → Specification (a, b, c) Source #

guardTypeSpec ∷ [String] → TypeSpec (a, b, c) → Specification (a, b, c) Source #

prerequisitesEvidence (Prerequisites (a, b, c)) Source #

(HasSpec a, HasSpec b, HasSpec c, HasSpec d) ⇒ HasSpec (a, b, c, d) Source # 
Instance details

Defined in Constrained.Spec.SumProd

Associated Types

type TypeSpec (a, b, c, d) Source #

type Prerequisites (a, b, c, d) Source #

Methods

emptySpecTypeSpec (a, b, c, d) Source #

combineSpecTypeSpec (a, b, c, d) → TypeSpec (a, b, c, d) → Specification (a, b, c, d) Source #

genFromTypeSpec ∷ ∀ (m ∷ TypeType). (HasCallStack, MonadGenError m) ⇒ TypeSpec (a, b, c, d) → GenT m (a, b, c, d) Source #

conformsTo ∷ (a, b, c, d) → TypeSpec (a, b, c, d) → Bool Source #

shrinkWithTypeSpecTypeSpec (a, b, c, d) → (a, b, c, d) → [(a, b, c, d)] Source #

toPredsTerm (a, b, c, d) → TypeSpec (a, b, c, d) → Pred Source #

cardinalTypeSpecTypeSpec (a, b, c, d) → Specification Integer Source #

cardinalTrueSpecSpecification Integer Source #

typeSpecHasErrorTypeSpec (a, b, c, d) → Maybe (NonEmpty String) Source #

alternateShowTypeSpec (a, b, c, d) → BinaryShow Source #

monadConformsTo ∷ (a, b, c, d) → TypeSpec (a, b, c, d) → Writer [String] Bool Source #

typeSpecOptTypeSpec (a, b, c, d) → [(a, b, c, d)] → Specification (a, b, c, d) Source #

guardTypeSpec ∷ [String] → TypeSpec (a, b, c, d) → Specification (a, b, c, d) Source #

prerequisitesEvidence (Prerequisites (a, b, c, d)) Source #

(HasSpec a, HasSpec b, HasSpec c, HasSpec d, HasSpec e) ⇒ HasSpec (a, b, c, d, e) Source # 
Instance details

Defined in Constrained.Spec.SumProd

Associated Types

type TypeSpec (a, b, c, d, e) Source #

type Prerequisites (a, b, c, d, e) Source #

Methods

emptySpecTypeSpec (a, b, c, d, e) Source #

combineSpecTypeSpec (a, b, c, d, e) → TypeSpec (a, b, c, d, e) → Specification (a, b, c, d, e) Source #

genFromTypeSpec ∷ ∀ (m ∷ TypeType). (HasCallStack, MonadGenError m) ⇒ TypeSpec (a, b, c, d, e) → GenT m (a, b, c, d, e) Source #

conformsTo ∷ (a, b, c, d, e) → TypeSpec (a, b, c, d, e) → Bool Source #

shrinkWithTypeSpecTypeSpec (a, b, c, d, e) → (a, b, c, d, e) → [(a, b, c, d, e)] Source #

toPredsTerm (a, b, c, d, e) → TypeSpec (a, b, c, d, e) → Pred Source #

cardinalTypeSpecTypeSpec (a, b, c, d, e) → Specification Integer Source #

cardinalTrueSpecSpecification Integer Source #

typeSpecHasErrorTypeSpec (a, b, c, d, e) → Maybe (NonEmpty String) Source #

alternateShowTypeSpec (a, b, c, d, e) → BinaryShow Source #

monadConformsTo ∷ (a, b, c, d, e) → TypeSpec (a, b, c, d, e) → Writer [String] Bool Source #

typeSpecOptTypeSpec (a, b, c, d, e) → [(a, b, c, d, e)] → Specification (a, b, c, d, e) Source #

guardTypeSpec ∷ [String] → TypeSpec (a, b, c, d, e) → Specification (a, b, c, d, e) Source #

prerequisitesEvidence (Prerequisites (a, b, c, d, e)) Source #

(HasSpec a, HasSpec b, HasSpec c, HasSpec d, HasSpec e, HasSpec g) ⇒ HasSpec (a, b, c, d, e, g) Source # 
Instance details

Defined in Constrained.Spec.SumProd

Associated Types

type TypeSpec (a, b, c, d, e, g) Source #

type Prerequisites (a, b, c, d, e, g) Source #

Methods

emptySpecTypeSpec (a, b, c, d, e, g) Source #

combineSpecTypeSpec (a, b, c, d, e, g) → TypeSpec (a, b, c, d, e, g) → Specification (a, b, c, d, e, g) Source #

genFromTypeSpec ∷ ∀ (m ∷ TypeType). (HasCallStack, MonadGenError m) ⇒ TypeSpec (a, b, c, d, e, g) → GenT m (a, b, c, d, e, g) Source #

conformsTo ∷ (a, b, c, d, e, g) → TypeSpec (a, b, c, d, e, g) → Bool Source #

shrinkWithTypeSpecTypeSpec (a, b, c, d, e, g) → (a, b, c, d, e, g) → [(a, b, c, d, e, g)] Source #

toPredsTerm (a, b, c, d, e, g) → TypeSpec (a, b, c, d, e, g) → Pred Source #

cardinalTypeSpecTypeSpec (a, b, c, d, e, g) → Specification Integer Source #

cardinalTrueSpecSpecification Integer Source #

typeSpecHasErrorTypeSpec (a, b, c, d, e, g) → Maybe (NonEmpty String) Source #

alternateShowTypeSpec (a, b, c, d, e, g) → BinaryShow Source #

monadConformsTo ∷ (a, b, c, d, e, g) → TypeSpec (a, b, c, d, e, g) → Writer [String] Bool Source #

typeSpecOptTypeSpec (a, b, c, d, e, g) → [(a, b, c, d, e, g)] → Specification (a, b, c, d, e, g) Source #

guardTypeSpec ∷ [String] → TypeSpec (a, b, c, d, e, g) → Specification (a, b, c, d, e, g) Source #

prerequisitesEvidence (Prerequisites (a, b, c, d, e, g)) Source #

(HasSpec a, HasSpec b, HasSpec c, HasSpec d, HasSpec e, HasSpec g, HasSpec h) ⇒ HasSpec (a, b, c, d, e, g, h) Source # 
Instance details

Defined in Constrained.Spec.SumProd

Associated Types

type TypeSpec (a, b, c, d, e, g, h) Source #

type Prerequisites (a, b, c, d, e, g, h) Source #

Methods

emptySpecTypeSpec (a, b, c, d, e, g, h) Source #

combineSpecTypeSpec (a, b, c, d, e, g, h) → TypeSpec (a, b, c, d, e, g, h) → Specification (a, b, c, d, e, g, h) Source #

genFromTypeSpec ∷ ∀ (m ∷ TypeType). (HasCallStack, MonadGenError m) ⇒ TypeSpec (a, b, c, d, e, g, h) → GenT m (a, b, c, d, e, g, h) Source #

conformsTo ∷ (a, b, c, d, e, g, h) → TypeSpec (a, b, c, d, e, g, h) → Bool Source #

shrinkWithTypeSpecTypeSpec (a, b, c, d, e, g, h) → (a, b, c, d, e, g, h) → [(a, b, c, d, e, g, h)] Source #

toPredsTerm (a, b, c, d, e, g, h) → TypeSpec (a, b, c, d, e, g, h) → Pred Source #

cardinalTypeSpecTypeSpec (a, b, c, d, e, g, h) → Specification Integer Source #

cardinalTrueSpecSpecification Integer Source #

typeSpecHasErrorTypeSpec (a, b, c, d, e, g, h) → Maybe (NonEmpty String) Source #

alternateShowTypeSpec (a, b, c, d, e, g, h) → BinaryShow Source #

monadConformsTo ∷ (a, b, c, d, e, g, h) → TypeSpec (a, b, c, d, e, g, h) → Writer [String] Bool Source #

typeSpecOptTypeSpec (a, b, c, d, e, g, h) → [(a, b, c, d, e, g, h)] → Specification (a, b, c, d, e, g, h) Source #

guardTypeSpec ∷ [String] → TypeSpec (a, b, c, d, e, g, h) → Specification (a, b, c, d, e, g, h) Source #

prerequisitesEvidence (Prerequisites (a, b, c, d, e, g, h)) Source #

class Typeable (SimpleRep a) ⇒ HasSimpleRep a where Source #

Minimal complete definition

Nothing

Associated Types

type SimpleRep a Source #

type SimpleRep a = SOP (TheSop a)

type TheSop a ∷ [Type] Source #

type TheSop a = SOPOf (Rep a)

Methods

toSimpleRep ∷ a → SimpleRep a Source #

default toSimpleRep ∷ (Generic a, SimpleGeneric (Rep a), SimpleRep a ~ SimplifyRep (Rep a)) ⇒ a → SimpleRep a Source #

fromSimpleRepSimpleRep a → a Source #

Instances

Instances details
HasSimpleRep Foo Source # 
Instance details

Defined in Constrained.Examples.Basic

Associated Types

type SimpleRep Foo Source #

type TheSop Foo ∷ [Type] Source #

HasSimpleRep Three Source # 
Instance details

Defined in Constrained.Examples.Basic

Associated Types

type SimpleRep Three Source #

type TheSop Three ∷ [Type] Source #

HasSimpleRep FooBarBaz Source # 
Instance details

Defined in Constrained.Examples.CheatSheet

Associated Types

type SimpleRep FooBarBaz Source #

type TheSop FooBarBaz ∷ [Type] Source #

HasSimpleRep Coin Source # 
Instance details

Defined in Constrained.Examples.ManualExamples

Associated Types

type SimpleRep Coin Source #

type TheSop Coin ∷ [Type] Source #

HasSimpleRep Dimensions Source # 
Instance details

Defined in Constrained.Examples.ManualExamples

Associated Types

type SimpleRep Dimensions Source #

type TheSop Dimensions ∷ [Type] Source #

HasSimpleRep Nested Source # 
Instance details

Defined in Constrained.Examples.ManualExamples

Associated Types

type SimpleRep Nested Source #

type TheSop Nested ∷ [Type] Source #

HasSimpleRep Rectangle Source # 
Instance details

Defined in Constrained.Examples.ManualExamples

Associated Types

type SimpleRep Rectangle Source #

type TheSop Rectangle ∷ [Type] Source #

HasSimpleRep Three Source # 
Instance details

Defined in Constrained.Examples.ManualExamples

Associated Types

type SimpleRep Three Source #

type TheSop Three ∷ [Type] Source #

HasSimpleRep () Source # 
Instance details

Defined in Constrained.Generic

Associated Types

type SimpleRep () Source #

type TheSop () ∷ [Type] Source #

Methods

toSimpleRep ∷ () → SimpleRep () Source #

fromSimpleRepSimpleRep () → () Source #

(Typeable a, Ord a) ⇒ HasSimpleRep (NotASet a) Source # 
Instance details

Defined in Constrained.Examples.Set

Associated Types

type SimpleRep (NotASet a) Source #

type TheSop (NotASet a) ∷ [Type] Source #

Typeable a ⇒ HasSimpleRep (Maybe a) Source # 
Instance details

Defined in Constrained.Spec.SumProd

Associated Types

type SimpleRep (Maybe a) Source #

type TheSop (Maybe a) ∷ [Type] Source #

(Typeable a, Typeable b) ⇒ HasSimpleRep (Either a b) Source # 
Instance details

Defined in Constrained.Spec.SumProd

Associated Types

type SimpleRep (Either a b) Source #

type TheSop (Either a b) ∷ [Type] Source #

(Typeable a, Typeable b) ⇒ HasSimpleRep (a, b) Source # 
Instance details

Defined in Constrained.Spec.SumProd

Associated Types

type SimpleRep (a, b) Source #

type TheSop (a, b) ∷ [Type] Source #

Methods

toSimpleRep ∷ (a, b) → SimpleRep (a, b) Source #

fromSimpleRepSimpleRep (a, b) → (a, b) Source #

(Typeable a, Typeable b, Typeable c) ⇒ HasSimpleRep (a, b, c) Source # 
Instance details

Defined in Constrained.Spec.SumProd

Associated Types

type SimpleRep (a, b, c) Source #

type TheSop (a, b, c) ∷ [Type] Source #

Methods

toSimpleRep ∷ (a, b, c) → SimpleRep (a, b, c) Source #

fromSimpleRepSimpleRep (a, b, c) → (a, b, c) Source #

(Typeable a, Typeable b, Typeable c, Typeable d) ⇒ HasSimpleRep (a, b, c, d) Source # 
Instance details

Defined in Constrained.Spec.SumProd

Associated Types

type SimpleRep (a, b, c, d) Source #

type TheSop (a, b, c, d) ∷ [Type] Source #

Methods

toSimpleRep ∷ (a, b, c, d) → SimpleRep (a, b, c, d) Source #

fromSimpleRepSimpleRep (a, b, c, d) → (a, b, c, d) Source #

(Typeable a, Typeable b, Typeable c, Typeable d, Typeable e) ⇒ HasSimpleRep (a, b, c, d, e) Source # 
Instance details

Defined in Constrained.Spec.SumProd

Associated Types

type SimpleRep (a, b, c, d, e) Source #

type TheSop (a, b, c, d, e) ∷ [Type] Source #

Methods

toSimpleRep ∷ (a, b, c, d, e) → SimpleRep (a, b, c, d, e) Source #

fromSimpleRepSimpleRep (a, b, c, d, e) → (a, b, c, d, e) Source #

(Typeable a, Typeable b, Typeable c, Typeable d, Typeable e, Typeable g) ⇒ HasSimpleRep (a, b, c, d, e, g) Source # 
Instance details

Defined in Constrained.Spec.SumProd

Associated Types

type SimpleRep (a, b, c, d, e, g) Source #

type TheSop (a, b, c, d, e, g) ∷ [Type] Source #

Methods

toSimpleRep ∷ (a, b, c, d, e, g) → SimpleRep (a, b, c, d, e, g) Source #

fromSimpleRepSimpleRep (a, b, c, d, e, g) → (a, b, c, d, e, g) Source #

(Typeable a, Typeable b, Typeable c, Typeable d, Typeable e, Typeable g, Typeable h) ⇒ HasSimpleRep (a, b, c, d, e, g, h) Source # 
Instance details

Defined in Constrained.Spec.SumProd

Associated Types

type SimpleRep (a, b, c, d, e, g, h) Source #

type TheSop (a, b, c, d, e, g, h) ∷ [Type] Source #

Methods

toSimpleRep ∷ (a, b, c, d, e, g, h) → SimpleRep (a, b, c, d, e, g, h) Source #

fromSimpleRepSimpleRep (a, b, c, d, e, g, h) → (a, b, c, d, e, g, h) Source #

class (HasSpec a, NumLike a) ⇒ Foldy a where Source #

Minimal complete definition

Nothing

Instances

Instances details
Foldy Int16 Source # 
Instance details

Defined in Constrained.TheKnot

Foldy Int32 Source # 
Instance details

Defined in Constrained.TheKnot

Foldy Int64 Source # 
Instance details

Defined in Constrained.TheKnot

Foldy Int8 Source # 
Instance details

Defined in Constrained.TheKnot

Foldy Word16 Source # 
Instance details

Defined in Constrained.TheKnot

Foldy Word32 Source # 
Instance details

Defined in Constrained.TheKnot

Foldy Word64 Source # 
Instance details

Defined in Constrained.TheKnot

Foldy Word8 Source # 
Instance details

Defined in Constrained.TheKnot

Foldy Integer Source # 
Instance details

Defined in Constrained.TheKnot

Foldy Natural Source # 
Instance details

Defined in Constrained.TheKnot

Foldy Int Source # 
Instance details

Defined in Constrained.TheKnot

class (Ord a, HasSpec a) ⇒ OrdLike a where Source #

Minimal complete definition

Nothing

Methods

leqSpec ∷ a → Specification a Source #

default leqSpec ∷ (GenericRequires a, OrdLike (SimpleRep a)) ⇒ a → Specification a Source #

ltSpec ∷ a → Specification a Source #

default ltSpec ∷ (OrdLike (SimpleRep a), GenericRequires a) ⇒ a → Specification a Source #

geqSpec ∷ a → Specification a Source #

default geqSpec ∷ (OrdLike (SimpleRep a), GenericRequires a) ⇒ a → Specification a Source #

gtSpec ∷ a → Specification a Source #

default gtSpec ∷ (OrdLike (SimpleRep a), GenericRequires a) ⇒ a → Specification a Source #

Instances

Instances details
(Ord a, HasSpec a, MaybeBounded a, Num a, TypeSpec a ~ NumSpec a) ⇒ OrdLike a Source #

This instance should be general enough for every type of Number that has a NumSpec as its TypeSpec

Instance details

Defined in Constrained.NumOrd

class Forallable t e | t → e where Source #

Minimal complete definition

Nothing

Instances

Instances details
(Typeable a, Ord a) ⇒ Forallable (NotASet a) a Source # 
Instance details

Defined in Constrained.Examples.Set

Ord a ⇒ Forallable (Set a) a Source # 
Instance details

Defined in Constrained.Spec.Set

Forallable [a] a Source # 
Instance details

Defined in Constrained.TheKnot

Forallable (Tree a) (a, [Tree a]) Source # 
Instance details

Defined in Constrained.Spec.Tree

Methods

fromForAllSpecSpecification (a, [Tree a]) → Specification (Tree a) Source #

forAllToListTree a → [(a, [Tree a])] Source #

Forallable (BinTree a) (BinTree a, a, BinTree a) Source # 
Instance details

Defined in Constrained.Spec.Tree

Ord k ⇒ Forallable (Map k v) (k, v) Source # 
Instance details

Defined in Constrained.Spec.Map

Methods

fromForAllSpecSpecification (k, v) → Specification (Map k v) Source #

forAllToListMap k v → [(k, v)] Source #

class (HasSpec a, Show (Hint a)) ⇒ HasGenHint a where Source #

Hints are things that only affect generation, and not validation. For instance, parameters to control distribution of generated values.

Associated Types

type Hint a Source #

Methods

giveHintHint a → Specification a Source #

Instances

Instances details
HasSpec a ⇒ HasGenHint (BinTree a) Source # 
Instance details

Defined in Constrained.Spec.Tree

Associated Types

type Hint (BinTree a) Source #

HasSpec a ⇒ HasGenHint (Tree a) Source # 
Instance details

Defined in Constrained.Spec.Tree

Associated Types

type Hint (Tree a) Source #

Methods

giveHintHint (Tree a) → Specification (Tree a) Source #

(Sized [a], HasSpec a) ⇒ HasGenHint [a] Source # 
Instance details

Defined in Constrained.TheKnot

Associated Types

type Hint [a] Source #

Methods

giveHintHint [a] → Specification [a] Source #

(Ord k, HasSpec k, HasSpec v, HasSpec [v], IsNormalType k, IsNormalType v) ⇒ HasGenHint (Map k v) Source # 
Instance details

Defined in Constrained.Spec.Map

Associated Types

type Hint (Map k v) Source #

Methods

giveHintHint (Map k v) → Specification (Map k v) Source #

class Sized t where Source #

Minimal complete definition

Nothing

Instances

Instances details
Ord a ⇒ Sized (Set a) Source # 
Instance details

Defined in Constrained.Spec.Set

Sized [a] Source # 
Instance details

Defined in Constrained.TheKnot

Ord a ⇒ Sized (Map a b) Source # 
Instance details

Defined in Constrained.Spec.Map

class (Num a, HasSpec a) ⇒ NumLike a where Source #

Minimal complete definition

Nothing

Methods

subtractSpec ∷ a → TypeSpec a → Specification a Source #

negateSpecTypeSpec a → Specification a Source #

safeSubtract ∷ a → a → Maybe a Source #

default safeSubtract ∷ (HasSimpleRep a, NumLike (SimpleRep a)) ⇒ a → a → Maybe a Source #

Instances

Instances details
Numeric a ⇒ NumLike a Source # 
Instance details

Defined in Constrained.NumOrd

type GenericallyInstantiated a = (AssertComputes (SimpleRep a) (((Text "Trying to use a generic instantiation of " :<>: ShowType a) :<>: Text ", likely in a HasSpec instance.") :$$: Text "However, the type has no definition of SimpleRep, likely because of a missing instance of HasSimpleRep."), HasSimpleRep a, HasSpec (SimpleRep a), TypeSpec a ~ TypeSpec (SimpleRep a)) Source #

class Show p ⇒ IsPred p Source #

Minimal complete definition

toPred

Instances

Instances details
IsPred Pred Source # 
Instance details

Defined in Constrained.Base

Methods

toPredPredPred Source #

IsPred Bool Source # 
Instance details

Defined in Constrained.Base

Methods

toPredBoolPred Source #

IsPred (Term Bool) Source # 
Instance details

Defined in Constrained.Base

Methods

toPredTerm BoolPred Source #

IsPred p ⇒ IsPred [p] Source # 
Instance details

Defined in Constrained.Base

Methods

toPred ∷ [p] → Pred Source #

class (Typeable t, Semantics t, Syntax t) ⇒ Logic t Source #

A First-order typed logic has 4 components 1. Terms (Variables (x), Constants (5), and Applications (F x 5) Applications, apply a function symbol to a list of arguments: (FunctionSymbol term1 .. termN) 2. Predicates (Ordered, Odd, ...) 3. Connectives (And, Or, Not, =>, ...) 4. Quantifiers (Forall, Exists)

The Syntax, Semantics, and Logic classes implement new function symbols in the first order logic. Note that a function symbol is first order data, that uniquely identifies a higher order function. The three classes supply varying levels of functionality, relating to the Syntax, Semantics, and Logical operations of the function symbol.

Logical operations are one that support reasoning about how a function symbol relates to logical properties, that we call Specification's

Minimal complete definition

propagate | propagateTypeSpec, propagateMemberSpec

Instances

Instances details
Logic BaseW Source # 
Instance details

Defined in Constrained.Base

Methods

propagateTypeSpec ∷ ∀ (as ∷ [Type]) b a. (AppRequires BaseW as b, HasSpec a) ⇒ BaseW as b → ListCtx Value as (HOLE a) → TypeSpec b → [b] → Specification a Source #

propagateMemberSpec ∷ ∀ (as ∷ [Type]) b a. (AppRequires BaseW as b, HasSpec a) ⇒ BaseW as b → ListCtx Value as (HOLE a) → NonEmpty b → Specification a Source #

propagate ∷ ∀ (as ∷ [Type]) b a. (AppRequires BaseW as b, HasSpec a) ⇒ BaseW as b → ListCtx Value as (HOLE a) → Specification b → Specification a Source #

rewriteRules ∷ ∀ (dom ∷ [Type]) rng. (TypeList dom, Typeable dom, HasSpec rng, All HasSpec dom) ⇒ BaseW dom rng → List Term dom → Evidence (AppRequires BaseW dom rng) → Maybe (Term rng) Source #

mapTypeSpec ∷ (HasSpec a, HasSpec b) ⇒ BaseW '[a] b → TypeSpec a → Specification b Source #

saturate ∷ ∀ (dom ∷ [Type]). BaseW dom BoolList Term dom → [Pred] Source #

Logic BoolW Source # 
Instance details

Defined in Constrained.Generation

Methods

propagateTypeSpec ∷ ∀ (as ∷ [Type]) b a. (AppRequires BoolW as b, HasSpec a) ⇒ BoolW as b → ListCtx Value as (HOLE a) → TypeSpec b → [b] → Specification a Source #

propagateMemberSpec ∷ ∀ (as ∷ [Type]) b a. (AppRequires BoolW as b, HasSpec a) ⇒ BoolW as b → ListCtx Value as (HOLE a) → NonEmpty b → Specification a Source #

propagate ∷ ∀ (as ∷ [Type]) b a. (AppRequires BoolW as b, HasSpec a) ⇒ BoolW as b → ListCtx Value as (HOLE a) → Specification b → Specification a Source #

rewriteRules ∷ ∀ (dom ∷ [Type]) rng. (TypeList dom, Typeable dom, HasSpec rng, All HasSpec dom) ⇒ BoolW dom rng → List Term dom → Evidence (AppRequires BoolW dom rng) → Maybe (Term rng) Source #

mapTypeSpec ∷ (HasSpec a, HasSpec b) ⇒ BoolW '[a] b → TypeSpec a → Specification b Source #

saturate ∷ ∀ (dom ∷ [Type]). BoolW dom BoolList Term dom → [Pred] Source #

Logic EqW Source # 
Instance details

Defined in Constrained.Generation

Methods

propagateTypeSpec ∷ ∀ (as ∷ [Type]) b a. (AppRequires EqW as b, HasSpec a) ⇒ EqW as b → ListCtx Value as (HOLE a) → TypeSpec b → [b] → Specification a Source #

propagateMemberSpec ∷ ∀ (as ∷ [Type]) b a. (AppRequires EqW as b, HasSpec a) ⇒ EqW as b → ListCtx Value as (HOLE a) → NonEmpty b → Specification a Source #

propagate ∷ ∀ (as ∷ [Type]) b a. (AppRequires EqW as b, HasSpec a) ⇒ EqW as b → ListCtx Value as (HOLE a) → Specification b → Specification a Source #

rewriteRules ∷ ∀ (dom ∷ [Type]) rng. (TypeList dom, Typeable dom, HasSpec rng, All HasSpec dom) ⇒ EqW dom rng → List Term dom → Evidence (AppRequires EqW dom rng) → Maybe (Term rng) Source #

mapTypeSpec ∷ (HasSpec a, HasSpec b) ⇒ EqW '[a] b → TypeSpec a → Specification b Source #

saturate ∷ ∀ (dom ∷ [Type]). EqW dom BoolList Term dom → [Pred] Source #

Logic SumW Source # 
Instance details

Defined in Constrained.Generation

Methods

propagateTypeSpec ∷ ∀ (as ∷ [Type]) b a. (AppRequires SumW as b, HasSpec a) ⇒ SumW as b → ListCtx Value as (HOLE a) → TypeSpec b → [b] → Specification a Source #

propagateMemberSpec ∷ ∀ (as ∷ [Type]) b a. (AppRequires SumW as b, HasSpec a) ⇒ SumW as b → ListCtx Value as (HOLE a) → NonEmpty b → Specification a Source #

propagate ∷ ∀ (as ∷ [Type]) b a. (AppRequires SumW as b, HasSpec a) ⇒ SumW as b → ListCtx Value as (HOLE a) → Specification b → Specification a Source #

rewriteRules ∷ ∀ (dom ∷ [Type]) rng. (TypeList dom, Typeable dom, HasSpec rng, All HasSpec dom) ⇒ SumW dom rng → List Term dom → Evidence (AppRequires SumW dom rng) → Maybe (Term rng) Source #

mapTypeSpec ∷ (HasSpec a, HasSpec b) ⇒ SumW '[a] b → TypeSpec a → Specification b Source #

saturate ∷ ∀ (dom ∷ [Type]). SumW dom BoolList Term dom → [Pred] Source #

Logic IntW Source #

Just a note that these instances won't work until we are in a context where there is a HasSpec instance of a, which (NumLike a) demands. This happens in Constrained.Experiment.TheKnot

Instance details

Defined in Constrained.NumOrd

Methods

propagateTypeSpec ∷ ∀ (as ∷ [Type]) b a. (AppRequires IntW as b, HasSpec a) ⇒ IntW as b → ListCtx Value as (HOLE a) → TypeSpec b → [b] → Specification a Source #

propagateMemberSpec ∷ ∀ (as ∷ [Type]) b a. (AppRequires IntW as b, HasSpec a) ⇒ IntW as b → ListCtx Value as (HOLE a) → NonEmpty b → Specification a Source #

propagate ∷ ∀ (as ∷ [Type]) b a. (AppRequires IntW as b, HasSpec a) ⇒ IntW as b → ListCtx Value as (HOLE a) → Specification b → Specification a Source #

rewriteRules ∷ ∀ (dom ∷ [Type]) rng. (TypeList dom, Typeable dom, HasSpec rng, All HasSpec dom) ⇒ IntW dom rng → List Term dom → Evidence (AppRequires IntW dom rng) → Maybe (Term rng) Source #

mapTypeSpec ∷ (HasSpec a, HasSpec b) ⇒ IntW '[a] b → TypeSpec a → Specification b Source #

saturate ∷ ∀ (dom ∷ [Type]). IntW dom BoolList Term dom → [Pred] Source #

Logic OrdW Source # 
Instance details

Defined in Constrained.NumOrd

Methods

propagateTypeSpec ∷ ∀ (as ∷ [Type]) b a. (AppRequires OrdW as b, HasSpec a) ⇒ OrdW as b → ListCtx Value as (HOLE a) → TypeSpec b → [b] → Specification a Source #

propagateMemberSpec ∷ ∀ (as ∷ [Type]) b a. (AppRequires OrdW as b, HasSpec a) ⇒ OrdW as b → ListCtx Value as (HOLE a) → NonEmpty b → Specification a Source #

propagate ∷ ∀ (as ∷ [Type]) b a. (AppRequires OrdW as b, HasSpec a) ⇒ OrdW as b → ListCtx Value as (HOLE a) → Specification b → Specification a Source #

rewriteRules ∷ ∀ (dom ∷ [Type]) rng. (TypeList dom, Typeable dom, HasSpec rng, All HasSpec dom) ⇒ OrdW dom rng → List Term dom → Evidence (AppRequires OrdW dom rng) → Maybe (Term rng) Source #

mapTypeSpec ∷ (HasSpec a, HasSpec b) ⇒ OrdW '[a] b → TypeSpec a → Specification b Source #

saturate ∷ ∀ (dom ∷ [Type]). OrdW dom BoolList Term dom → [Pred] Source #

Logic MapW Source # 
Instance details

Defined in Constrained.Spec.Map

Methods

propagateTypeSpec ∷ ∀ (as ∷ [Type]) b a. (AppRequires MapW as b, HasSpec a) ⇒ MapW as b → ListCtx Value as (HOLE a) → TypeSpec b → [b] → Specification a Source #

propagateMemberSpec ∷ ∀ (as ∷ [Type]) b a. (AppRequires MapW as b, HasSpec a) ⇒ MapW as b → ListCtx Value as (HOLE a) → NonEmpty b → Specification a Source #

propagate ∷ ∀ (as ∷ [Type]) b a. (AppRequires MapW as b, HasSpec a) ⇒ MapW as b → ListCtx Value as (HOLE a) → Specification b → Specification a Source #

rewriteRules ∷ ∀ (dom ∷ [Type]) rng. (TypeList dom, Typeable dom, HasSpec rng, All HasSpec dom) ⇒ MapW dom rng → List Term dom → Evidence (AppRequires MapW dom rng) → Maybe (Term rng) Source #

mapTypeSpec ∷ (HasSpec a, HasSpec b) ⇒ MapW '[a] b → TypeSpec a → Specification b Source #

saturate ∷ ∀ (dom ∷ [Type]). MapW dom BoolList Term dom → [Pred] Source #

Logic SetW Source # 
Instance details

Defined in Constrained.Spec.Set

Methods

propagateTypeSpec ∷ ∀ (as ∷ [Type]) b a. (AppRequires SetW as b, HasSpec a) ⇒ SetW as b → ListCtx Value as (HOLE a) → TypeSpec b → [b] → Specification a Source #

propagateMemberSpec ∷ ∀ (as ∷ [Type]) b a. (AppRequires SetW as b, HasSpec a) ⇒ SetW as b → ListCtx Value as (HOLE a) → NonEmpty b → Specification a Source #

propagate ∷ ∀ (as ∷ [Type]) b a. (AppRequires SetW as b, HasSpec a) ⇒ SetW as b → ListCtx Value as (HOLE a) → Specification b → Specification a Source #

rewriteRules ∷ ∀ (dom ∷ [Type]) rng. (TypeList dom, Typeable dom, HasSpec rng, All HasSpec dom) ⇒ SetW dom rng → List Term dom → Evidence (AppRequires SetW dom rng) → Maybe (Term rng) Source #

mapTypeSpec ∷ (HasSpec a, HasSpec b) ⇒ SetW '[a] b → TypeSpec a → Specification b Source #

saturate ∷ ∀ (dom ∷ [Type]). SetW dom BoolList Term dom → [Pred] Source #

Logic TreeW Source # 
Instance details

Defined in Constrained.Spec.Tree

Methods

propagateTypeSpec ∷ ∀ (as ∷ [Type]) b a. (AppRequires TreeW as b, HasSpec a) ⇒ TreeW as b → ListCtx Value as (HOLE a) → TypeSpec b → [b] → Specification a Source #

propagateMemberSpec ∷ ∀ (as ∷ [Type]) b a. (AppRequires TreeW as b, HasSpec a) ⇒ TreeW as b → ListCtx Value as (HOLE a) → NonEmpty b → Specification a Source #

propagate ∷ ∀ (as ∷ [Type]) b a. (AppRequires TreeW as b, HasSpec a) ⇒ TreeW as b → ListCtx Value as (HOLE a) → Specification b → Specification a Source #

rewriteRules ∷ ∀ (dom ∷ [Type]) rng. (TypeList dom, Typeable dom, HasSpec rng, All HasSpec dom) ⇒ TreeW dom rng → List Term dom → Evidence (AppRequires TreeW dom rng) → Maybe (Term rng) Source #

mapTypeSpec ∷ (HasSpec a, HasSpec b) ⇒ TreeW '[a] b → TypeSpec a → Specification b Source #

saturate ∷ ∀ (dom ∷ [Type]). TreeW dom BoolList Term dom → [Pred] Source #

Logic ElemW Source # 
Instance details

Defined in Constrained.TheKnot

Methods

propagateTypeSpec ∷ ∀ (as ∷ [Type]) b a. (AppRequires ElemW as b, HasSpec a) ⇒ ElemW as b → ListCtx Value as (HOLE a) → TypeSpec b → [b] → Specification a Source #

propagateMemberSpec ∷ ∀ (as ∷ [Type]) b a. (AppRequires ElemW as b, HasSpec a) ⇒ ElemW as b → ListCtx Value as (HOLE a) → NonEmpty b → Specification a Source #

propagate ∷ ∀ (as ∷ [Type]) b a. (AppRequires ElemW as b, HasSpec a) ⇒ ElemW as b → ListCtx Value as (HOLE a) → Specification b → Specification a Source #

rewriteRules ∷ ∀ (dom ∷ [Type]) rng. (TypeList dom, Typeable dom, HasSpec rng, All HasSpec dom) ⇒ ElemW dom rng → List Term dom → Evidence (AppRequires ElemW dom rng) → Maybe (Term rng) Source #

mapTypeSpec ∷ (HasSpec a, HasSpec b) ⇒ ElemW '[a] b → TypeSpec a → Specification b Source #

saturate ∷ ∀ (dom ∷ [Type]). ElemW dom BoolList Term dom → [Pred] Source #

Logic FunW Source # 
Instance details

Defined in Constrained.TheKnot

Methods

propagateTypeSpec ∷ ∀ (as ∷ [Type]) b a. (AppRequires FunW as b, HasSpec a) ⇒ FunW as b → ListCtx Value as (HOLE a) → TypeSpec b → [b] → Specification a Source #

propagateMemberSpec ∷ ∀ (as ∷ [Type]) b a. (AppRequires FunW as b, HasSpec a) ⇒ FunW as b → ListCtx Value as (HOLE a) → NonEmpty b → Specification a Source #

propagate ∷ ∀ (as ∷ [Type]) b a. (AppRequires FunW as b, HasSpec a) ⇒ FunW as b → ListCtx Value as (HOLE a) → Specification b → Specification a Source #

rewriteRules ∷ ∀ (dom ∷ [Type]) rng. (TypeList dom, Typeable dom, HasSpec rng, All HasSpec dom) ⇒ FunW dom rng → List Term dom → Evidence (AppRequires FunW dom rng) → Maybe (Term rng) Source #

mapTypeSpec ∷ (HasSpec a, HasSpec b) ⇒ FunW '[a] b → TypeSpec a → Specification b Source #

saturate ∷ ∀ (dom ∷ [Type]). FunW dom BoolList Term dom → [Pred] Source #

Logic ListW Source # 
Instance details

Defined in Constrained.TheKnot

Methods

propagateTypeSpec ∷ ∀ (as ∷ [Type]) b a. (AppRequires ListW as b, HasSpec a) ⇒ ListW as b → ListCtx Value as (HOLE a) → TypeSpec b → [b] → Specification a Source #

propagateMemberSpec ∷ ∀ (as ∷ [Type]) b a. (AppRequires ListW as b, HasSpec a) ⇒ ListW as b → ListCtx Value as (HOLE a) → NonEmpty b → Specification a Source #

propagate ∷ ∀ (as ∷ [Type]) b a. (AppRequires ListW as b, HasSpec a) ⇒ ListW as b → ListCtx Value as (HOLE a) → Specification b → Specification a Source #

rewriteRules ∷ ∀ (dom ∷ [Type]) rng. (TypeList dom, Typeable dom, HasSpec rng, All HasSpec dom) ⇒ ListW dom rng → List Term dom → Evidence (AppRequires ListW dom rng) → Maybe (Term rng) Source #

mapTypeSpec ∷ (HasSpec a, HasSpec b) ⇒ ListW '[a] b → TypeSpec a → Specification b Source #

saturate ∷ ∀ (dom ∷ [Type]). ListW dom BoolList Term dom → [Pred] Source #

Logic ProdW Source # 
Instance details

Defined in Constrained.TheKnot

Methods

propagateTypeSpec ∷ ∀ (as ∷ [Type]) b a. (AppRequires ProdW as b, HasSpec a) ⇒ ProdW as b → ListCtx Value as (HOLE a) → TypeSpec b → [b] → Specification a Source #

propagateMemberSpec ∷ ∀ (as ∷ [Type]) b a. (AppRequires ProdW as b, HasSpec a) ⇒ ProdW as b → ListCtx Value as (HOLE a) → NonEmpty b → Specification a Source #

propagate ∷ ∀ (as ∷ [Type]) b a. (AppRequires ProdW as b, HasSpec a) ⇒ ProdW as b → ListCtx Value as (HOLE a) → Specification b → Specification a Source #

rewriteRules ∷ ∀ (dom ∷ [Type]) rng. (TypeList dom, Typeable dom, HasSpec rng, All HasSpec dom) ⇒ ProdW dom rng → List Term dom → Evidence (AppRequires ProdW dom rng) → Maybe (Term rng) Source #

mapTypeSpec ∷ (HasSpec a, HasSpec b) ⇒ ProdW '[a] b → TypeSpec a → Specification b Source #

saturate ∷ ∀ (dom ∷ [Type]). ProdW dom BoolList Term dom → [Pred] Source #

Logic SizeW Source # 
Instance details

Defined in Constrained.TheKnot

Methods

propagateTypeSpec ∷ ∀ (as ∷ [Type]) b a. (AppRequires SizeW as b, HasSpec a) ⇒ SizeW as b → ListCtx Value as (HOLE a) → TypeSpec b → [b] → Specification a Source #

propagateMemberSpec ∷ ∀ (as ∷ [Type]) b a. (AppRequires SizeW as b, HasSpec a) ⇒ SizeW as b → ListCtx Value as (HOLE a) → NonEmpty b → Specification a Source #

propagate ∷ ∀ (as ∷ [Type]) b a. (AppRequires SizeW as b, HasSpec a) ⇒ SizeW as b → ListCtx Value as (HOLE a) → Specification b → Specification a Source #

rewriteRules ∷ ∀ (dom ∷ [Type]) rng. (TypeList dom, Typeable dom, HasSpec rng, All HasSpec dom) ⇒ SizeW dom rng → List Term dom → Evidence (AppRequires SizeW dom rng) → Maybe (Term rng) Source #

mapTypeSpec ∷ (HasSpec a, HasSpec b) ⇒ SizeW '[a] b → TypeSpec a → Specification b Source #

saturate ∷ ∀ (dom ∷ [Type]). SizeW dom BoolList Term dom → [Pred] Source #

class Semantics (t ∷ [Type] → TypeType) Source #

Semantic operations are ones that give the function symbol, meaning as a function. I.e. how to apply the function to a list of arguments and return a value.

Minimal complete definition

semantics

Instances

Instances details
Semantics BaseW Source # 
Instance details

Defined in Constrained.Base

Methods

semantics ∷ ∀ (d ∷ [Type]) r. BaseW d r → FunTy d r Source #

Semantics BoolW Source # 
Instance details

Defined in Constrained.Generation

Methods

semantics ∷ ∀ (d ∷ [Type]) r. BoolW d r → FunTy d r Source #

Semantics EqW Source # 
Instance details

Defined in Constrained.Generation

Methods

semantics ∷ ∀ (d ∷ [Type]) r. EqW d r → FunTy d r Source #

Semantics SumW Source # 
Instance details

Defined in Constrained.Generation

Methods

semantics ∷ ∀ (d ∷ [Type]) r. SumW d r → FunTy d r Source #

Semantics IntW Source # 
Instance details

Defined in Constrained.NumOrd

Methods

semantics ∷ ∀ (d ∷ [Type]) r. IntW d r → FunTy d r Source #

Semantics OrdW Source # 
Instance details

Defined in Constrained.NumOrd

Methods

semantics ∷ ∀ (d ∷ [Type]) r. OrdW d r → FunTy d r Source #

Semantics MapW Source # 
Instance details

Defined in Constrained.Spec.Map

Methods

semantics ∷ ∀ (d ∷ [Type]) r. MapW d r → FunTy d r Source #

Semantics SetW Source # 
Instance details

Defined in Constrained.Spec.Set

Methods

semantics ∷ ∀ (d ∷ [Type]) r. SetW d r → FunTy d r Source #

Semantics TreeW Source # 
Instance details

Defined in Constrained.Spec.Tree

Methods

semantics ∷ ∀ (d ∷ [Type]) r. TreeW d r → FunTy d r Source #

Semantics ElemW Source # 
Instance details

Defined in Constrained.TheKnot

Methods

semantics ∷ ∀ (d ∷ [Type]) r. ElemW d r → FunTy d r Source #

Semantics FunW Source # 
Instance details

Defined in Constrained.TheKnot

Methods

semantics ∷ ∀ (d ∷ [Type]) r. FunW d r → FunTy d r Source #

Semantics ListW Source # 
Instance details

Defined in Constrained.TheKnot

Methods

semantics ∷ ∀ (d ∷ [Type]) r. ListW d r → FunTy d r Source #

Semantics ProdW Source # 
Instance details

Defined in Constrained.TheKnot

Methods

semantics ∷ ∀ (d ∷ [Type]) r. ProdW d r → FunTy d r Source #

Semantics SizeW Source # 
Instance details

Defined in Constrained.TheKnot

Methods

semantics ∷ ∀ (d ∷ [Type]) r. SizeW d r → FunTy d r Source #

class Syntax (t ∷ [Type] → TypeType) Source #

Syntactic operations are ones that have to do with the structure and appearence of the type. See DependencyInjection to better understand deps - it's a pointer to postpone having to define HasSpec and friends here.

Instances

Instances details
Syntax BaseW Source # 
Instance details

Defined in Constrained.Base

Methods

isInfix ∷ ∀ (dom ∷ [Type]) rng. BaseW dom rng → Bool Source #

prettySymbol ∷ ∀ deps (dom ∷ [Type]) rng ann. BaseW dom rng → List (TermD deps) dom → IntMaybe (Doc ann) Source #

Syntax BoolW Source # 
Instance details

Defined in Constrained.Generation

Methods

isInfix ∷ ∀ (dom ∷ [Type]) rng. BoolW dom rng → Bool Source #

prettySymbol ∷ ∀ deps (dom ∷ [Type]) rng ann. BoolW dom rng → List (TermD deps) dom → IntMaybe (Doc ann) Source #

Syntax EqW Source # 
Instance details

Defined in Constrained.Generation

Methods

isInfix ∷ ∀ (dom ∷ [Type]) rng. EqW dom rng → Bool Source #

prettySymbol ∷ ∀ deps (dom ∷ [Type]) rng ann. EqW dom rng → List (TermD deps) dom → IntMaybe (Doc ann) Source #

Syntax SumW Source # 
Instance details

Defined in Constrained.Generation

Methods

isInfix ∷ ∀ (dom ∷ [Type]) rng. SumW dom rng → Bool Source #

prettySymbol ∷ ∀ deps (dom ∷ [Type]) rng ann. SumW dom rng → List (TermD deps) dom → IntMaybe (Doc ann) Source #

Syntax IntW Source # 
Instance details

Defined in Constrained.NumOrd

Methods

isInfix ∷ ∀ (dom ∷ [Type]) rng. IntW dom rng → Bool Source #

prettySymbol ∷ ∀ deps (dom ∷ [Type]) rng ann. IntW dom rng → List (TermD deps) dom → IntMaybe (Doc ann) Source #

Syntax OrdW Source # 
Instance details

Defined in Constrained.NumOrd

Methods

isInfix ∷ ∀ (dom ∷ [Type]) rng. OrdW dom rng → Bool Source #

prettySymbol ∷ ∀ deps (dom ∷ [Type]) rng ann. OrdW dom rng → List (TermD deps) dom → IntMaybe (Doc ann) Source #

Syntax MapW Source # 
Instance details

Defined in Constrained.Spec.Map

Methods

isInfix ∷ ∀ (dom ∷ [Type]) rng. MapW dom rng → Bool Source #

prettySymbol ∷ ∀ deps (dom ∷ [Type]) rng ann. MapW dom rng → List (TermD deps) dom → IntMaybe (Doc ann) Source #

Syntax SetW Source # 
Instance details

Defined in Constrained.Spec.Set

Methods

isInfix ∷ ∀ (dom ∷ [Type]) rng. SetW dom rng → Bool Source #

prettySymbol ∷ ∀ deps (dom ∷ [Type]) rng ann. SetW dom rng → List (TermD deps) dom → IntMaybe (Doc ann) Source #

Syntax TreeW Source # 
Instance details

Defined in Constrained.Spec.Tree

Methods

isInfix ∷ ∀ (dom ∷ [Type]) rng. TreeW dom rng → Bool Source #

prettySymbol ∷ ∀ deps (dom ∷ [Type]) rng ann. TreeW dom rng → List (TermD deps) dom → IntMaybe (Doc ann) Source #

Syntax ElemW Source # 
Instance details

Defined in Constrained.TheKnot

Methods

isInfix ∷ ∀ (dom ∷ [Type]) rng. ElemW dom rng → Bool Source #

prettySymbol ∷ ∀ deps (dom ∷ [Type]) rng ann. ElemW dom rng → List (TermD deps) dom → IntMaybe (Doc ann) Source #

Syntax FunW Source # 
Instance details

Defined in Constrained.TheKnot

Methods

isInfix ∷ ∀ (dom ∷ [Type]) rng. FunW dom rng → Bool Source #

prettySymbol ∷ ∀ deps (dom ∷ [Type]) rng ann. FunW dom rng → List (TermD deps) dom → IntMaybe (Doc ann) Source #

Syntax ListW Source # 
Instance details

Defined in Constrained.TheKnot

Methods

isInfix ∷ ∀ (dom ∷ [Type]) rng. ListW dom rng → Bool Source #

prettySymbol ∷ ∀ deps (dom ∷ [Type]) rng ann. ListW dom rng → List (TermD deps) dom → IntMaybe (Doc ann) Source #

Syntax ProdW Source # 
Instance details

Defined in Constrained.TheKnot

Methods

isInfix ∷ ∀ (dom ∷ [Type]) rng. ProdW dom rng → Bool Source #

prettySymbol ∷ ∀ deps (dom ∷ [Type]) rng ann. ProdW dom rng → List (TermD deps) dom → IntMaybe (Doc ann) Source #

Syntax SizeW Source # 
Instance details

Defined in Constrained.TheKnot

Methods

isInfix ∷ ∀ (dom ∷ [Type]) rng. SizeW dom rng → Bool Source #

prettySymbol ∷ ∀ deps (dom ∷ [Type]) rng ann. SizeW dom rng → List (TermD deps) dom → IntMaybe (Doc ann) Source #

type IsNormalType a = (AssertComputes (Cases a) (Text "Failed to compute Cases in a use of IsNormalType for " :$$: (ShowType a :<>: Text ", are you missing an IsNormalType constraint?")), Cases a ~ '[a], AssertComputes (Args a) ((Text "Failed to compute Args in a use of IsNormalType for " :<>: ShowType a) :<>: Text ", are you missing an IsNormalType constraint?"), Args a ~ '[a], IsProd a, CountCases a ~ 1) Source #

Core syntax

constrained ∷ ∀ a p. (IsPred p, HasSpec a) ⇒ (Term a → p) → Specification a Source #

constrained' ∷ ∀ a p. (Cases (SimpleRep a) ~ '[SimpleRep a], TypeSpec a ~ TypeSpec (SimpleRep a), HasSpec (SimpleRep a), HasSimpleRep a, All HasSpec (Args (SimpleRep a)), IsProd (SimpleRep a), HasSpec a, IsProductType a, IsPred p, GenericRequires a, ProdAsListComputes a) ⇒ FunTy (MapList Term (ProductAsList a)) p → Specification a Source #

Like constrained but pattern matches on the bound `Term a`

match ∷ ∀ p a. (IsProductType a, IsPred p, GenericRequires a, ProdAsListComputes a) ⇒ Term a → FunTy (MapList Term (ProductAsList a)) p → Pred Source #

letBind ∷ (HasSpec a, IsPred p) ⇒ Term a → (Term a → p) → Pred Source #

assertIsPred p ⇒ p → Pred Source #

assertReifiedHasSpec a ⇒ Term a → (a → Bool) → Pred Source #

forAll ∷ ∀ p t a. (Forallable t a, HasSpec t, HasSpec a, IsPred p) ⇒ Term t → (Term a → p) → Pred Source #

forAll' ∷ ∀ t a p. (Forallable t a, Cases (SimpleRep a) ~ '[SimpleRep a], TypeSpec a ~ TypeSpec (SimpleRep a), HasSpec t, HasSpec (SimpleRep a), HasSimpleRep a, All HasSpec (Args (SimpleRep a)), IsPred p, IsProd (SimpleRep a), IsProductType a, HasSpec a, GenericRequires a, ProdAsListComputes a) ⇒ Term t → FunTy (MapList Term (ProductAsList a)) p → Pred Source #

Like forAll but pattern matches on the `Term a`

exists ∷ ∀ a p. (HasSpec a, IsPred p) ⇒ ((∀ b. Term b → b) → GE a) → (Term a → p) → Pred Source #

unsafeExists ∷ ∀ a p. (HasSpec a, IsPred p) ⇒ (Term a → p) → Pred Source #

whenTrue ∷ ∀ p. IsPred p ⇒ Term Bool → p → Pred Source #

ifElse ∷ (IsPred p, IsPred q) ⇒ Term Bool → p → q → Pred Source #

If the `Specification Bool` doesn't constrain the boolean you will get a TrueSpec out.

dependsOn ∷ (HasSpec a, HasSpec b) ⇒ Term a → Term b → Pred Source #

reify ∷ (HasSpec a, HasSpec b, IsPred p) ⇒ Term a → (a → b) → (Term b → p) → Pred Source #

reify' ∷ ∀ a b p. (Cases (SimpleRep b) ~ '[SimpleRep b], TypeSpec b ~ TypeSpec (SimpleRep b), HasSpec (SimpleRep b), HasSimpleRep b, All HasSpec (Args (SimpleRep b)), IsProd (SimpleRep b), HasSpec a, HasSpec b, IsProductType b, IsProd a, IsPred p, GenericRequires b, ProdAsListComputes b) ⇒ Term a → (a → b) → FunTy (MapList Term (ProductAsList b)) p → Pred Source #

Like reify but pattern matches on the bound `Term b`

reifies ∷ (HasSpec a, HasSpec b) ⇒ Term b → Term a → (a → b) → Pred Source #

explanationNonEmpty StringPredPred Source #

Wrap an Explain around a Pred, unless there is a simpler form.

monitor ∷ ((∀ a. Term a → a) → PropertyProperty) → Pred Source #

Add QuickCheck monitoring (e.g. collect or counterexample) to a predicate. To use the monitoring in a property call monitorSpec on the Specification containing the monitoring and a value generated from the specification.

genHint ∷ ∀ t. HasGenHint t ⇒ Hint t → Term t → Pred Source #

caseOn ∷ ∀ a. (GenericRequires a, SimpleRep a ~ SumOver (Cases (SimpleRep a)), TypeList (Cases (SimpleRep a))) ⇒ Term a → FunTy (MapList (Weighted Binder) (Cases (SimpleRep a))) Pred Source #

branch ∷ ∀ p a. (HasSpec a, All HasSpec (Args a), IsPred p, IsProd a) ⇒ FunTy (MapList Term (Args a)) p → Weighted Binder a Source #

branchW ∷ ∀ p a. (HasSpec a, All HasSpec (Args a), IsPred p, IsProd a) ⇒ IntFunTy (MapList Term (Args a)) p → Weighted Binder a Source #

onCon ∷ ∀ c a p. (IsConstrOf c (ProdOver (ConstrOf c (TheSop a))) (TheSop a), GenericRequires a, SumOver (Cases (SOP (TheSop a))) ~ SimpleRep a, All HasSpec (Cases (SOP (TheSop a))), HasSpec (ProdOver (ConstrOf c (TheSop a))), IsPred p, Args (ProdOver (ConstrOf c (TheSop a))) ~ ConstrOf c (TheSop a), All HasSpec (ConstrOf c (TheSop a)), IsProd (ProdOver (ConstrOf c (TheSop a)))) ⇒ Term a → FunTy (MapList Term (ConstrOf c (TheSop a))) p → Pred Source #

isCon ∷ ∀ c a. (IsConstrOf c (ProdOver (ConstrOf c (TheSop a))) (TheSop a), SumOver (Cases (SOP (TheSop a))) ~ SimpleRep a, All HasSpec (Cases (SOP (TheSop a))), HasSpec (ProdOver (ConstrOf c (TheSop a))), GenericRequires a) ⇒ Term a → Pred Source #

onJust ∷ ∀ a p. (HasSpec a, IsNormalType a, IsPred p) ⇒ Term (Maybe a) → (Term a → p) → Pred Source #

isJust ∷ ∀ a. (HasSpec a, IsNormalType a) ⇒ Term (Maybe a) → Pred Source #

litHasSpec a ⇒ a → Term a Source #

con ∷ ∀ c a r. (SimpleRep a ~ SOP (TheSop a), TypeSpec a ~ TypeSpec (SOP (TheSop a)), TypeList (ConstrOf c (TheSop a)), r ~ FunTy (MapList Term (ConstrOf c (TheSop a))) (Term a), ResultType r ~ Term a, SOPTerm c (TheSop a), ConstrTerm (ConstrOf c (TheSop a)), GenericRequires a) ⇒ r Source #

sel ∷ ∀ n a c as. (SimpleRep a ~ ProdOver as, TheSop a ~ '[c ::: as], TypeSpec a ~ TypeSpec (ProdOver as), Select n as, HasSpec a, HasSpec (ProdOver as), HasSimpleRep a, GenericRequires a) ⇒ Term a → Term (At n as) Source #

nameStringTerm a → Term a Source #

Function symbols

Numbers

(<.) ∷ ∀ a. OrdLike a ⇒ Term a → Term a → Term Bool infixr 4 Source #

(<=.) ∷ ∀ a. OrdLike a ⇒ Term a → Term a → Term Bool infixr 4 Source #

(>=.) ∷ ∀ a. OrdLike a ⇒ Term a → Term a → Term Bool infixr 4 Source #

(>.) ∷ ∀ a. OrdLike a ⇒ Term a → Term a → Term Bool infixr 4 Source #

(==.)HasSpec a ⇒ Term a → Term a → Term Bool infix 4 Source #

(/=.)HasSpec a ⇒ Term a → Term a → Term Bool infix 4 Source #

(+.)NumLike a ⇒ Term a → Term a → Term a infix 4 Source #

(-.)Numeric n ⇒ Term n → Term n → Term n infix 4 Source #

negate_NumLike a ⇒ Term a → Term a Source #

Booleans

(||.)Term BoolTerm BoolTerm Bool infixr 2 Source #

Pairs

pair_ ∷ (HasSpec a, HasSpec b, IsNormalType a, IsNormalType b) ⇒ Term a → Term b → Term (a, b) Source #

fst_ ∷ (HasSpec x, HasSpec y) ⇒ Term (x, y) → Term x Source #

snd_ ∷ (HasSpec x, HasSpec y) ⇒ Term (x, y) → Term y Source #

Either

Maybe

just_ ∷ (HasSpec a, IsNormalType a) ⇒ Term a → Term (Maybe a) Source #

Higher-order functions

id_ ∷ ∀ a. HasSpec a ⇒ Term a → Term a Source #

flip_ ∷ ∀ (t ∷ [Type] → TypeType) a b r. (HasSpec b, HasSpec a, AppRequires t '[a, b] r) ⇒ t '[a, b] r → Term b → Term a → Term r Source #

compose_ ∷ ∀ b t1 t2 a r. (AppRequires t1 '[b] r, AppRequires t2 '[a] b) ⇒ t1 '[b] r → t2 '[a] b → Term a → Term r Source #

List

foldMap_ ∷ ∀ a b. (Foldy b, HasSpec a) ⇒ (Term a → Term b) → Term [a] → Term b Source #

sum_Foldy a ⇒ Term [a] → Term a Source #

elem_ ∷ (Sized [a], HasSpec a) ⇒ Term a → Term [a] → Term Bool infix 4 Source #

singletonList_ ∷ (Sized [a], HasSpec a) ⇒ Term a → Term [a] Source #

append_ ∷ (Sized [a], HasSpec a) ⇒ Term [a] → Term [a] → Term [a] Source #

(++.)HasSpec a ⇒ Term [a] → Term [a] → Term [a] infixr 5 Source #

sizeOf_ ∷ (HasSpec a, Sized a) ⇒ Term a → Term Integer Source #

null_ ∷ (HasSpec a, Sized a) ⇒ Term a → Term Bool Source #

length_HasSpec a ⇒ Term [a] → Term Integer Source #

Set

singleton_ ∷ (Ord a, HasSpec a) ⇒ Term a → Term (Set a) Source #

member_ ∷ (Ord a, HasSpec a) ⇒ Term a → Term (Set a) → Term Bool Source #

union_ ∷ (Ord a, HasSpec a) ⇒ Term (Set a) → Term (Set a) → Term (Set a) Source #

subset_ ∷ (Ord a, HasSpec a) ⇒ Term (Set a) → Term (Set a) → Term Bool Source #

disjoint_ ∷ (Ord a, HasSpec a) ⇒ Term (Set a) → Term (Set a) → Term Bool Source #

fromList_ ∷ ∀ a. (Ord a, HasSpec a) ⇒ Term [a] → Term (Set a) Source #

Map

dom_ ∷ (HasSpec (Map k v), HasSpec v, HasSpec k, Ord k, IsNormalType k, IsNormalType v) ⇒ Term (Map k v) → Term (Set k) Source #

rng_ ∷ (HasSpec k, HasSpec v, Ord k, IsNormalType k, IsNormalType v) ⇒ Term (Map k v) → Term [v] Source #

lookup_ ∷ (HasSpec k, HasSpec v, Ord k, IsNormalType k, IsNormalType v) ⇒ Term k → Term (Map k v) → Term (Maybe v) Source #

mapMember_ ∷ (HasSpec k, HasSpec v, Ord k, IsNormalType k, IsNormalType v) ⇒ Term k → Term (Map k v) → Term Bool Source #

rootLabel_ ∷ ∀ a. HasSpec a ⇒ Term (Tree a) → Term a Source #

Generics

toGeneric_ ∷ ∀ a. GenericRequires a ⇒ Term a → Term (SimpleRep a) Source #

Composing specifications

satisfies ∷ ∀ a. HasSpec a ⇒ Term a → Specification a → Pred Source #

chooseSpecHasSpec a ⇒ (Int, Specification a) → (Int, Specification a) → Specification a Source #

ChooseSpec is one of the ways we can Or two Specs together This works for any kind of type that has a HasSpec instance. If your type is a Sum type. One can use CaseOn which is much easier.

notEqualSpec ∷ ∀ a. HasSpec a ⇒ a → Specification a Source #

notMemberSpec ∷ ∀ a f. (HasSpec a, Foldable f) ⇒ f a → Specification a Source #

between ∷ (HasSpec a, TypeSpec a ~ NumSpec a) ⇒ a → a → Specification a Source #

defaultMapSpecOrd k ⇒ MapSpec k v Source #

emptySpec without all the constraints

Generation, Shrinking, and Testing

Generating

genFromSpec ∷ ∀ a. (HasCallStack, HasSpec a) ⇒ Specification a → Gen a Source #

A version of genFromSpecT that simply errors if the generator fails

genFromSpecT ∷ ∀ a m. (HasCallStack, HasSpec a, MonadGenError m) ⇒ Specification a → GenT m a Source #

Generate a value that satisfies the spec. This function can fail if the spec is inconsistent, there is a dependency error, or if the underlying generators are not flexible enough.

genFromSpecWithSeed ∷ ∀ a. (HasCallStack, HasSpec a) ⇒ IntIntSpecification a → a Source #

A version of genFromSpecT that takes a seed and a size and gives you a result

genFromSizeSpecMonadGenError m ⇒ Specification IntegerGenT 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

Shrinking

shrinkWithSpec ∷ ∀ a. HasSpec a ⇒ Specification a → a → [a] Source #

Debugging

debugSpec ∷ ∀ a. HasSpec a ⇒ Specification a → IO () Source #

A version of genFromSpecT that runs in the IO monad. Good for debugging.

Testing

conformsToSpecE ∷ ∀ a. HasSpec a ⇒ a → Specification a → NonEmpty StringMaybe (NonEmpty String) Source #

conformsToSpec with explanation. Nothing if (conformsToSpec a spec), but (Just explanations) if not(conformsToSpec a spec).

conformsToSpecProp ∷ ∀ a. HasSpec a ⇒ a → Specification a → Property Source #

Like Constrained.Conformance.conformsToSpec but in Test.QuickCheck.Property form.

Building properties

monitorSpecTestable p ⇒ Specification a → a → p → Property Source #

Collect the monitor calls from a specification instantiated to the given value. Typically,

quickCheck $ forAll (genFromSpec spec) $ \ x -> monitorSpec spec x $ ...

forAllSpec ∷ (HasSpec a, Testable p) ⇒ Specification a → (a → p) → Property Source #

Quanitfy over a Constrained.Base.Specification.

forAllSpecShow ∷ (HasSpec a, Testable p) ⇒ Specification a → (a → String) → (a → p) → Property Source #

forAllSpecDiscard ∷ (HasSpec a, Testable p) ⇒ Specification a → (a → p) → Property Source #

Quanitfy over a Constrained.Base.Specification and discard any test where generation fails.