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

Test.Minimal.Syntax

Synopsis

Documentation

forAll ∷ (Container t a, HasSpec t, HasSpec a) ⇒ Term t → (Term a → Pred) → Pred Source #

mkForAll ∷ (Container t a, HasSpec t, HasSpec a) ⇒ Term t → Binder a → Pred Source #

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

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

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

isErrorLike ∷ ∀ a. Spec a → Bool Source #

handleErrorsSpec a → Spec b → (Spec a → Spec b → Spec c) → Spec c Source #

Given two Spec, return an ErrorSpec if one or more is an ErrorSpec If neither is an ErrorSpec apply the continuation f

addToErrorSpecNonEmpty StringSpec a → Spec a Source #

Add the explanations, if it's an ErrorSpec, else drop them

memberSpecList ∷ [a] → NonEmpty StringSpec a Source #

return a MemberSpec or ans ErrorSpec depending on if xs the null list or not

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

runTermE ∷ ∀ a. EnvTerm a → Either (NonEmpty String) a Source #

runTermMonadGenError m ⇒ EnvTerm a → m a Source #

conformsToSpec ∷ ∀ a. HasSpec a ⇒ a → Spec a → Bool Source #

runCaseOnEither a b → Binder a → Binder b → (∀ x. HasSpec x ⇒ Var x → x → Pred → r) → r Source #

checkPredsENonEmpty StringEnv → [Pred] → Maybe (NonEmpty String) Source #

Like checkPred, But it takes [Pred] rather than a single Pred, and it builds a much more involved explanation if it fails. Does the Pred evaluate to True under the given Env? If it doesn't, an involved explanation appears in the (Just message) If it does, then it returns Nothing

data Name where Source #

Constructors

NameHasSpec a ⇒ Var a → Name 

Instances

Instances details
Show Name Source # 
Instance details

Defined in Test.Minimal.Syntax

Methods

showsPrecIntNameShowS #

showNameString #

showList ∷ [Name] → ShowS #

Rename Name Source # 
Instance details

Defined in Test.Minimal.Syntax

Methods

renameTypeable x ⇒ Var x → Var x → NameName Source #

HasVariables Name Source # 
Instance details

Defined in Test.Minimal.Syntax

Eq Name Source # 
Instance details

Defined in Test.Minimal.Syntax

Methods

(==)NameNameBool #

(/=)NameNameBool #

Ord Name Source # 
Instance details

Defined in Test.Minimal.Syntax

Methods

compareNameNameOrdering #

(<)NameNameBool #

(<=)NameNameBool #

(>)NameNameBool #

(>=)NameNameBool #

maxNameNameName #

minNameNameName #

Pretty Name Source # 
Instance details

Defined in Test.Minimal.Syntax

Methods

prettyNameDoc ann Source #

prettyList ∷ [Name] → Doc ann Source #

freeVarNames ∷ ∀ t. HasVariables t ⇒ t → Set Int Source #

newtype FreeVars Source #

Constructors

FreeVars 

Fields

Instances

Instances details
Monoid FreeVars Source # 
Instance details

Defined in Test.Minimal.Syntax

Semigroup FreeVars Source # 
Instance details

Defined in Test.Minimal.Syntax

Show FreeVars Source # 
Instance details

Defined in Test.Minimal.Syntax

Methods

showsPrecIntFreeVarsShowS #

showFreeVarsString #

showList ∷ [FreeVars] → ShowS #

class HasVariables a where Source #

Minimal complete definition

freeVars

Methods

freeVars ∷ a → FreeVars Source #

freeVarSet ∷ a → Set Name Source #

countOfName → a → Int Source #

appearsInName → a → Bool Source #

Instances

Instances details
HasVariables Pred Source # 
Instance details

Defined in Test.Minimal.Syntax

HasVariables Name Source # 
Instance details

Defined in Test.Minimal.Syntax

HasVariables (Binder a) Source # 
Instance details

Defined in Test.Minimal.Syntax

HasVariables (Term a) Source # 
Instance details

Defined in Test.Minimal.Syntax

Methods

freeVarsTerm a → FreeVars Source #

freeVarSetTerm a → Set Name Source #

countOfNameTerm a → Int Source #

appearsInNameTerm a → Bool Source #

HasVariables a ⇒ HasVariables (Set a) Source # 
Instance details

Defined in Test.Minimal.Syntax

Methods

freeVarsSet a → FreeVars Source #

freeVarSetSet a → Set Name Source #

countOfNameSet a → Int Source #

appearsInNameSet a → Bool Source #

(Foldable t, HasVariables a) ⇒ HasVariables (t a) Source # 
Instance details

Defined in Test.Minimal.Syntax

Methods

freeVars ∷ t a → FreeVars Source #

freeVarSet ∷ t a → Set Name Source #

countOfName → t a → Int Source #

appearsInName → t a → Bool Source #

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

Defined in Test.Minimal.Syntax

Methods

freeVars ∷ (a, b) → FreeVars Source #

freeVarSet ∷ (a, b) → Set Name Source #

countOfName → (a, b) → Int Source #

appearsInName → (a, b) → Bool Source #

HasVariables (List Term as) Source # 
Instance details

Defined in Test.Minimal.Syntax

fromLitTerm a → Maybe (Value a) Source #

isLitTerm a → Bool Source #

data SubstEntry where Source #

Constructors

(:=)HasSpec a ⇒ Var a → Term a → SubstEntry 

