<sT      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ (c) 2017 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela <rudy@matela.com.br>None1 5         (c) 2017 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela <rudy@matela.com.br>Safe !"#$ !"#$(c) 2017 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela <rudy@matela.com.br>Safe=HFor a given type, return all *-kinded types. (all non-function types) KtypesIn (typeOf (undefined :: (Int -> Int) -> Int -> Bool)) == [Bool,Int]%&'()*+,-./0123456789:;<=>?@AB('&%)*+,-./0123456789:;<=>?@BA(5(c) 2017 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela <rudy@matela.com.br>None10 UEExtrapolate can generalize counter-examples of any types that are U.OThe core (and only required functions) of the generalizable typeclass are the V and Y functions.8The following example shows a datatype and its instance: (data Stack a = Stack a (Stack a) | Empty instance Generalizable a => Generalizable (Stack a) where name _ = "s" expr s@(Stack x y) = constant "Stack" (Stack ->>: s) :$ expr x :$ expr y expr s@Empty = constant "Empty" (Empty -: s) instances s = this s $ instances (argTy1of1 s) To declare Y and V it may be useful to use: LeanCheck's  Test.LeanCheck.Utils.TypeBinding operators: ,  , !, ...;Extrapolate's Test.Extrapolate.TypeBinding operators: , , , ....V?Transforms a value into an manipulable expression tree. See  and .W(Common name for a variable, defaults to "x".XEList of symbols allowed to appear in side-conditions. Defaults to []. See .Y+Computes a list of reified instances. See ^."Usage: ins "x" (undefined :: Type)#lgeneralizes an expression by making it less defined, starting with smaller changes, then bigger changes:1: change constant to variable 1.1: if a variable of the constant type exists, use it 1.2: if not, introduce new variable 2: change a variable to a new variableAThe above is the ideal, but let's start with a simpler algorithm:1: change constant to holeo0List matches of lists of expressions if possible S[0,1] `matchList` [x,y] = Just [x=0, y=1] [0,1+2] `matchList` [x,y+y] = Nothing$Given tiers of atomic expressions, generates tiers of expressions combined by function application. This is done blindly so redundant expressions are generated: like x + y and y + x.#%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLM!N OPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      (CDFGEHIKJLMNOPQRSTUWYXVZ[\]^_`abcdefghijklmnopqrstuvwxyz{|;UVWXY^_(aZ[\]LMNOPQRSTHIJKdefxyz{|bhmicjklrstuvw`qopCDEFGgnCDEFGHIJKLMNOPQRSTUVWXYNone9<Computes the least general generalization of two expressions lgg1 (expr [0,0]) (expr [1,1]) _,_s:: [Int] (holes: Int, Int) > lgg1 (expr [1,1::Int]) (expr [2,2,2::Int]) _:_:_ :: [Int] (holes: Int, Int, [Int])(c) 2017 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela <rudy@matela.com.br>NoneT Use / to configure the number of tests performed by check. ]> check `for` 10080 $ \xs -> sort (sort xs) == sort (xs :: [Int]) +++ OK, passed 10080 tests.Don't forget the dollar ($)!fAllows the user to customize instance information available when generalized. (For advanced users.)Use > to provide additional functions to appear in side-conditions. check `withBackground` [constant "isSpace" isSpace] $ \xs -> unwords (words xs) == xs *** Failed! Falsifiable (after 4 tests): " " Generalization: ' ':_ Conditional Generalization: c:_ when isSpace cUse 1 to configure the maximum condition size allowed.Use | to configure the minimum number of failures for a conditional generalization in function of the maximum number of tests.OTo set that conditional generalizations should fail for 10% of cases: > check  ( 10) $ propNTo set that conditional generalizations should fail for 5% of cases: > check  ( 20) $ propConfigures a bound on the number of constants allowed in expressions that are considered when testing for equality in Speculate.Defaults to 2.mConfigures a bound on the depth of expressions that are considered when testing for equality in Speculate. Default to 3.&Checks a property printing results on stdout > check $ \xs -> sort (sort xs) == sort (xs::[Int]) +++ OK, passed 360 tests. > check $ \xs ys -> xs `union` ys == ys `union` (xs::[Int]) *** Failed! Falsifiable (after 4 tests): [] [0,0] Generalization: [] (x:x:_)(Check a property printing results on stdout and returning  on success.JThere is no option to silence this function: for silence, you should use  . (c) 2017 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela <rudy@matela.com.br>Noneh Derives a U instance for a given type .Consider the following Stack datatype: (data Stack a = Stack a (Stack a) | EmptyWriting deriveGeneralizable ''Stack(will automatically derive the following U instance: [instance Generalizable a => Generalizable (Stack a) where expr s@(Stack x y) = constant "Stack" (Stack ->>: s) :$ expr x :$ expr y expr s@Empty = constant "Empty" (Empty -: s) instances s = this "s" s $ let Stack x y = Stack undefined undefined `asTypeOf` s in instances x . instances yThis function needs the TemplateHaskell extension.Same as 4 but does not warn when instance already exists ( is preferable). Derives a U instance for a given type 3 cascading derivation of type arguments as well.gGiven a type name, return the number of arguments taken by that type. Examples in partially broken TH: arity ''Int === Q 0 arity ''Int->Int === Q 0 arity ''Maybe === Q 1 arity ''Either === Q 2 arity ''Int-> === Q 1ZThis works for Data's and Newtype's and it is useful when generating typeclass instances. (c) 2017 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela <rudy@matela.com.br>Nonejw&%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLM!N OPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      (CDFGEHIKJLMNOPQRSTUWYXVZ[\]^_`abcdefghijklmnopqrstuvwxyz{|(c) 2017 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela <rudy@matela.com.br>Nonep%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLM!N OPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$CUWYXVZ[^UVWXY^Z[C       !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                                      ! " # $ % & ' ( ) * + , - . /0 /12234534634789:34;34<34=34>34?34@34A34B34C34D34E34F34G34H34I34J34K34L34M34N34O34P34Q34R34S34T34U34V34W34X34Y34Z34[34\34]34^34_34`34a34b34c34d34e3fg3fh3fi3fj3fk3fl3fm3fn3fo3fp3fq3fr3fs3tu3tv3wx3wy3wz3w{3w|3w}3w~3w3w3333 3333333333333333333333333'extrapolate-0.3.1-ieHO43oRdCEBKDGrWxztxTest.ExtrapolateTest.Extrapolate.ExprsTest.Extrapolate.TypeBindingTest.Extrapolate.UtilsTest.Extrapolate.CoreTest.Extrapolate.NewTest.Extrapolate.IOTest.Extrapolate.DeriveTest.Extrapolate.BasicTest.LeanCheckholds&speculate-0.3.2-Es6bHzliQ8D6HgprhGg9AdTest.Speculate.Expr.Core showConstantconstant:$VarConstantExprExprsnameWithcanonicalizeWithgroundsgroundsAndBinds vassignmentsvarsisAssignmentTestfoldunfold argTy1of1 argTy1of2 argTy2of2 argTy1of3 argTy2of3 argTy3of3 argTy1of4 argTy2of4 argTy3of4 argTy4of4 argTy1of5 argTy2of5 argTy3of5 argTy4of5 argTy5of5 argTy1of6 argTy2of6 argTy3of6 argTy4of6 argTy5of6 argTy6of6 nubMergeBy nubMergeOnnubMerge+++foldr0fromLeft fromRightelemBylistEqlistOrdmaybeEqmaybeOrdeitherEq eitherOrdpairEqpairOrdtripleEq tripleOrd quadrupleEq quadrupleOrd minimumOn maximumOn takeBound nubMergeMaptypesIn argumentTyresultTydiscard.: compareIndexTestable resultiers$-| tinstancesoptions WithOptionWithpropertyoptionOptionMaxTestsExtraInstancesMaxConditionSize MinFailuresMaxSpeculateSizeConditionBound ConstantBound DepthBound Generalizableexprname background instancesbgEqbgOrd bgEqWith1 bgEqWith2thisbackgroundWith getBackground backgroundOf tBackgroundgeneralizationsmaxTestsextraInstancesmaxConditionSizeresultscounterExamplescounterExampleGensgeneralizationsCEgeneralizationsCECgeneralizationsCountscounterExampleGenareInstancesOf matchList newMatches fullInstancesatomstheoryAndReprExprstheoryAndReprCondscandidateConditionsvalidConditionsweakestConditionhasEq*==**/=**<=**<*$fGeneralizableOrdering$fGeneralizable[]$fGeneralizable(,,,)$fGeneralizable(,,)$fGeneralizable(,)$fGeneralizableEither$fGeneralizableMaybe$fGeneralizableChar$fGeneralizableInteger$fGeneralizableInt$fGeneralizableBool$fGeneralizable()$fTestable(->)$fTestableBool$fTestableWithOption $fShowOptiongeneralizedCounterExampleslgg1lggfor withInstanceswithBackgroundwithConditionSize minFailuresconditionBoundmaxSpeculateSize constantBound depthBoundcheck checkResult $fEqResult $fShowResultderiveGeneralizablederiveGeneralizableIfNeededderiveGeneralizableCascading$fEqBla$fOrdBla $fShowBla$fGeneralizable(,,,,,,,)$fGeneralizable(,,,,,,)$fGeneralizable(,,,,,)$fGeneralizable(,,,,)$fGeneralizableRatiobase Data.TypeableTypeRepTest.Speculate.Expr.Canon canonicalWith canonicalizeTest.Speculate.Expr.Groundfalse trueRatio trueBindstrueinequalless lessOrEqual condEqualM condEqualequalgroundAndBinds groundBindsTest.Speculate.Expr.EquateunConditionalComparisonconditionalComparisonLTconditionalComparisonLEusefulConditionalEquationunConditionalEquationconditionalEquationusefulImplication unImplication implication unComparison comparisonLE comparisonLT inequalityusefulEquationuselessEquation isEquation unEquation phonyEquationequationTest.Speculate.Expr.InstancedefNamespreludeInstancesleEltEiqEeqEtiersEnamesfindInfo isListableisEqOrdEisOrdEisEqEisEqOrdisOrdisEq listableWithordWitheqWithlistableeqOrdordeq instanceTypeInstance InstancesTest.Speculate.Expr.MatchhasCanonInstanceOfisCanonInstanceOf hasInstanceOf isInstanceOf unificationunify matchWithmatch2matchrenameBysub assigningassignfillBinds unfoldAppisConstantNamedisSub subexprsVsubexprs isAssignmentunrepeatedVars countVarscountVar countHolesdepthElengthEconstshasVaratomicConstantsholesarity typeCorrectetyptypevalevaluatefalseEcompareComplexitycompareComplexityThen lexicompare lexicompareByeqExprCommutingshowExpr showPrecExpr showOpExpr showsOpExpr unfoldTupleisTuple showsPrecExpr$$holeOfTyholevarTest.Speculate.Utils.TypeablemkEqnTyboolTy MarkerType&leancheck-0.7.0-Iu2OFFXtMS23nCaTq5CZ4c Test.LeanCheck.Utils.TypeBinding-:->:->>:insgeneralizations1 expressionsTTuint4uint3uint2uint1int4int3int2int1nateithmayborderingstringcharbooldoublefloatintegerintund>-->>>>>>>>>>>>:->>>>>>>>>>>:> ->>>>>>>>>>>: ->>>>>>>>>>:> ->>>>>>>>>>: ->>>>>>>>>:> ->>>>>>>>>: ->>>>>>>>:> ->>>>>>>>: ->>>>>>>:> ->>>>>>>: ->>>>>>:>->>>>>>:->>>>>:>->>>>>:->>>>:>->>>>:->>>:>->>>:->>:>->:>-:>Test.LeanCheck.Tiers listsOfLengthsetsOfbagsOf noDupListsOf normalizeTdeleteTproductslistsOfproductMaybeWith product3With noDupListConssetConsbagConsTest.LeanCheck.DerivederiveListableCascadingderiveListableTest.LeanCheck.Basic addWeightofWeightcons12cons11cons10cons9cons8cons7cons6Test.LeanCheck.Core==>existsfailswitness witnesses><\\//\/+|suchThatresetdelaycons5cons4cons3cons2cons1cons0 concatMapTconcatTfilterTmapTtiersFractional listIntegraltoTiersListablelisttiersGHC.Realdivghc-prim GHC.TypesTrueResultOK Falsified Exceptiontemplate-haskellLanguage.Haskell.TH.SyntaxName typeArityBlaBle