!zS      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQR (c) 2017 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela <rudy@matela.com.br>None1789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~(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>Safep extrapolateHFor a given type, return all *-kinded types. (all non-function types) KtypesIn (typeOf (undefined :: (Int -> Int) -> Int -> Bool)) == [Bool,Int]5(c) 2017 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela <rudy@matela.com.br>None1 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  and  it may be useful to use: LeanCheck's  Test.LeanCheck.Utils.TypeBinding operators: S, T, U, ...;Extrapolate's Test.Extrapolate.TypeBinding operators: , , , .... extrapolate?Transforms a value into an manipulable expression tree. See > and . extrapolate(Common name for a variable, defaults to "x". extrapolateEList of symbols allowed to appear in side-conditions. Defaults to []. See >. extrapolate+Computes a list of reified instances. See  .V extrapolateUsage: ins "x" (undefined :: Type)W extrapolatelgeneralizes 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 hole extrapolate0List 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] = NothingX extrapolateGiven 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.*YZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~UTS  !"#$%&'()*+,-./0123645789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'q  !"#$%&'()*+,-./0123645   #$%&'  !" NoneF9 extrapolate<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])89:8:9(c) 2017 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela <rudy@matela.com.br>Nonec ; extrapolateUse ;/ 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 ($)!< extrapolatefAllows the user to customize instance information available when generalized. (For advanced users.)= extrapolateUse => 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 c> extrapolateUse >1 to configure the maximum condition size allowed.? extrapolateUse ?| 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) $ propB extrapolateConfigures a bound on the number of constants allowed in expressions that are considered when testing for equality in Speculate.Defaults to 2.C extrapolatemConfigures a bound on the depth of expressions that are considered when testing for equality in Speculate. Default to 3.D extrapolate&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:_)E extrapolate(Check a property printing results on stdout and returning  on success.JThere is no option to silence this function: for silence, you should use  . ;<=>?@ABCDE DE;<=>?A@BC(c) 2017 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela <rudy@matela.com.br>Nonex H extrapolate Derives a  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  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.I extrapolateSame as H4 but does not warn when instance already exists (H is preferable).J extrapolate Derives a  instance for a given type 3 cascading derivation of type arguments as well. extrapolategGiven 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.HIJHIJ(c) 2017 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela <rudy@matela.com.br>Noney-YZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~UTS  !"#$%&'()*+,-./0123645789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'89: (c) 2017 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela <rudy@matela.com.br>NoneYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~UTS  !"#$%&'()*+,-./0123645>T ;=>?DEHIJNDE;=>? >THIJ  !"#$%&'()*+,-./0123645  !"#"$"%"&"'"(")"*"+,-,.,/, ,0,1,2,3,4,5,6,7,8,9,:,;,<,=,>,?,@,A,B,C,D,E,F,G,HIJKIJLIMNIMOIMPIMQIMRIMSIMTIMUIMVIMWIMXIMYIMZIM[IM\IM]IM^IM_IM`IMaIMbIMcIMdIMeIMfIMgIMhIMiIMjIMkIMlIMmIMnIMoIMpIMqIMrIMsIMtIMuIMvIwxIwyIwzIw{Iw|Iw}Iw~IwIwIwIwIwIwIwIwIwIwIwIwIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIMIMIMIMIIII      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmlnlopqrlsltlulvlwlxlylzl{l|l}l~lllllllllllllllllllllllllllllllllllll (extrapolate-0.3.2-9m7M5549ph3B4clB1VbLcVTest.Extrapolate.ExprsTest.Extrapolate.CoreTest.Extrapolate.TypeBindingTest.Extrapolate.UtilsTest.Extrapolate.NewTest.Extrapolate.IOTest.Extrapolate.DeriveTest.Extrapolate.BasicTest.LeanCheckholdsTest.Extrapolatebase Data.TypeableTypeRep&leancheck-0.7.2-EPNsNkdnB3GGru5dgPw3paTest.LeanCheck.Tiers listsOfLengthsetsOfbagsOf noDupListsOf normalizeTdeleteTproductslistsOfproductMaybeWith product3With noDupListConsmapConssetConsbagConsTest.LeanCheck.DerivederiveListableCascadingderiveListableTest.LeanCheck.Basic addWeightofWeightcons12cons11cons10cons9cons8cons7cons6Test.LeanCheck.Core==>existsfailswitness witnesses><\\//\/+|suchThatresetdelaycons5cons4cons3cons2cons1cons0 concatMapTconcatTfilterTmapTtiersFractional listIntegraltoTierslisttiersListable&speculate-0.3.4-C4S7eP3fMRJIjiEsIyN4SoTest.Speculate.Expr.Canon canonicalWith canonicalizeTest.Speculate.Expr.Core$$arityatomicConstantscompareComplexitycompareComplexityThenconstantconsts countHolescountVar countVarsdepthEeqExprCommutingetypevalevaluatefalseEhasVarholeholeOfTyholes isAssignmentisConstantNamedisSubisTuplelengthE lexicompare lexicompareBy showConstantshowExpr showOpExpr showPrecExpr showsOpExpr showsPrecExprsubexprs subexprsVtyp typeCorrect unfoldApp unfoldTupleunrepeatedVarsvarTest.Speculate.Expr.Equate comparisonLE comparisonLTconditionalComparisonLEconditionalComparisonLTconditionalEquationequation implication inequality isEquation phonyEquation unComparisonunConditionalComparisonunConditionalEquation unEquation unImplicationusefulConditionalEquationusefulEquationusefulImplicationuselessEquationTest.Speculate.Expr.Ground condEqual condEqualMequalfalsegroundAndBinds groundBindsinequalless lessOrEqualtrue trueBinds trueRatioTest.Speculate.Expr.InstancedefNameseqeqEeqOrdeqWithfindInfo instanceTypeiqEisEqisEqEisEqOrdisEqOrdE isListableisOrdisOrdEleElistable listableWithltEnamesordordWithpreludeInstancestiersETest.Speculate.Expr.Matchassign assigningfillhasCanonInstanceOf hasInstanceOfisCanonInstanceOf isInstanceOfmatchmatch2 matchWithrenameBysub unificationunifyTest.Speculate.Utils.TypeableboolTymkEqnTyExpr:$ConstantVarInstance InstancesBindsExprsnameWithcanonicalizeWithgroundsgroundsAndBinds 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(,,,,)$fGeneralizableRatio Test.LeanCheck.Utils.TypeBinding-:->:->>:insgeneralizations1 expressionsTTuint4uint3uint2uint1word4word3word2word1int4int3int2int1natnaturaleithmayborderingstringcharboolrationaldoublefloatintegerintund>-->>>>>>>>>>>>:->>>>>>>>>>>:> ->>>>>>>>>>>: ->>>>>>>>>>:> ->>>>>>>>>>: ->>>>>>>>>:> ->>>>>>>>>: ->>>>>>>>:> ->>>>>>>>: ->>>>>>>:> ->>>>>>>: ->>>>>>:>->>>>>>:->>>>>:>->>>>>:->>>>:>->>>>:->>>:>->>>:->>:>->:>-:>GHC.Realdivghc-prim GHC.TypesTruetemplate-haskellLanguage.Haskell.TH.SyntaxName typeArity