backwardsSubstitution ∷ ∀ a. HasSpec a ⇒ SubstTerm a → Term a Source #

fastInequalityTerm a → Term b → Bool Source #

Sound but not complete inequality on terms

substituteTerm ∷ ∀ a. SubstTerm a → Term a Source #

substituteTerm' ∷ ∀ a. SubstTerm a → Writer Any (Term a) Source #

substituteBinderHasSpec a ⇒ Var a → Term a → Binder b → Binder b Source #

substitutePredHasSpec a ⇒ Var a → Term a → PredPred Source #

substTermEnvTerm a → Term a Source #

substSpecEnvSpec a → Spec a Source #

unBind ∷ a → Binder a → Pred Source #

regularizeHasVariables t ⇒ Var a → t → Var a Source #

substituteAndSimplifyTermSubstTerm a → Term a Source #

Apply a substitution and simplify the resulting term if the substitution changed the term.

simplifyTerm ∷ ∀ a. Term a → Term a Source #

Simplify a Term, if the Term is an App, apply the rewrite rules chosen by the (Semantics t) instance attached to the App to the function witness f

mkCaseHasSpec (Either a b) ⇒ Term (Either a b) → Binder a → Binder b → Pred Source #

data SolverStage where Source #

Constructors

SolverStage 

Fields

Instances

Instances details
Pretty SolverStage Source # 
Instance details

Defined in Test.Minimal.Syntax

Methods

prettySolverStageDoc ann Source #

prettyList ∷ [SolverStage] → Doc ann Source #

data SolverPlan Source #

Instances

Instances details
Pretty SolverPlan Source # 
Instance details

Defined in Test.Minimal.Syntax

Methods

prettySolverPlanDoc ann Source #

prettyList ∷ [SolverPlan] → Doc ann Source #

data EqSym ∷ [Type] → TypeType where Source #

Constructors

EqualW ∷ (Eq a, HasSpec a) ⇒ EqSym '[a, a] Bool 

Instances

Instances details
Logic EqSym Source # 
Instance details

Defined in Test.Minimal.Syntax

Methods

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

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

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

Semantics EqSym Source # 
Instance details

Defined in Test.Minimal.Syntax

Methods

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

rewriteRules ∷ ∀ (ds ∷ [Type]) rng. (TypeList ds, Typeable ds, HasSpec rng, All HasSpec ds) ⇒ EqSym ds rng → List Term ds → Evidence (Typeable rng, Eq rng, Show rng) → Maybe (Term rng) Source #

Syntax EqSym Source # 
Instance details

Defined in Test.Minimal.Syntax

Methods

inFix ∷ ∀ (dom ∷ [Type]) rng. EqSym dom rng → Bool Source #

name ∷ ∀ (dom ∷ [Type]) rng. EqSym dom rng → String Source #

Show (EqSym d r) Source # 
Instance details

Defined in Test.Minimal.Syntax

Methods

showsPrecIntEqSym d r → ShowS #

showEqSym d r → String #

showList ∷ [EqSym d r] → ShowS #

Eq (EqSym dom rng) Source # 
Instance details

Defined in Test.Minimal.Syntax

Methods

(==)EqSym dom rng → EqSym dom rng → Bool #

(/=)EqSym dom rng → EqSym dom rng → Bool #

equalSpec ∷ a → Spec a Source #

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

caseBoolSpec ∷ (HasSpec Bool, HasSpec a) ⇒ Spec Bool → (BoolSpec a) → Spec a Source #

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

getWitness ∷ ∀ t t' d r. (AppRequires t d r, Typeable t') ⇒ t d r → Maybe (t' d r) Source #

pattern Equal ∷ ∀ b. () ⇒ ∀ a. (b ~ Bool, Eq a, HasSpec a) ⇒ Term a → Term a → Term b Source #

pinnedBy ∷ ∀ a. HasSpec a ⇒ Var a → PredMaybe (Term a) Source #

Is the variable x pinned to some free term in p? (free term meaning that all the variables in the term are free in p).

TODO: complete this with more cases!

Orphan instances

Monoid Pred Source # 
Instance details

Methods

memptyPred #

mappendPredPredPred #

mconcat ∷ [Pred] → Pred #

Semigroup Pred Source # 
Instance details

Methods

(<>)PredPredPred #

sconcatNonEmpty PredPred #

stimesIntegral b ⇒ b → PredPred #

Rename Pred Source # 
Instance details

Methods

renameTypeable x ⇒ Var x → Var x → PredPred Source #

HasSpec a ⇒ Monoid (Spec a) Source # 
Instance details

Methods

memptySpec a #

mappendSpec a → Spec a → Spec a #

mconcat ∷ [Spec a] → Spec a #

HasSpec a ⇒ Semigroup (Spec a) Source # 
Instance details

Methods

(<>)Spec a → Spec a → Spec a #

sconcatNonEmpty (Spec a) → Spec a #

stimesIntegral b ⇒ b → Spec a → Spec a #

Rename (Binder a) Source # 
Instance details

Methods

renameTypeable x ⇒ Var x → Var x → Binder a → Binder a Source #

Rename (Term a) Source # 
Instance details

Methods

renameTypeable x ⇒ Var x → Var x → Term a → Term a Source #

Pretty (Var a) Source # 
Instance details

Methods

prettyVar a → Doc ann Source #

prettyList ∷ [Var a] → Doc ann Source #