{,      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ (c) 2017 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela <rudy@matela.com.br>SafeHFor 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>Safe"$%&'()*+,-./012345678$%&'()*+,-./012345678$%&'()*+,-./012345678"$%&'()*+,-./012345678(c) 2017 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela <rudy@matela.com.br>None09:;<=>?@AB      !"#$%&'()*+,-./0129:;<=>?@AB 9;<=>?AB@: 9:;<=>?@AB(c) 2017 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela <rudy@matela.com.br>None0 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: 3, 4, 5, ...;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 ^.6Usage: ins "x" (undefined :: Type)7lgeneralizes 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] = Nothing8Given 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.bCDEFG9HIJKLMNOPQRSTUVWXYZ[\]:;<=>?6^_`@ab7cAdefBCDEFghGijkHlImnop8JqrstuvwKLMxNyz{|}~#OPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvw5x4y3z{|}~      !"#$%&'()*+,-./012 9:;<=>?@ABCDFGEHIKJLMNOPQRSTUWYXVZ[\]^_`abcdefghijklmnopqrstuvwxyz{|;UVWXY^_ aZ[\]LMNOPQRSTHIJKdefxyz{|bhmicjklrstuvw`qopCDEFGgnOCDEFG9HIJKLMNOPQRSTUVWXYZ[\]:;<=>?6^_`@ab7cAdefBCDEFghGijkHlImnop8JqrstuvwKLMxNyz{|}~(c) 2017 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela <rudy@matela.com.br>None 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>None 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  . None<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>None&OPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvw5x4y3z{|}~      !"#$%&'()*+,-./012 9:;<=>?@ABCDFGEHIKJLMNOPQRSTUWYXVZ[\]^_`abcdefghijklmnopqrstuvwxyz{|(c) 2017 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela <rudy@matela.com.br>NoneOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvw5x4y3z{|}~$%&'()*+,-./012345678CUWYXVZ[^UVWXY^Z[C       !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                                                  ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C DE DFGHIGHJGHKLMNOPQRSTUVWXYZ[\]^_`abcdGHeGHfGHgGHhGHiGHjGHkGHlGHmGHnGHoGHpGHqGHrGHsGHtGHuGHvGHwGHxGHyGHzGH{GH|GH}GH~GHGHGHGHGHGHGHGHGHGHGHGHGHGHGHGHGHGGGGGGGGGGGGGGGGGGGGGGGGGGGG GGGGGGGGGGGGGGGGGGGGGGGGG&extrapolate-0.3.0-WvJlhKCGSRtCzVQBqs1vTest.ExtrapolateTest.Extrapolate.UtilsTest.Extrapolate.TypeBindingTest.Extrapolate.ExprsTest.Extrapolate.CoreTest.Extrapolate.DeriveTest.Extrapolate.IOTest.Extrapolate.NewTest.Extrapolate.BasicTest.LeanCheckholds&speculate-0.3.2-GPCZyFFvGUv7c50xgtxQn7Test.Speculate.Expr.Core showConstantconstant:$VarConstantExpr nubMergeBy nubMergeOnnubMerge+++foldr0fromLeft fromRightelemBylistEqlistOrdmaybeEqmaybeOrdeitherEq eitherOrdpairEqpairOrdtripleEq tripleOrd quadrupleEq quadrupleOrd minimumOn maximumOn takeBound nubMergeMaptypesIn argumentTyresultTydiscard.: compareIndex argTy1of1 argTy1of2 argTy2of2 argTy1of3 argTy2of3 argTy3of3 argTy1of4 argTy2of4 argTy3of4 argTy4of4 argTy1of5 argTy2of5 argTy3of5 argTy4of5 argTy5of5 argTy1of6 argTy2of6 argTy3of6 argTy4of6 argTy5of6 argTy6of6ExprsnameWithcanonicalizeWithgroundsgroundsAndBinds vassignmentsvarsisAssignmentTestfoldunfoldTestable resultiers$-| tinstancesoptions WithOptionWithpropertyoptionOptionMaxTestsExtraInstancesMaxConditionSize MinFailuresMaxSpeculateSizeConditionBound ConstantBound DepthBound Generalizableexprname background instancesbgEqbgOrd bgEqWith1 bgEqWith2thisbackgroundWith getBackground backgroundOf tBackgroundgeneralizationsmaxTestsextraInstancesmaxConditionSizeresultscounterExamplescounterExampleGensgeneralizationsCEgeneralizationsCECgeneralizationsCountscounterExampleGenareInstancesOf matchList newMatches fullInstancesatomstheoryAndReprExprstheoryAndReprCondscandidateConditionsvalidConditionsweakestConditionhasEq*==**/=**<=**<*$fTestable(->)$fTestableBool$fTestableWithOption$fGeneralizableOrdering$fGeneralizable[]$fGeneralizable(,,,)$fGeneralizable(,,)$fGeneralizable(,)$fGeneralizableEither$fGeneralizableMaybe$fGeneralizableChar$fGeneralizableInteger$fGeneralizableInt$fGeneralizableBool$fGeneralizable() $fShowOptionderiveGeneralizablederiveGeneralizableIfNeededderiveGeneralizableCascading$fEqBla$fOrdBla $fShowBlafor withInstanceswithBackgroundwithConditionSize minFailuresconditionBoundmaxSpeculateSize constantBound depthBoundcheck checkResult $fEqResult $fShowResultgeneralizedCounterExampleslgg1lgg$fGeneralizable(,,,,,,,)$fGeneralizable(,,,,,,)$fGeneralizable(,,,,,)$fGeneralizable(,,,,)$fGeneralizableRatio nubMerges nubMergesByfunTyConisFunTyunFunTy argTypes0 argTypes1 argTypes2 argTypes3 argTypes4 argTypes5 argTypes6 argTypes7 argTypes8 argTypes9 argTypes10 argTypes11 argTypes12 MarkerTypecanonicalizeWith1unrepeatedToHole1baseData.Typeable.InternalTypeRepTest.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&leancheck-0.7.0-3AnyDI1QRMi4JR7aTKK4Ic Test.LeanCheck.Utils.TypeBinding-:->:->>:insgeneralizations1 expressionsTTOptions bgEqWith3 bgEqWith4 bgOrdWith1 bgOrdWith2 bgOrdWith3 bgOrdWith4getEqInstancesFromBackground productWithcomputeMinFailurescomputeMaxSpeculateSizecomputeConditionBoundcomputeConstantBoundcomputeDepthBoundcounterExampleisCounterExample countPassestheoryAndReprsFromPropAndAtomsisCounterExampleUnderisVarfromBackgroundOfhasOrduint4uint3uint2uint1int4int3int2int1nateithmayborderingstringcharbooldoublefloatintegerintund>-->>>>>>>>>>>>:->>>>>>>>>>>:> ->>>>>>>>>>>: ->>>>>>>>>>:> ->>>>>>>>>>: ->>>>>>>>>:> ->>>>>>>>>: ->>>>>>>>:> ->>>>>>>>: ->>>>>>>:> ->>>>>>>: ->>>>>>:>->>>>>>:->>>>>:>->>>>>:->>>>:>->>>>:->>>:>->>>:->>:>->:>-:>Test.LeanCheck.Tiers listsOfLengthsetsOfbagsOf noDupListsOf normalizeTdeleteTproductslistsOfproductMaybeWith product3With noDupListConssetConsbagConsTest.LeanCheck.DerivederiveListableCascadingderiveListableTest.LeanCheck.Basic addWeightofWeightcons12cons11cons10cons9cons8cons7cons6Test.LeanCheck.Core==>existsfailswitness witnesses><\\//\/+|suchThatresetdelaycons5cons4cons3cons2cons1cons0 concatMapTconcatTfilterTmapTtiersFractional listIntegraltoTiersListablelisttierstemplate-haskellLanguage.Haskell.TH.SyntaxName typeArityBlaBlederiveGeneralizableXreallyDeriveGeneralizableletintypeConstructorsArgNames lookupValN"reallyDeriveGeneralizableCascading typeConArgstypeConArgsThattypeConCascadingArgsThat normalizeTypenormalizeTypeUnitsisntInstanceOftypeConstructors isTypeSynonymtypeSynonymType|=>| mergeIFnsmergeIwhereIGHC.Realdivghc-prim GHC.TypesTrueResultOK Falsified Exception resultsIOresultIO showResult showCEandGensshowCEshowCCEprettify