!fDd9      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                                  ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~                                                                     !"#$%&'()*+,-./012345678(c) 2015-2018 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela <rudy@matela.com.br>Safe% leancheck values are functions of / arguments that return boolean values, e.g.:  Bool  Listable a => a -> Bool  Listable a => a -> a -> Bool  Int -> Bool  String -> [Int] -> Bool leancheck A type is R when there exists a function that is able to list (ideally all of) its values.*Ideally, instances should be defined by a  function that returns a (potentially infinite) list of finite sub-lists (tiers): the first sub-list contains elements of size 0, the second sub-list contains elements of size 1 and so on. Size here is defined by the implementor of the type-class instance./For algebraic data types, the general form for  is btiers = cons<N> ConstructorA \/ cons<N> ConstructorB \/ ... \/ cons<N> ConstructorZwhere N0 is the number of arguments of each constructor A...Z.*Instances can be alternatively defined by ". In this case, each sub-list in 2 is a singleton list (each succeeding element of  has +1 size). The function  from Test.LeanCheck.Derive7 can automatically derive instances of this typeclass.A S instance for functions is also available but is not exported by default. Import Test.LeanCheck.Function. if you need to test higher-order properties. leancheckTakes a list of values xsX and transform it into tiers on which each tier is occupied by a single element from xs. To convert back to a list, just 9. leancheck Tiers of :7 values. Can be used as a default implementation of  for : types. leancheck Tiers of ;6 values. This can be used as the implementation of  for ; types. leancheck< over tiers  leancheck= tiers  leancheck9 tiers of tiers  leancheck> over tiers  leancheck2Given a constructor with no arguments, returns  of all possible applications of this constructor. Since in this case there is only one possible application (to no arguments), only a single value, of size/weight 0, will be present in the resulting list of tiers.  leancheckGiven a constructor with one  argument, return ` of applications of this constructor. By default, returned values will have size/weight of 1. leancheckGiven a constructor with two  arguments, return ` of applications of this constructor. By default, returned values will have size/weight of 1. leancheck:Returns tiers of applications of a 3-argument constructor. leancheck:Returns tiers of applications of a 4-argument constructor. leancheck:Returns tiers of applications of a 5-argument constructor.Test.LeanCheck.Basic defines  up to &. Those are exported by default from Test.LeanCheck1, but are hidden from the Haddock documentation. leancheckDelays the enumeration of a. Conceptually this function adds to the weight of a constructor. Typically used when defining  instances: delay (cons<N> <Constr>) leancheckResets any delays in a list-of . Conceptually this function makes a constructor "weightless", assuring the first tier is non-empty. Typically used when defining Listable instances: reset (cons<N> <Constr>)Be careful: do not apply resetr to recursive data structure constructors. In general this will make the list of size 0 infinite, breaking the & invariant (each tier must be finite). leancheck&Tiers of values that follow a property cons<N> `suchThat` condition leancheckoLazily interleaves two lists, switching between elements of the two. Union/sum of the elements in the lists. #[x,y,z] +| [a,b,c] == [x,a,y,b,z,c] leancheck/Append tiers --- sum of two tiers enumerations. =[xs,ys,zs,...] \/ [as,bs,cs,...] = [xs++as,ys++bs,zs++cs,...] leancheckJInterleave tiers --- sum of two tiers enumerations. When in doubt, use  instead. =[xs,ys,zs,...] \/ [as,bs,cs,...] = [xs+|as,ys+|bs,zs+|cs,...] leancheck(Take a tiered product of lists of tiers. [t0,t1,t2,...] >< [u0,u1,u2,...] = [ t0**u0 , t0**u1 ++ t1**u0 , t0**u2 ++ t1**u1 ++ t2**u0 , ... ... ... ... ] where xs ** ys = [(x,y) | x <- xs, y <- ys]Example: [[0],[1],[2],...] >< [[0],[1],[2],...] == [ [(0,0)] , [(1,0),(0,1)] , [(2,0),(1,1),(0,2)] , [(3,0),(2,1),(1,2),(0,3)] ... ] leancheck,Take a tiered product of lists of tiers.  can be defined by , as: 4productWith f xss yss = map (uncurry f) $ xss >< yss leancheckList all results of a Q property. Each result is a pair of a list of strings and a boolean. The list of strings is a printable representation of one possible choice of argument values for the property. Each boolean paired with such a list indicates whether the property holds for this choice. The outer list is potentially infinite and lazily evaluated. leancheck?Lists all counter-examples for a number of tests to a property, leancheck2Up to a number of tests to a property, returns ?! the first counter-example or @ if there is none. LcounterExample 100 $ \xs -> [] `union` xs == (xs::[Int]) -- > Just ["[0,0]"] leancheck:Lists all witnesses up to a number of tests to a property, leancheck2Up to a number of tests to a property, returns ? the first witness or @ if there is none. leancheckDoes a property hold up to a number of test values? 1holds 1000 $ \xs -> length (sort xs) == length xs  leancheckDoes a property fail for a number of test values? (fails 1000 $ \xs -> xs ++ ys == ys ++ xs! leancheckThere existsT an assignment of values that satisfies a property up to a number of test values? exists 1000 $ \x -> x > 10" leancheckJBoolean implication operator. Useful for defining conditional properties: 4prop_something x y = condition x y ==> something x y& leancheck tiers :: [[ [Int] ]] = [ [ [] ] , [ [0] ] , [ [0,0], [1] ] , [ [0,0,0], [0,1], [1,0], [-1] ] , ... ] list :: [ [Int] ] = [ [], [0], [0,0], [1], [0,0,0], ... ]* leancheck tiers :: [[(Int,Int)]] = [ [(0,0)] , [(0,1),(1,0)] , [(0,-1),(1,1),(-1,0)] , ...] list :: [(Int,Int)] = [ (0,0), (0,1), (1,0), (0,-1), (1,1), ...], leancheck |tiers :: [[Maybe Int]] = [[Nothing], [Just 0], [Just 1], ...] tiers :: [[Maybe Bool]] = [[Nothing], [Just False, Just True]]- leancheck Btiers :: [[Bool]] = [[False,True]] list :: [[Bool]] = [False,True]0 leancheck }tiers :: [[Int]] = [[0], [1], [-1], [2], [-2], [3], [-3], ...] list :: [Int] = [0, 1, -1, 2, -2, 3, -3, 4, -4, 5, -5, 6, ...]#  !"# !  "5778"0(c) 2015-2018 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela <rudy@matela.com.br>Safe ; leancheckwResets the weight of a constructor (or tiers) Typically used as an infix constructor when defining Listable instances: cons<N> `ofWeight` <W>Be careful: do not apply ; 0 to recursive data structure constructors. In general this will make the list of size 0 infinite, breaking the tier invariant (each tier must be finite).; is closely related to .< leancheck,Adds to the weight of tiers of a constructor< is closely related to .,  !"456789:;< 456789:;<(c) 2015-2018 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela <rudy@matela.com.br>NoneF leancheck Derives a  instance for a given type A.Consider the following Stack datatype: (data Stack a = Stack a (Stack a) | EmptyWriting deriveListable ''Stack(will automatically derive the following  instance: Tinstance Listable a => Listable (Stack a) where tiers = cons2 Stack \/ cons0 Empty Needs the TemplateHaskell extension.G leancheckSame as F4 but does not warn when instance already exists (F is preferable).H leancheck Derives a  instance for a given type A3 cascading derivation of type arguments as well.I leancheck Given a type A9, derives an expression to be placed as the result of : 'consN C1 \/ consN C2 \/ ... \/ consN CNJ leancheck Given a type A9, derives an expression to be placed as the result of : 0concat $ consN C1 \/ consN C2 \/ ... \/ consN CNB leancheckgGiven 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.FGHIJFGHIJ(c) 2015-2018 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela <rudy@matela.com.br>SafeU(c) 2015-2018 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela <rudy@matela.com.br>SafeL leancheck&Checks a property printing results on stdout > check $ \xs -> sort (sort xs) == sort (xs::[Int]) +++ OK, passed 200 tests. > check $ \xs ys -> xs `union` ys == ys `union` (xs::[Int]) *** Failed! Falsifiable (after 4 tests): [] [0,0]M leancheckDCheck a property for a given number of tests printing results on stdoutN leancheck(Check a property printing results on stdout and returning C on success.JThere is no option to silence this function: for silence, you should use .O leancheckDCheck a property for a given number of tests printing results on stdout and returning C on success.JThere is no option to silence this function: for silence, you should use .LMNOLMNO(c) 2017-2018 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela <rudy@matela.com.br>SafeD leancheck;Fits a list to a certain width by appending a certain value fit ' ' 6 "str" == "str "  fit 0 6 [1,2,3] == [1,2,3,0,0,0]E leancheck:normalize makes all list the same length by adding a value @normalize ["asdf","qw","er"] == normalize ["asdf","qw ","er "]F leancheck0Given a list of lists returns the maximum length RSTUVWXYZ[ RSTUVWXYZ[(c) 2015-2018 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela <rudy@matela.com.br>SafeD1'\ leancheck[Given a constructor that takes a list, return tiers of applications of this constructor./This is basically a type-restricted version of  . You should use  6 instead: this serves more as an illustration of how ^ and ] work (see source).] leancheckqGiven a constructor that takes a bag of elements (as a list), lists tiers of applications of this constructor.For example, a Bag represented as a list.  bagCons Bag^ leancheckqGiven a constructor that takes a set of elements (as a list), lists tiers of applications of this constructor.A naive  instance for the  (of Data.Set) would read: Sinstance Listable a => Listable (Set a) where tiers = cons0 empty \/ cons2 insertThe above instance has a problem: it generates repeated sets. A more efficient implementation that does not repeat sets is given by:  tiers = setCons fromListAlternatively, you can use x direclty._ leancheckxGiven a constructor that takes a map of elements (encoded as a list), lists tiers of applications of this constructorSo long as the underlying H enumerations have no repetitions, this will generate no repetitions.4This allows defining an efficient implementation of ' that does not repeat maps given by:  tiers = mapCons fromList` leancheckvGiven a constructor that takes a list with no duplicate elements, return tiers of applications of this constructor.d leancheckLike , but over 3 lists of tiers.e leancheckLike , but over 3 lists of tiers.f leancheck@Take the product of lists of tiers by a function returning a G value discarding @ values.g leancheckbTakes as argument tiers of element values; returns tiers of pairs with distinct element values..When argument tiers have no repeated elements: 9distinctPairs xss = xss >< xss `suchThat` uncurry (/=)h leancheckg by a given function: 6distinctPairsWith f = mapT (uncurry f) . distinctPairsi leancheckTakes as argument tiers of element values; returns tiers of unordered pairs where, in enumeration order, the first element is less than or equal to the second.The name of this function is perhaps a misnomer. But in mathematics, an unordered pair is a pair where you don't care about element order, e.g.:  (1,2) = (2,1)r. This function will enumerate canonical versions of such pairs where the first element is less than the second.AThe returned element pairs can be seen as bags with two elements."When argument tiers are listed in H: 9distinctPairs xss = xss >< xss `suchThat` uncurry (<=)j leanchecki by a given function: 8unorderedPairsWith f = mapT (uncurry f) . unorderedPairsk leancheckTakes as argument tiers of element values; returns tiers of unordered pairs where, in enumeration order, the first element is strictly less than the second.AThe returned element pairs can be seen as sets with two elements."When argument tiers are listed in H: 8distinctPairs xss = xss >< xss `suchThat` uncurry (<)l leanchecki by a given function: HunorderedDistinctPairsWith f = mapT (uncurry f) . unorderedDistinctPairsm leancheckQTakes as argument tiers of element values; returns tiers of lists of elements. listsOf [[]] == [[[]]] listsOf [[x]] == [ [[]] , [[x]] , [[x,x]] , [[x,x,x]] , ... ] listsOf [[x],[y]] == [ [[]] , [[x]] , [[x,x],[y]] , [[x,x,x],[x,y],[y,x]] , ... ]n leancheckCTakes the product of N lists of tiers, producing lists of length N.Alternatively, takes as argument a list of lists of tiers of elements; returns lists combining elements of each list of tiers. products [xss] = mapT (:[]) xss products [xss,yss] = mapT (\(x,y) -> [x,y]) (xss >< yss) products [xss,yss,zss] = product3With (\x y z -> [x,y,z]) xss yss zsso leancheck3Delete the first occurence of an element in a tier.GFor normalized lists-of-tiers without repetitions, the following holds: ,deleteT x = normalizeT . (`suchThat` (/= x))p leancheckUNormalizes tiers by removing up to 12 empty tiers from the end of a list of tiers. qnormalizeT [xs0,xs1,...,xsN,[]] = [xs0,xs1,...,xsN] normalizeT [xs0,xs1,...,xsN,[],[]] = [xs0,xs1,...,xsN]wThe arbitrary limit of 12 tiers is necessary as this function would loop if there is an infinite trail of empty tiers.q leancheckConcatenate tiers of maybess leancheck,Discard elements _not_ matching a predicate. +discardT odd [[1],[2,3],[4]] = [[],[2],[4]]t leancheckYDiscard later elements maching a binary predicate (in relation to an earlier element). discardLaterT (>) [[0],[1],[-1],[2],[-2],...] = [[0],[],[-1],[],[-2],...] discardLaterT (==) [[0],[0,1],[0,1,2],[0,1,2,3],...] = [[0],[1],[2],[3]]VThis function is quite innefficient, use with care. Consuming the n-th element takes O(n^2) operations.u leancheckRemoves repetitions from tiers. ~nubT [[0],[0,1],[0,1,2],[0,1,2,3],...] = [[0],[1],[2],[3],...] nubT [[0],[-1,0,1],[-2,-1,0,1,2],...] = [[0],[-1,1],[-2,2],...]!Consuming the n-th element takes O(n^2) operations.v leancheck_Takes as argument tiers of element values; returns tiers of lists with no repeated elements. vnoDupListsOf [[0],[1],[2],...] == [ [[]] , [[0]] , [[1]] , [[0,1],[1,0],[2]] , [[0,2],[2,0],[3]] , ... ]w leancheckwTakes as argument tiers of element values; returns tiers of size-ordered lists of elements possibly with repetition. bagsOf [[0],[1],[2],...] = [ [[]] , [[0]] , [[0,0],[1]] , [[0,0,0],[0,1],[2]] , [[0,0,0,0],[0,0,1],[0,2],[1,1],[3]] , [[0,0,0,0,0],[0,0,0,1],[0,0,2],[0,1,1],[0,3],[1,2],[4]] , ... ]x leancheckqTakes as argument tiers of element values; returns tiers of size-ordered lists of elements without repetition. setsOf [[0],[1],[2],...] = [ [[]] , [[0]] , [[1]] , [[0,1],[2]] , [[0,2],[3]] , [[0,3],[1,2],[4]] , [[0,1,2],[0,4],[1,3],[5]] , ... ].Can be used in the constructor of specialized  instances. For  (from Data.Set), we would have: Tinstance Listable a => Listable (Set a) where tiers = mapT fromList $ setsOf tiersy leancheckTakes as arguments tiers of source and target values; returns tiers of maps from the source to the target encoded as lists without repetition.z leancheckTLists tiers of choices. Choices are pairs of values and tiers excluding that value. choices [[False,True]] == [[(False,[[True]]),(True,[[False]])]] choices [[1],[2],[3]] == [ [(1,[[],[2],[3]])] , [(2,[[1],[],[3]])] , [(3,[[1],[2],[]])] ].Each choice is sized by the extracted element.I leancheckLike z, but allows a custom function.{ leancheckLike zM but lists tiers of non-decreasing (ascending) choices. Used to construct w values. MbagChoices [[False,True]] = [ [(False,[[False,True]]), (True,[[True]])] ] ~bagChoices [[1],[2],[3],...] = [ [(1,[[1],[2],[3],...])] , [(2,[[ ],[2],[3],...])] , [(3,[[ ],[ ],[3],...])] , ... ]J leancheckLike { but customized by a function.| leancheckLike zE but lists tiers of strictly ascending choices. Used to construct x values. setChoices [[False,True]] == [[(False,[[True]]),(True,[[]])]] setChoices [[1],[2],[3]] == [ [(1,[[],[2],[3]])] , [(2,[[],[],[3]])] , [(3,[[],[],[]])] ]K leancheckLike | but customized by a function.} leancheckTakes as argument an integer length and tiers of element values; returns tiers of lists of element values of the given length. listsOfLength 3 [[0],[1],[2],[3],[4]...] = [ [[0,0,0]] , [[0,0,1],[0,1,0],[1,0,0]] , [[0,0,2],[0,1,1],[0,2,0],[1,0,1],[1,1,0],[2,0,0]] , ... ]L leancheckgShows a list of strings, one element per line. The returned string _does not_ end with a line break. listLines [] = "[]" listLines ["0"] = "[0]" listLines ["0","1"] = "[ 0\n\ \, 1\n\ \]"M leancheck\Shows a list, one element per line. The returned string _does not_ end with a line break. slistLines [] = "[]" listLines [0] = "[0]" listLines [0,1] = "[ 0\n\ \, 1\n\ \]"N leancheck Shows a list of strings, adding ...- to the end when longer than given length. dotsLongerThan 3 ["1","2"] = [1,2] dotsLongerThan 3 ["1","2","3","4"] = [1,2,3,...] dotsLongerThan 5 $ map show [1..] = [1,2,3,4,5,...]~ leancheckAlternative to O for ? with one element per line. (useful for debugging, see also ).0This function can be useful when debugging your  instances. leancheckAlternative to P for ? with one element per line. (useful for debugging, see also ~). x> printTiers 3 (tiers :: [[Int]]) [ [0] , [1] , [-1] , ... ] > printTiers 3 (tiers :: [[Bool]]) [ [ False , True ] ]0This function can be useful when debugging your  instances. leancheck$Checks if a list-of-tiers is finite.*Warning:** this is just an approximation, a list-of-tiers is considered finite if it has less than 13 values. This function may give false negatives.%\]^_`abcdefghijklmnopqrstuvwxyz{|}~%\^]_`abcdefmwxvny}ghijklopqrstuz|{~(c) 2015-2018 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela <rudy@matela.com.br>NoneG?  !"456789:;<FHLMNO]^_`efmnopvwx}? !"LMNO 456789:;< opFH^]`_efmxwvn}(c) 2015-2018 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela <rudy@matela.com.br>NoneT leancheckPGiven tiers of argument and result values, return tiers of functional values. leancheckGiven tiers of input values and tiers of output values, return tiers with all possible lists of input-output pairs. These represent functional relations. In the implementation of E, they represent exceptions to a constant function, hence the name .Q leancheck1Returns tiers of sets excluding the universe set. oincompleteSetsOf (tiers :: [[Bool]]) = [[],[[False],[True]],[]] incompleteSetsOf (tiers :: [[()]]) = [[]]This is the same as x on types with infinite values: AincompleteSetsOf (tiers :: [[Int]]) = setsOf (tiers :: [[Int]]) (c) 2015-2018 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela <rudy@matela.com.br>NoneV(c) 2015-2018 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela <rudy@matela.com.br>NoneXG (c) 2015-2018 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela <rudy@matela.com.br>NoneY (c) 2015-2018 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela <rudy@matela.com.br>None`R leancheckrTakes a value and a function. Ignores the value. Binds the argument of the function to the type of the value. leancheckTransforms a value into ? that value or @ on some errors:ArithExceptionArrayException ErrorCallPatternMatchFail leancheckTransforms a value into ? that value or @ on error.D "456789:;<FHLMNO]^_`efmnopvwx}D "456789:;<FHLMNO]^_`efmnopvwx} (c) 2015-2018 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela <rudy@matela.com.br>None leancheck"Is a given operator commutative?  x + y = y + x holds n $ commutative (+) 4fails n $ commutative union -- union [] [0,0] = [0] leancheck"Is a given operator associative? x + (y + z) = (x + y) + z leancheck5Does the first operator, distributes over the second? leancheck1Are two operators flipped versions of each other? Qholds n $ (<) `symmetric2` (>) -:> int holds n $ (<=) `symmetric2` (>=) -:> int Qfails n $ (<) `symmetric2` (>=) -:> int fails n $ (<=) `symmetric2` (>) -:> int leancheckIs a given relation transitive? leancheck'An element is always related to itself. leancheckAn element is never related to itself. leancheckEIs a given relation symmetric? This is a type-restricted version of . leancheck]Is a given relation antisymmetric? Not to be confused with "not symmetric" and "assymetric". leancheck]Is a given relation asymmetric? Not to be confused with "not symmetric" and "antissymetric". leancheckjIs the given binary relation an equivalence? Is the given relation reflexive, symmetric and transitive? > check (equivalence (==) :: Int -> Int -> Int -> Bool) +++ OK, passed 200 tests. > check (equivalence (<=) :: Int -> Int -> Int -> Bool) *** Failed! Falsifiable (after 3 tests): 0 1 0 Or, using  Test.LeanCheck.Utils.TypeBinding: Q> check $ equivalence (<=) -:> int *** Failed! Falsifiable (after 3 tests): 0 1 0 leancheckoIs the given binary relation a partial order? Is the given relation reflexive, antisymmetric and transitive? leancheckuIs the given binary relation a strict partial order? Is the given relation irreflexive, asymmetric and transitive? leancheck+Is the given binary relation a total order? leancheck2Is the given binary relation a strict total order? leancheck"Is the given function idempotent?  f (f x) == x 2holds n $ idempotent abs holds n $ idempotent sort fails n $ idempotent negate leancheck#Is the given function an identity? f x == x Xholds n $ identity (+0) holds n $ identity (sort :: [()]) holds n $ identity (not . not) leancheck)Is the given function never an identity? f x /= x holds n $ neverIdentity not Cfails n $ neverIdentity negate -- yes, fails: negate 0 == 0, hah!4Note: this is not the same as not being an identity. leancheck8Equal under, a ternary operator with the same fixity as S. x =$ f $= y = f x = f y n[1,2,3,4,5] =$ take 2 $= [1,2,4,8,16] -- > True [1,2,3,4,5] =$ take 3 $= [1,2,4,8,16] -- > False [1,2,3] =$ sort $= [3,2,1] -- > True 42 =$ (`mod` 10) $= 16842 -- > True 42 =$ (`mod` 9) $= 16842 -- > False 'a' =$ isLetter $= 'b' -- > True 'a' =$ isLetter $= '1' -- > False leancheckSee  leancheck!Check if two lists are equal for n1 values. This operator has the same fixity of S. (xs =| n |= ys = take n xs == take n ys V[1,2,3,4,5] =| 2 |= [1,2,4,8,16] -- > True [1,2,3,4,5] =| 3 |= [1,2,4,8,16] -- > False leancheckSee !! 4433T3224444 (c) 2015-2018 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela <rudy@matela.com.br>None leancheck>Wrap around lists of integers for an enumeration containing e--treme integer values. ^> check $ \xs -> all (>=0) xs ==> sum (take 1 xs :: [Int]) <= sum xs +++ OK, passed 200 tests. > check $ \(Xs xs) -> all (>=0) xs ==> sum (take 1 xs :: [Int]) <= sum xs *** Failed! Falsifiable (after 56 tests): [1,9223372036854775807] leancheck2 type to be wrapped around integer types for an e-(-treme integer enumeration. See the  instance for . Use 9 when testing properties about overflows and the like: <> check $ \x -> x + 1 > (x :: Int) +++ OK, passed 200 tests. c> check $ \(X x) -> x + 1 > (x :: Int) +++ Failed! Falsifiable (after 4 tests): 9223372036854775807 leancheck)Lists of pairs representing maps. The  ) enumeration will not have repeated maps. e> take 6 (list :: [Map Nat Nat]) [Map [],Map [(0,0)],Map [(0,1)],Map [(1,0)],Map [(0,2)],Map [(1,1)]] leancheck Lists representing sets. The  ) enumeration will not have repeated sets. Q> take 6 (list :: [Set Nat]) [Set [],Set [0],Set [1],Set [0,1],Set [2],Set [0,2]] leancheck,Lists representing bags (multisets). The  ) enumeration will not have repeated bags. U> take 6 (list :: [Bag Nat]) [Bag [],Bag [0],Bag [0,0],Bag [1],Bag [0,0,0],Bag [0,1]] See also: bagsOf and ]. leancheck Lists without repeated elements. _> take 6 $ list :: [NoDup Nat] [NoDup [],NoDup [0],NoDup [1],NoDup [0,1],NoDup [1,0],NoDup [2]]$Example, checking the property that nub is an identity: import Data.List (nub) > check $ \xs -> nub xs == (xs :: [Int]) *** Failed! Falsifiable (after 3 tests): [0,0] > check $ \(NoDup xs) -> nub xs == (xs :: [Int]) +++ OK, passed 200 tests. leancheckDeprecated. Use . leancheckDeprecated. Use . leancheckDeprecated. Use . leancheckDeprecated. Use . leancheck-Natural numbers modulo 7: 0, 1, 2, 3, 4, 5, 6 leancheck*Natural numbers modulo 6: 0, 1, 2, 3, 4, 5 leancheck'Natural numbers modulo 5: 0, 1, 2, 3, 4 leancheck$Natural numbers modulo 4: 0, 1, 2, 3 leancheck!Natural numbers modulo 3: 0, 1, 2 leancheckNatural numbers modulo 2: 0, 1 leancheckNatural numbers modulo 1: 0 leancheck:Natural numbers (including 0): 0, 1, 2, 3, 4, 5, 6, 7, ...+Internally, this type is represented as an U. So, it is limited by the V of U. leancheck:Natural numbers (including 0): 0, 1, 2, 3, 4, 5, 6, 7, ...+Internally, this type is represented as an W. allowing for an infinity of possible values.Its X and R instances only produce non-negative values. Negatives can still be generated by Y or subtraction. leancheckQFour-bit unsigned integers: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 leancheck3Three-bit unsigned integers: 0, 1, 2, 3, 4, 5, 6, 7 leancheck%Two-bit unsigned integers: 0, 1, 2, 3 leancheck!Single-bit unsigned integer: 0, 1 leancheckQFour-bit signed integers: -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7 leancheck5Three-bit signed integers: -4, -3, -2, -1, 0, 1, 2, 3 leancheck%Two-bit signed integers: -2, -1, 0, 1 leancheck!Single-bit signed integers: -1, 0Z leancheckLazily interleaves two lists, switching between elements of the two. This version uses the first list more frequently than the second. &[x,y,z,w] +| [a,b] == [x,y, a, z,w, b] leancheck>Extremily large integers are intercalated with small integers. list :: [X Int] = map X [ 0, 1, -1, maxBound, minBound , 2, -2, maxBound-1, minBound+1 , 3, -3, maxBound-2, minBound+2 , ... ] leancheckLists with elements of the  type.DDZ5(c) 2015-2018 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela <rudy@matela.com.br>None4 leancheckvType restricted version of const that forces its first argument to have the same type as the second. A symnonym to [:  value -: ty = value :: Ty Examples: P 10 -: int = 10 :: Int undefined -: 'a' >- 'b' = undefined :: Char -> Char leancheckvType restricted version of const that forces the argument of its first argument to have the same type as the second: - f -:> ty = f -: ty >- und = f :: Ty -> aExample: 9 abs -:> int = abs -: int >- und = abs :: Int -> Int leanchecktType restricted version of const that forces the result of its first argument to have the same type as the second. - f ->: ty = f -: und >- ty = f :: a -> Ty leancheck}Type restricted version of const that forces the second argument of its first argument to have the same type as the second. :f ->:> ty = f -: und -> ty -> und = f :: a -> Ty -> b leancheckType restricted version of const that forces the result of the result of its first argument to have the same type as the second. :f ->>: ty = f -: und -> und -> ty = f :: a -> b -> Ty leancheck|Type restricted version of const that forces the third argument of its first argument to have the same type as the second. leancheckType restricted version of const that forces the result of the result of the result of its first argument to have the same type as the second. leancheckForces the 4th argument type. leancheck0Forces the result type of a 4-argument function. leancheckForces the 5th argument type. leancheck0Forces the result type of a 5-argument function. leancheckForces the 6th argument type. leancheck0Forces the result type of a 6-argument function. leancheckForces the 7th argument type. leancheck0Forces the result type of a 7-argument function. leancheckForces the 8th argument type. leancheck0Forces the result type of a 8-argument function. leancheckForces the 9th argument type. leancheck0Forces the result type of a 9-argument function. leancheck%Forces the type of the 10th argument. leancheck1Forces the result type of a 10-argument function. leancheck%Forces the type of the 11th argument. leancheck1Forces the result type of a 11-argument function. leancheck%Forces the type of the 12th argument. leancheck1Forces the result type of a 12-argument function. leancheckReturns an undefined functional value that takes an argument of the type of its first argument and return a value of the type of its second argument. $ty >- ty = (undefined :: Ty -> Ty) Examples: r'a' >- 'b' = char >- char = (undefined :: Char -> Char) int >- bool >- int = undefined :: Int -> Bool -> Int leancheckShorthand for undefined leancheck Undefined U+ value for use with type binding operators. )check $ (\x y -> x + y == y + x) ->:> int leancheck Undefined W+ value for use with type binding operators. -check $ (\x y -> x + y == y + x) ->:> integer leancheck Undefined \+ value for use with type binding operators. leancheck Undefined ]+ value for use with type binding operators. leancheck Undefined ^+ value for use with type binding operators. leancheck Undefined _ value. leancheck Undefined ` value. leancheck Undefined a value. leancheck Undefined b value. leancheck Undefined Gh value. Uses the type of the given value as the argument type. For use with type binding operators.5To check a property with the first argument bound to G U, do: check $ prop -:> mayb int leancheck Undefined ck value. Uses the types of the given values as the argument types. For use with type binding operators. leancheck Undefined  value. leancheck Undefined  value. leancheck Undefined  value. leancheck Undefined  value. leancheck Undefined  value. leancheck Undefined  value. leancheck Undefined  value. leancheck Undefined  value. leancheck Undefined  value. leancheck Undefined  value. leancheckDeprecated. Use . leancheckDeprecated. Use . leancheckDeprecated. Use . leancheckDeprecated. Use .4411111111111111111111111119 (c) 2015-2018 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela <rudy@matela.com.br>NoneRSTUVWXYZ[(c) 2015-2018 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela <rudy@matela.com.br>None leancheckEThis typeclass _does not currently work_. It is a stub and a sketch. is similar to  CoListable3 but a bit more complex to avoid some repetitions.d9 (c) 2015-2018 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela <rudy@matela.com.br>None leancheck>This _does not currently work_. Its just a sketch and a stub.Generation of  functions using .. This is similar to SmallCheck's coseries.1The current implementation generates repetitions.e9 (c) 2015-2018 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela <rudy@matela.com.br>None!(c) 2015-2018 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela <rudy@matela.com.br>None#4(c) 2015-2018 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela <rudy@matela.com.br>None@ leancheckK values are those for which we can return a list of functional bindings.As a user, you probably want  and ..Non functional instances should be defined by: 8instance ShowFunction Ty where tBindings = tBindingsShow leancheck*A functional binding in a showable format. leancheckGiven a = value, return a list of bindings for printing. Examples: .bindings True == [([],True)] bindings (id::Int) == [(["0"],"0"), (["1"],"1"), (["-1"],"-1"), ... bindings (&&) == [ (["False","False"], "False") , (["False","True"], "False") , (["True","False"], "False") , (["True","True"], "True") ] leancheck2A default implementation of tBindings for already f -able types. leancheck,Given a number of patterns to show, shows a  value. 6showFunction undefined True == "True" showFunction 3 (id::Int) == "\\x -> case x of\n\ \ 0 -> 0\n\ \ 1 -> 1\n\ \ -1 -> -1\n\ \ ...\n" showFunction 4 (&&) == "\\x y -> case (x,y) of\n\ \ (False,False) -> False\n\ \ (False,True) -> False\n\ \ (True,False) -> False\n\ \ (True,True) -> True\n"<This can be used as an implementation of show for functions: Zinstance (Show a, Listable a, ShowFunction b) => Show (a->b) where show = showFunction 8 leancheck-Same as showFunction, but has no line breaks. BshowFunction 2 (id::Int) == "\\x -> case x of 0 -> 0; 1 -> 1; ..."g leancheckuisUndefined checks if a function is totally undefined. When it is not possible to check all values, it returns false(c) 2015-2018 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela <rudy@matela.com.br>NoneB(c) 2015-2018 Rudy Matela$3-Clause BSD (see the file LICENSE) Rudy Matela <rudy@matela.com.br>NoneD`h !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  > ? ; = : < 9                                                                                    ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~                                                              !"#$%&'()*+,-./01203403506708901:06;06<=>?@ABCDEF06GAHIJKLMNO0PQ0RST UAHV WABX0YZ[\]0Y^0_` a06bABcABd03eABfABg06hABi0jkll0Pmno&leancheck-0.7.2-EPNsNkdnB3GGru5dgPw3paTest.LeanCheck.CoreTest.LeanCheck.BasicTest.LeanCheck.DeriveTest.LeanCheck.Function.EqTest.LeanCheck.IOTest.LeanCheck.StatsTest.LeanCheck.Tiers$Test.LeanCheck.Function.ListsOfPairs-Test.LeanCheck.Function.Listable.ListsOfPairs)Test.LeanCheck.Function.Listable.PeriodicTest.LeanCheck.ErrorTest.LeanCheck.Utils.OperatorsTest.LeanCheck.Utils.Types Test.LeanCheck.Utils.TypeBinding,Test.LeanCheck.Function.Listable.FunListable"Test.LeanCheck.Function.CoListable&Test.LeanCheck.Function.Listable.Mixed+Test.LeanCheck.Function.Listable.CoListable$Test.LeanCheck.Function.ShowFunctionTest.LeanCheck.Function.ShowderiveListablecons6cons12Test.LeanCheckholdsData.SetSet Test.LeanCheck.Function.ListableTest.LeanCheck.UtilsTest.LeanCheck.FunctionTestable resultiersListabletierslisttoTiers listIntegraltiersFractionalmapTfilterTconcatT concatMapTcons0cons1cons2cons3cons4cons5delayresetsuchThat+|\/\\//>< productWithresultscounterExamplescounterExample witnesseswitnessfailsexists==>$fListableOrdering$fListableDouble$fListableFloat $fListable[]$fListable(,,,,)$fListable(,,,)$fListable(,,) $fListable(,)$fListableEither$fListableMaybe$fListableBool$fListableChar$fListableInteger $fListableInt $fListable()$fTestable(->)$fTestableBoolcons7cons8cons9cons10cons11ofWeight addWeight$fListableWord$fListableRatio$fListable(,,,,,,,,,,,)$fListable(,,,,,,,,,,)$fListable(,,,,,,,,,)$fListable(,,,,,,,,)$fListable(,,,,,,,)$fListable(,,,,,,)$fListable(,,,,,)deriveListableIfNeededderiveListableCascading deriveTiers deriveList$fEq(->)checkcheckFor checkResultcheckResultFor $fEqResult $fShowResult classStats classStatsTconditionStatsconditionStatsTclassify classifyBy classifyOncountscountsBycountsOnlistConsbagConssetConsmapCons noDupListCons maybeCons0 maybeCons1 maybeCons2product3 product3WithproductMaybeWith distinctPairsdistinctPairsWithunorderedPairsunorderedPairsWithunorderedDistinctPairsunorderedDistinctPairsWithlistsOfproductsdeleteT normalizeT catMaybesT mapMaybeTdiscardT discardLaterTnubT noDupListsOfbagsOfsetsOfmapschoices bagChoices setChoices listsOfLength showTiers printTiersfinite-->>exceptionPairs$fListable(->)errorToNothinganyErrorToNothing errorToFalse errorToTrue fromError=======&&&&&&&||||||| commutative associative distributive symmetric2 transitive reflexive irreflexive symmetric antisymmetric asymmetric equivalence partialOrderstrictPartialOrder totalOrderstrictTotalOrder comparison idempotentidentity neverIdentityokEqokOrdokEqOrdokNum=$$==||=XsXunXMapBagNoDupUInt4UInt3UInt2UInt1Nat7unNat7Nat6unNat6Nat5unNat5Nat4unNat4Nat3unNat3Nat2unNat2Nat1unNat1NatunNatNatural unNaturalWord4unWord4Word3unWord3Word2unWord2Word1unWord1Int4unInt4Int3unInt3Int2unInt2Int1unInt1$fListableInt1 $fEnumInt1 $fBoundedInt1$fIntegralInt1 $fRealInt1 $fNumInt1 $fReadInt1 $fShowInt1$fListableInt2 $fEnumInt2 $fBoundedInt2$fIntegralInt2 $fRealInt2 $fNumInt2 $fReadInt2 $fShowInt2$fListableInt3 $fEnumInt3 $fBoundedInt3$fIntegralInt3 $fRealInt3 $fNumInt3 $fReadInt3 $fShowInt3$fListableInt4 $fEnumInt4 $fBoundedInt4$fIntegralInt4 $fRealInt4 $fNumInt4 $fReadInt4 $fShowInt4$fListableWord1 $fEnumWord1$fBoundedWord1$fIntegralWord1 $fRealWord1 $fNumWord1 $fReadWord1 $fShowWord1$fListableWord2 $fEnumWord2$fBoundedWord2$fIntegralWord2 $fRealWord2 $fNumWord2 $fReadWord2 $fShowWord2$fListableWord3 $fEnumWord3$fBoundedWord3$fIntegralWord3 $fRealWord3 $fNumWord3 $fReadWord3 $fShowWord3$fListableWord4 $fEnumWord4$fBoundedWord4$fIntegralWord4 $fRealWord4 $fNumWord4 $fReadWord4 $fShowWord4$fListableNatural $fEnumNatural$fIntegralNatural $fRealNatural $fNumNatural $fReadNatural $fShowNatural $fListableNat $fEnumNat $fBoundedNat $fIntegralNat $fRealNat$fNumNat $fReadNat $fShowNat$fListableNat1 $fEnumNat1 $fBoundedNat1$fIntegralNat1 $fRealNat1 $fNumNat1 $fReadNat1 $fShowNat1$fListableNat2 $fEnumNat2 $fBoundedNat2$fIntegralNat2 $fRealNat2 $fNumNat2 $fReadNat2 $fShowNat2$fListableNat3 $fEnumNat3 $fBoundedNat3$fIntegralNat3 $fRealNat3 $fNumNat3 $fReadNat3 $fShowNat3$fListableNat4 $fEnumNat4 $fBoundedNat4$fIntegralNat4 $fRealNat4 $fNumNat4 $fReadNat4 $fShowNat4$fListableNat5 $fEnumNat5 $fBoundedNat5$fIntegralNat5 $fRealNat5 $fNumNat5 $fReadNat5 $fShowNat5$fListableNat6 $fEnumNat6 $fBoundedNat6$fIntegralNat6 $fRealNat6 $fNumNat6 $fReadNat6 $fShowNat6$fListableNat7 $fEnumNat7 $fBoundedNat7$fIntegralNat7 $fRealNat7 $fNumNat7 $fReadNat7 $fShowNat7$fListableNoDup $fListableBag $fListableSet $fListableMap $fListableX$fShowX $fListableXs$fEqInt1 $fOrdInt1$fEqInt2 $fOrdInt2$fEqInt3 $fOrdInt3$fEqInt4 $fOrdInt4 $fEqWord1 $fOrdWord1 $fEqWord2 $fOrdWord2 $fEqWord3 $fOrdWord3 $fEqWord4 $fOrdWord4 $fEqNatural $fOrdNatural$fEqNat$fOrdNat$fEqNat1 $fOrdNat1$fEqNat2 $fOrdNat2$fEqNat3 $fOrdNat3$fEqNat4 $fOrdNat4$fEqNat5 $fOrdNat5$fEqNat6 $fOrdNat6$fEqNat7 $fOrdNat7 $fShowNoDup $fReadNoDup $fEqNoDup $fOrdNoDup $fShowBag $fReadBag$fEqBag$fOrdBag $fShowSet $fReadSet$fEqSet$fOrdSet $fShowMap $fReadMap$fEqMap$fOrdMap$fEqX$fOrdX$fEqXs$fOrdXs$fShowXs$fReadXs-:-:>->:->:>->>:->>:>->>>:->>>:>->>>>:->>>>:>->>>>>:->>>>>:>->>>>>>: ->>>>>>:> ->>>>>>>: ->>>>>>>:> ->>>>>>>>: ->>>>>>>>:> ->>>>>>>>>: ->>>>>>>>>:> ->>>>>>>>>>: ->>>>>>>>>>:> ->>>>>>>>>>>:->>>>>>>>>>>:>->>>>>>>>>>>>:>-undintintegerfloatdoublerationalboolcharstringorderingmaybeithnaturalnatint1int2int3int4word1word2word3word4uint1uint2uint3uint4 FunListable validResultsinvalidResultsfuntiers$fFunListableNat3$fFunListableNat2$fFunListableNat$fFunListableInt$fFunListable(,)$fFunListable[]$fFunListableEither$fFunListableMaybe$fFunListableBool$fFunListable() CoListablecotiers$fCoListableNat3$fCoListableNat2$fCoListableNat$fCoListableInt$fCoListable(,)$fCoListable[]$fCoListableEither$fCoListableMaybe$fCoListableBool$fCoListable() ShowFunction tBindingsBindingbindings tBindingsShow showFunctionshowFunctionLine$fShowFunctionWord4$fShowFunctionWord3$fShowFunctionWord2$fShowFunctionWord1$fShowFunctionInt4$fShowFunctionInt3$fShowFunctionInt2$fShowFunctionInt1$fShowFunctionNat7$fShowFunctionNat6$fShowFunctionNat5$fShowFunctionNat4$fShowFunctionNat3$fShowFunctionNat2$fShowFunctionNat1$fShowFunctionNat$fShowFunction(,,,,,,,)$fShowFunction(,,,,,,)$fShowFunction(,,,,,)$fShowFunction(,,,,)$fShowFunction(,,,)$fShowFunction(,,)$fShowFunction(->)$fShowFunction(,)$fShowFunctionEither$fShowFunctionMaybe$fShowFunction[]$fShowFunctionOrdering$fShowFunctionDouble$fShowFunctionFloat$fShowFunctionChar$fShowFunctionInteger$fShowFunctionInt$fShowFunctionBool$fShowFunction() $fShow(->)base Data.FoldableconcatGHC.RealIntegral FractionalGHC.BasemapGHC.Listfilter concatMapJustNothingtemplate-haskellLanguage.Haskell.TH.SyntaxName typeArityghc-prim GHC.TypesTruefit normalize maxLengthMaybe GHC.ClassesOrd choicesWithbagChoicesWithsetChoicesWith listLines showListLinesdotsLongerThanGHC.Showshow System.IOprintincompleteSetsOfbindArgumentType==&&&&&IntGHC.EnummaxBound integer-gmpGHC.Integer.TypeIntegerEnumGHC.Numnegate++|asTypeOfFloatDoubleRationalBoolCharStringOrdering Data.EitherEither\+:/Show isUndefined