ú΋¤ƒĘG      !"#$%&'()*+,-./0123456789:;<=>?@AB C D E F None JThis class covers algebraic datatypes that can be transformed into Trees. L subTypes is the main method, placing values into trees. For types that can't 5 be put into a *structural* order (e.g., Int), we don't want SmartCheck to  touch them, so that aren'0t placed in the tree (the baseType method tells + subTypes which types have this property). *for a datatype with constructors A and C,  subTypes (A (C 0) 1) * [Node {rootLabel = C 0, subForest = []}] JGenerically replace child i in m with value s. A total function: returns L Nothing if you try to replace a child with an ill-typed child s. (Returns ; Just (the original data) if your index is out of bounds). JshowForest generically shows a value while preserving its structure (in a J Tree). You should always end up with either a singleton list containing J the tree or an empty list for baseTypes. Also, it must be the case that  for a value v, *null (subTypes v) iff null (showForest v)  and B if not . null (subTypes v), then subForest . head (showForest v) ' has the same structure as subTypes v. We can'Ct just return a Tree String or Maybe (Tree String). The reason is J that in generically constructing the value, we have to deal with product @ types. There is no sane way to join them other than list-like 7 concatenation (i.e., gsf (a :*: b) = gsf a ++ gsf b). 'Keep or substitue a value in the tree. Index into a Tree/:Forest, where level is the depth from the root and column L is the distance d is the dth value on the same level. Thus, all left-most # nodes are in column 0. This is a  matrix view of tree-structured data.  Possible results of iterateArb. )Satisfied it, with the satisfying value. 'Failed the property---either we expect 1 failure and it passes or we expect to pass it  and we fail. Couldn' t satisfy the precondition of a  QuickCheck property CNominally, a list for value generalization indexes and existential  generalization. G1Sort in order of depth first then left to right. GH IJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijkGlmn   0H  IJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijkGlmnNone o,Replace a value and all of its subchildren. p0Replace everything in the path from the root to 4 here. Used as breadcrumbs to the value. Chop the  subforest. GReturn the list of values at each level in a Forest Not like levels in 7 Data.Tree (but what I imagined it should have done!). qAReturn the elements at level i from a forest. 0-based indexing. CGet the depth of a Forest. 0-based (an empty Forest has depth 0). r-How many members are at level i in the Tree? !IGet the tree at idx in a forest. Nothing if the index is out-of-bounds. "HReturns the value at index idx. Returns nothing if the index is out of  bounds. %CMake a substitution Forest (all proper children). Initially we don't  replace anything. &2Replace a value at index idx generically in a Tree/Forest generically. sopq r!"Value Index of hole !Maximum depth we want to extract #t$u%& Parent value Index of hole to replace Value to replace with  !"#$%&$"&!% # spoq r!"#t$u%&None'Driver for iterateArb. (HReplace the hole in d indexed by idx with a bunch of random values, and O test the new d against the property. Returns the first new d (the full d but ) with the hole replaced) that succeeds. Succeeds is determined by the call  to resultify---if we'9re expecting failure, then we succeed by getting a value N that passes the precondition but fails the property; otherwise we succeed by N getting a value that passes the precondition and satisfies the property. If I no value ever satisfies the precondition, then we return FailedPreCond.  (Thus, there'<s an implied linear order on the Result type: FailedPreCond <  FailedProp < Result a.) vHMake a new random value given a generator and a max size. Based on the  value's type's arbitrary instance. )HPut a value v into a another value d at a hole idx, if v is well-typed. ) Return Nothing if dynamic typing fails. *HMake a QuickCheck Result by applying a property function to a value and 0 then get out the Result using our result type. wIGet the maximum depth of a value, where depth is measured in the maximum G depth of the tree representation, not counting base types (defined in  Types.hs). xy'(Counterexample. !Sub-value in the counterexample. Index of sub-value. Maximum number of iterations. #Maximum size of value to generate.  Property. 4Number of times precondition is passed and returned  result. v)*+ Failed value  Test to use What to do after the test  Property Max depth to analyze Only evaluate at True indexes. Starting index to extrapolate List of generalized indices w'()*+'(*)+ xy'(v)*+wNone,DTrue if d matches any ds. Assume all ds are unequal to each other. zAAt each index that we generalize (either value generalization or L constructor generalization), we replace that value from b into a. At this L point, we check for constructor equality between the two values, decending  their structures. ,z,,,zNone /!How to show extrapolated formula 0QuickCheck arguments 1$Should we run QuickCheck? (If not, ' you are expected to pass in data to  analyze.) 2%Maximum size of data to generate, in " terms of the size parameter of  QuickCheck's Arbitrary instance for  your data. 3&How many levels into the structure of & the failed value should we descend " when reducing or generalizing? $ Nothing means we go down to base  types. 4$How hard (number of rounds) to look ' for failure in the reduction stage. 5Should we extrapolate? 6$How hard (number of rounds) to look ) for failures during the extrapolation  stage. 7"Minimum number of times a property's  precondition must be passed to  generalize it. 8Should we try to generalize  constructors? 9$How hard (number of rounds) to look  for failing values with each  constructor. For wide sum types, this  value should be increased. -./0123456789:;<=-./0123456789:;<=-./0123456789=:<;- ./0123456789:<;=None{FAt each index into d from idxs, replace the whole with a fresh value. |EMake a string out a Tree of Strings. Put parentheses around complex  subterms, where complex- means we have two or more items (i.e., there's a  space). }~>?{|>??>}~>?{|NoneJBreadth-first traversal of d, trying to shrink it with *strictly* smaller N children. We replace d whenever a successful shrink is found and try again. @€@@@€NoneAJTest d with arbitrary values replacing its children. For anything we get I 100% failure for, we claim we can generalize it---any term in that hole  fails. DWe extrapolate if there exists at least one test that satisfies the K precondition, and for all tests that satisfy the precondition, they fail. A Arguments Current failed value Original property AAA NoneBKEntry point to generalize constructors. We pass in a list of indexes from  value generalizations so we don'+t try to generalize those constructors (or  anything below). ‚3Return True if we can generalize; False otherwise. ƒGFor a value a (used just for typing), and a list of representations of N constructors cs, arbSubset generages a new value b, if possible, such that b  has the same type as a, and b'"s constructor is not found in cs. 4Assumes there is some new constructor to test with. „&Get the constructor at an index in x. B‚ƒ„BBB‚ƒ„ None …Turn a function that returns a † into a QuickCheck Property. C?Type for SmartCheck properties. Moral equivalent of QuickCheck's  Property type. DMain interface function. EDRun QuickCheck initially, to get counterexamples for each argument, ? includding the one we want to focus on for SmartCheck, plus a Property. ‡FRun QuickCheck only analyzing the SmartCheck value, holding the other  values constant. FMoral equivalent of QuickCheck's ==> operator. ˆBeta-reduction. ‰Wrapped properties. Š Instance without preconditions. …‹ŒCŽD‘’E‡“”•F–—˜ˆ‰Š™  -./0123456789:;<=CDEFDCFE …‹ŒCŽD‘’E‡“”•F–—˜ˆ‰Š™š     !"#$%&'()*+,-./01233456789:;<=>?@ABCDEF G H I J KLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…† ‡ ˆ ‰ Š‹Œ Ž   ‘ ’ “ ” • – — ˜ ™ š › œ  ž Ÿ  Ąsmartcheck-0.1Test.SmartCheck.TypesTest.SmartCheck.DataToTreeTest.SmartCheck.SmartGenTest.SmartCheck.MatchesTest.SmartCheck.ArgsTest.SmartCheck.RenderTest.SmartCheck.ReduceTest.SmartCheck.ExtrapolateTest.SmartCheck.ConstructorGenTest.SmartCheckgstgrcgtcgsfgszSubTypessubTypesbaseType replaceChildtoConstr showForestSubTunSubTSubstKeepIdxlevelcolumnResult FailedProp FailedPreCondReplaceunVals unConstrssubTerrorMsg breadthLevelsdepth getIdxForestgetAtIdxtooDeepforestReplaceChildren mkSubstForest replaceAtIdx iterateArbIdx iterateArbreplace resultifyiter matchesShapesScArgsformatqcArgsqc scMaxSize scMaxDepth scMaxReduce runForall scMaxForall scMinForall runExists scMaxExistsFormat PrintString PrintTree scStdArgs smartPrtLnrenderWithVarssmartRun extrapolate constrsGen ScProperty smartCheck runQCInit-->$fOrdIdxGST toConstr' replaceChild' showForest'$fSubTypes(,,,,)$fSubTypes(,,,)$fSubTypes(,,) $fSubTypes(,)$fSubTypesEither$fSubTypesMaybe$fSubTypesComplex$fSubTypesRatio $fSubTypes[] $fSubTypes()$fSubTypesWord64$fSubTypesWord32$fSubTypesWord16$fSubTypesWord8$fSubTypesWord$fSubTypesInt64$fSubTypesInt32$fSubTypesInt16$fSubTypesInt8$fSubTypesInteger $fSubTypesInt$fSubTypesFloat$fSubTypesDouble$fSubTypesChar$fSubTypesBool$fGSTK1$fGSTM1$fGSTM10$fGST:+:$fGST:*:$fGSTU1 $fShowSubT $fShowIdx $fMonadResult$fFunctorResultChildrenParentgetLevel levelLengthSubStratforestReplaceParentsubnewValvalDepthNextTest matchesShapereplaceWithVars stitchTreeVarRepl smartPrefix smartShrink resultToMaybe subValSizeextrapolateConstrs arbSubset subConstrScPropghc-prim GHC.TypesBoolrunQC $fScProp(->)$fScPropScProperty $fScPropBool scProperty qcPropertySimpleImplies existsExtrap forallExtrapshowExtrapOutput runAgainMsglenChkgetOutgenProptoQCImppropifyWithArgspropify$fTestableScProperty