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

Constrained.Syntax

Description

This module contains operations and tranformations on Syntax, Term, Pred, etc. 1) Computing Free Variables 2) Substitution 3) Renaming 4) internal helper functions 5) Syntacic only transformations

Synopsis

Documentation

mkNamed ∷ String → Q Pat Source #

mkNamedExpr ∷ String → Q Exp Source #

var ∷ QuasiQuoter 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 Constrained.Syntax

Semigroup FreeVars Source # 
Instance details

Defined in Constrained.Syntax

Methods

(<>)FreeVarsFreeVarsFreeVars #

sconcatNonEmpty FreeVarsFreeVars

stimes ∷ Integral b ⇒ b → FreeVarsFreeVars

Show FreeVars Source # 
Instance details

Defined in Constrained.Syntax

Methods

showsPrec ∷ Int → FreeVars → ShowS

showFreeVars → String

showList ∷ [FreeVars] → ShowS

memberOfNameFreeVars → Bool Source #

countNameFreeVars → Int Source #

singletonName → Int → FreeVars Source #

without ∷ Foldable t ⇒ FreeVars → t NameFreeVars Source #

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 Constrained.Syntax

Methods

freeVarsPredFreeVars Source #

freeVarSetPred → Set Name Source #

countOfNamePred → Int Source #

appearsInNamePred → Bool Source #

HasVariables Name Source # 
Instance details

Defined in Constrained.Syntax

Methods

freeVarsNameFreeVars Source #

freeVarSetName → Set Name Source #

countOfNameName → Int Source #

appearsInNameName → Bool Source #

HasVariables (Binder a) Source # 
Instance details

Defined in Constrained.Syntax

Methods

freeVarsBinder a → FreeVars Source #

freeVarSetBinder a → Set Name Source #

countOfNameBinder a → Int Source #

appearsInNameBinder a → Bool Source #

HasVariables (Term a) Source # 
Instance details

Defined in Constrained.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 Constrained.Syntax

Methods

freeVars ∷ Set a → FreeVars Source #

freeVarSet ∷ Set a → Set Name Source #

countOfName → Set a → Int Source #

appearsInName → Set a → Bool Source #

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

Defined in Constrained.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 Constrained.Syntax

Methods

freeVars ∷ (a, b) → FreeVars Source #

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

countOfName → (a, b) → Int Source #

appearsInName → (a, b) → Bool Source #

HasVariables (f a) ⇒ HasVariables (Weighted f a) Source # 
Instance details

Defined in Constrained.Syntax

Methods

freeVarsWeighted f a → FreeVars Source #

freeVarSetWeighted f a → Set Name Source #

countOfNameWeighted f a → Int Source #

appearsInNameWeighted f a → Bool Source #

HasVariables (List Term as) Source # 
Instance details

Defined in Constrained.Syntax

Methods

freeVarsList Term as → FreeVars Source #

freeVarSetList Term as → Set Name Source #

countOfNameList Term as → Int Source #

appearsInNameList Term as → Bool Source #

HasVariables (List (Weighted Binder) as) Source # 
Instance details

Defined in Constrained.Syntax

Methods

freeVarsList (Weighted Binder) as → FreeVars Source #

freeVarSetList (Weighted Binder) as → Set Name Source #

countOfNameList (Weighted Binder) as → Int Source #

appearsInNameList (Weighted Binder) as → 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 #

unBind ∷ a → Binder a → Pred Source #

data Name where Source #

Constructors

NameHasSpec a ⇒ Var a → Name 

Instances

Instances details
Show Name Source # 
Instance details

Defined in Constrained.Syntax

Methods

showsPrec ∷ Int → Name → ShowS

showName → String

showList ∷ [Name] → ShowS

Rename Name Source # 
Instance details

Defined in Constrained.Syntax

Methods

rename ∷ Typeable x ⇒ Var x → Var x → NameName Source #

HasVariables Name Source # 
Instance details

Defined in Constrained.Syntax

Methods

freeVarsNameFreeVars Source #

freeVarSetName → Set Name Source #

countOfNameName → Int Source #

appearsInNameName → Bool Source #

Eq Name Source # 
Instance details

Defined in Constrained.Syntax

Methods

(==)NameName → Bool

(/=)NameName → Bool

Ord Name Source # 
Instance details

Defined in Constrained.Syntax

Methods

compareNameName → Ordering

(<)NameName → Bool

(<=)NameName → Bool

(>)NameName → Bool

(>=)NameName → Bool

maxNameNameName

minNameNameName

Pretty Name Source # 
Instance details

Defined in Constrained.Syntax

Methods

prettyNameDoc ann Source #

prettyList ∷ [Name] → Doc ann Source #

fromLitsList Term as → Maybe (List Value as) Source #

fromLitTerm a → Maybe (Value a) Source #

isLitTerm a → Bool Source #

name ∷ String → Term a → Term a Source #

named ∷ String → Term a → Term a Source #

Give a Term a nameHint, if its a Var, and doesn't already have one, otherwise return the Term unchanged.

mkCaseHasSpec (SumOver as) ⇒ Term (SumOver as) → List (Weighted Binder) as → Pred Source #

runCaseOnSumOver as → List Binder as → (∀ a. HasSpec a ⇒ Var a → a → Pred → r) → r Source #

assertExplainIsPred p ⇒ NonEmpty String → p → Pred Source #

assertIsPred p ⇒ p → Pred Source #

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

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

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 #

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

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

assertReified ∷ (HasSpec Bool, HasSpec a) ⇒ Term a → (a → Bool) → Pred Source #

requires (HasSpec Bool)

explanationNonEmpty String → PredPred 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.

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

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

litHasSpec a ⇒ a → Term a Source #

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

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

runTermMonadGenError m ⇒ EnvTerm a → m a Source #

data SolverStage where Source #

Constructors

SolverStage 

Fields

Instances

Instances details
Pretty SolverStage Source # 
Instance details

Defined in Constrained.Syntax

Methods

prettySolverStageDoc ann Source #

prettyList ∷ [SolverStage] → Doc ann Source #

data SolverPlan Source #

Instances

Instances details
Pretty SolverPlan Source # 
Instance details

Defined in Constrained.Syntax

Methods

prettySolverPlanDoc ann Source #

prettyList ∷ [SolverPlan] → Doc ann Source #

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

Orphan instances

Rename Pred Source # 
Instance details

Methods

rename ∷ Typeable x ⇒ Var x → Var x → PredPred Source #

Rename (Binder a) Source # 
Instance details

Methods

rename ∷ Typeable x ⇒ Var x → Var x → Binder a → Binder a Source #

Rename (Term a) Source # 
Instance details

Methods

rename ∷ Typeable 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 #

Rename (f a) ⇒ Rename (Weighted f a) Source # 
Instance details

Methods

rename ∷ Typeable x ⇒ Var x → Var x → Weighted f a → Weighted f a Source #