-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Cholesterol-free property-based testing
--   
--   LeanCheck is a simple enumerative property-based testing library.
--   
--   Properties are defined as Haskell functions returning a boolean value
--   which should be true for all possible choices of argument values.
--   LeanCheck applies enumerated argument values to these properties in
--   search for a counterexample. Properties can be viewed as parameterized
--   unit tests.
--   
--   LeanCheck works by producing tiers of test values: a possibly infinite
--   list of finite sublists of same-and-increasingly-sized values.
--   
--   LeanCheck has lean core with only 180 lines of Haskell code.
@package leancheck
@version 0.7.0


-- | LeanCheck is a simple enumerative property-based testing library.
--   
--   This is the core module of the library, with the most basic
--   definitions. If you are looking just to use the library, import and
--   see <a>Test.LeanCheck</a>.
--   
--   If you want to understand how the code works, this is the place to
--   start reading.
--   
--   Other important modules:
--   
--   <ul>
--   <li><a>Test.LeanCheck.Basic</a> exports: <a>Test.LeanCheck.Core</a>,
--   additional <a>tiers</a> constructors (<a>cons6</a> ... <a>cons12</a>)
--   and <a>Listable</a> tuple instances.</li>
--   <li><a>Test.LeanCheck.Tiers</a> exports: functions for advanced
--   Listable definitions.</li>
--   <li><a>Test.LeanCheck</a> exports: <a>Test.LeanCheck.Basic</a>, most
--   of <a>Test.LeanCheck.Tiers</a> and <a>deriveListable</a>.</li>
--   </ul>
module Test.LeanCheck.Core

-- | Does a property <b>hold</b> up to a number of test values?
--   
--   <pre>
--   holds 1000 $ \xs -&gt; length (sort xs) == length xs
--   </pre>
holds :: Testable a => Int -> a -> Bool

-- | Does a property <b>fail</b> for a number of test values?
--   
--   <pre>
--   fails 1000 $ \xs -&gt; xs ++ ys == ys ++ xs
--   </pre>
fails :: Testable a => Int -> a -> Bool

-- | There <b>exists</b> an assignment of values that satisfies a property
--   up to a number of test values?
--   
--   <pre>
--   exists 1000 $ \x -&gt; x &gt; 10
--   </pre>
exists :: Testable a => Int -> a -> Bool

-- | Up to a number of tests to a property, returns <a>Just</a> the first
--   counter-example or <a>Nothing</a> if there is none.
--   
--   <pre>
--   counterExample 100 $ \xs -&gt; [] `union` xs == (xs::[Int])
--   -- &gt; Just ["[0,0]"]
--   </pre>
counterExample :: Testable a => Int -> a -> Maybe [String]

-- | Lists all counter-examples for a number of tests to a property,
counterExamples :: Testable a => Int -> a -> [[String]]

-- | Up to a number of tests to a property, returns <a>Just</a> the first
--   witness or <a>Nothing</a> if there is none.
witness :: Testable a => Int -> a -> Maybe [String]

-- | Lists all witnesses up to a number of tests to a property,
witnesses :: Testable a => Int -> a -> [[String]]

-- | <a>Testable</a> values are functions of <a>Listable</a> arguments that
--   return boolean values, e.g.:
--   
--   <ul>
--   <li><pre> Bool</pre></li>
--   <li><pre> Listable a =&gt; a -&gt; Bool</pre></li>
--   <li><pre> Listable a =&gt; a -&gt; a -&gt; Bool</pre></li>
--   <li><pre> Int -&gt; Bool</pre></li>
--   <li><pre> String -&gt; [Int] -&gt; Bool</pre></li>
--   </ul>
class Testable a
resultiers :: Testable a => a -> [[([String], Bool)]]

-- | List all results of a <a>Testable</a> 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.
results :: Testable a => a -> [([String], Bool)]

-- | A type is <a>Listable</a> when there exists a function that is able to
--   list (ideally all of) its values.
--   
--   Ideally, instances should be defined by a <a>tiers</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 <a>tiers</a> is
--   
--   <pre>
--   tiers = cons&lt;N&gt; ConstructorA
--        \/ cons&lt;N&gt; ConstructorB
--        \/ ...
--        \/ cons&lt;N&gt; ConstructorZ
--   </pre>
--   
--   where <tt>N</tt> is the number of arguments of each constructor
--   <tt>A...Z</tt>.
--   
--   Instances can be alternatively defined by <a>list</a>. In this case,
--   each sub-list in <a>tiers</a> is a singleton list (each succeeding
--   element of <a>list</a> has +1 size).
--   
--   The function <a>deriveListable</a> from <a>Test.LeanCheck.Derive</a>
--   can automatically derive instances of this typeclass.
--   
--   A <a>Listable</a> instance for functions is also available but is not
--   exported by default. Import <a>Test.LeanCheck.Function</a> if you need
--   to test higher-order properties.
class Listable a
tiers :: Listable a => [[a]]
list :: Listable a => [a]

-- | Given a constructor with no arguments, returns <a>tiers</a> 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.
cons0 :: a -> [[a]]

-- | Given a constructor with one <a>Listable</a> argument, return
--   <a>tiers</a> of applications of this constructor. By default, returned
--   values will have size/weight of 1.
cons1 :: Listable a => (a -> b) -> [[b]]

-- | Given a constructor with two <a>Listable</a> arguments, return
--   <a>tiers</a> of applications of this constructor. By default, returned
--   values will have size/weight of 1.
cons2 :: (Listable a, Listable b) => (a -> b -> c) -> [[c]]

-- | Returns tiers of applications of a 3-argument constructor.
cons3 :: (Listable a, Listable b, Listable c) => (a -> b -> c -> d) -> [[d]]

-- | Returns tiers of applications of a 4-argument constructor.
cons4 :: (Listable a, Listable b, Listable c, Listable d) => (a -> b -> c -> d -> e) -> [[e]]

-- | Returns tiers of applications of a 5-argument constructor.
--   
--   <a>Test.LeanCheck.Basic</a> defines <a>cons6</a> up to <a>cons12</a>.
--   Those are exported by default from <a>Test.LeanCheck</a>, but are
--   hidden from the Haddock documentation.
cons5 :: (Listable a, Listable b, Listable c, Listable d, Listable e) => (a -> b -> c -> d -> e -> f) -> [[f]]

-- | Delays the enumeration of <a>tiers</a>. Conceptually this function
--   adds to the weight of a constructor. Typically used when defining
--   <a>Listable</a> instances:
--   
--   <pre>
--   delay (cons&lt;N&gt; &lt;Constr&gt;)
--   </pre>
delay :: [[a]] -> [[a]]

-- | Resets any delays in a list-of <a>tiers</a>. Conceptually this
--   function makes a constructor "weightless", assuring the first tier is
--   non-empty. Typically used when defining Listable instances:
--   
--   <pre>
--   reset (cons&lt;N&gt; &lt;Constr&gt;)
--   </pre>
--   
--   Be careful: do not apply <tt>reset</tt> to recursive data structure
--   constructors. In general this will make the list of size 0 infinite,
--   breaking the <a>tiers</a> invariant (each tier must be finite).
reset :: [[a]] -> [[a]]

-- | Tiers of values that follow a property
--   
--   <pre>
--   cons&lt;N&gt; `suchThat` condition
--   </pre>
suchThat :: [[a]] -> (a -> Bool) -> [[a]]

-- | Append tiers --- sum of two tiers enumerations.
--   
--   <pre>
--   [xs,ys,zs,...] \/ [as,bs,cs,...] = [xs++as,ys++bs,zs++cs,...]
--   </pre>
(\/) :: [[a]] -> [[a]] -> [[a]]
infixr 7 \/

-- | Interleave tiers --- sum of two tiers enumerations. When in doubt, use
--   <a>\/</a> instead.
--   
--   <pre>
--   [xs,ys,zs,...] \/ [as,bs,cs,...] = [xs+|as,ys+|bs,zs+|cs,...]
--   </pre>
(\\//) :: [[a]] -> [[a]] -> [[a]]
infixr 7 \\//

-- | Take a tiered product of lists of tiers.
--   
--   <pre>
--   [t0,t1,t2,...] &gt;&lt; [u0,u1,u2,...] =
--   [ t0**u0
--   , t0**u1 ++ t1**u0
--   , t0**u2 ++ t1**u1 ++ t2**u0
--   , ...       ...       ...       ...
--   ]
--   where xs ** ys = [(x,y) | x &lt;- xs, y &lt;- ys]
--   </pre>
--   
--   Example:
--   
--   <pre>
--   [[0],[1],[2],...] &gt;&lt; [[0],[1],[2],...]
--   == [  [(0,0)]
--      ,  [(1,0),(0,1)]
--      ,  [(2,0),(1,1),(0,2)]
--      ,  [(3,0),(2,1),(1,2),(0,3)]
--      ...
--      ]
--   </pre>
(><) :: [[a]] -> [[b]] -> [[(a, b)]]
infixr 8 ><

-- | Take a tiered product of lists of tiers. <a>productWith</a> can be
--   defined by <a>&gt;&lt;</a>, as:
--   
--   <pre>
--   productWith f xss yss = map (uncurry f) $ xss &gt;&lt; yss
--   </pre>
productWith :: (a -> b -> c) -> [[a]] -> [[b]] -> [[c]]

-- | <a>map</a> over tiers
mapT :: (a -> b) -> [[a]] -> [[b]]

-- | <a>filter</a> tiers
filterT :: (a -> Bool) -> [[a]] -> [[a]]

-- | <a>concat</a> tiers of tiers
concatT :: [[[[a]]]] -> [[a]]

-- | <a>concatMap</a> over tiers
concatMapT :: (a -> [[b]]) -> [[a]] -> [[b]]

-- | Takes a list of values <tt>xs</tt> and transform it into tiers on
--   which each tier is occupied by a single element from <tt>xs</tt>.
--   
--   To convert back to a list, just <a>concat</a>.
toTiers :: [a] -> [[a]]

-- | Boolean implication operator. Useful for defining conditional
--   properties:
--   
--   <pre>
--   prop_something x y = condition x y ==&gt; something x y
--   </pre>
(==>) :: Bool -> Bool -> Bool
infixr 0 ==>

-- | Lazily interleaves two lists, switching between elements of the two.
--   Union/sum of the elements in the lists.
--   
--   <pre>
--   [x,y,z] +| [a,b,c] == [x,a,y,b,z,c]
--   </pre>
(+|) :: [a] -> [a] -> [a]
infixr 5 +|

-- | Tiers of <a>Integral</a> values. Can be used as a default
--   implementation of <a>list</a> for <a>Integral</a> types.
listIntegral :: (Enum a, Num a) => [a]

-- | Tiers of <a>Fractional</a> values. This can be used as the
--   implementation of <a>tiers</a> for <a>Fractional</a> types.
tiersFractional :: Fractional a => [[a]]
instance Test.LeanCheck.Core.Testable GHC.Types.Bool
instance (Test.LeanCheck.Core.Testable b, GHC.Show.Show a, Test.LeanCheck.Core.Listable a) => Test.LeanCheck.Core.Testable (a -> b)
instance Test.LeanCheck.Core.Listable ()
instance Test.LeanCheck.Core.Listable GHC.Types.Int
instance Test.LeanCheck.Core.Listable GHC.Integer.Type.Integer
instance Test.LeanCheck.Core.Listable GHC.Types.Char
instance Test.LeanCheck.Core.Listable GHC.Types.Bool
instance Test.LeanCheck.Core.Listable a => Test.LeanCheck.Core.Listable (GHC.Base.Maybe a)
instance (Test.LeanCheck.Core.Listable a, Test.LeanCheck.Core.Listable b) => Test.LeanCheck.Core.Listable (Data.Either.Either a b)
instance (Test.LeanCheck.Core.Listable a, Test.LeanCheck.Core.Listable b) => Test.LeanCheck.Core.Listable (a, b)
instance (Test.LeanCheck.Core.Listable a, Test.LeanCheck.Core.Listable b, Test.LeanCheck.Core.Listable c) => Test.LeanCheck.Core.Listable (a, b, c)
instance (Test.LeanCheck.Core.Listable a, Test.LeanCheck.Core.Listable b, Test.LeanCheck.Core.Listable c, Test.LeanCheck.Core.Listable d) => Test.LeanCheck.Core.Listable (a, b, c, d)
instance (Test.LeanCheck.Core.Listable a, Test.LeanCheck.Core.Listable b, Test.LeanCheck.Core.Listable c, Test.LeanCheck.Core.Listable d, Test.LeanCheck.Core.Listable e) => Test.LeanCheck.Core.Listable (a, b, c, d, e)
instance Test.LeanCheck.Core.Listable a => Test.LeanCheck.Core.Listable [a]
instance Test.LeanCheck.Core.Listable GHC.Types.Float
instance Test.LeanCheck.Core.Listable GHC.Types.Double
instance Test.LeanCheck.Core.Listable GHC.Types.Ordering


-- | This module is part of LeanCheck, a simple enumerative property-based
--   testing library.
--   
--   This module exports <a>Test.LeanCheck.Core</a> along with:
--   
--   <ul>
--   <li>support for <a>Listable</a> 6-tuples up to 12-tuples;</li>
--   <li><a>tiers</a> constructors (<tt>consN</tt>) with arities from 6 up
--   to 12;</li>
--   <li>a <a>Listable</a> <a>Ratio</a> instance (consequently
--   <a>Listable</a> <a>Rational</a>);</li>
--   <li>a <a>Listable</a> <a>Word</a> instance;</li>
--   <li>the operators <a>addWeight</a> and <a>ofWeight</a>.</li>
--   </ul>
--   
--   <a>Test.LeanCheck</a> already exports everything from this module. You
--   are probably better off importing it.
--   
--   You should <i>only</i> import <a>Test.LeanCheck.Basic</a> if you
--   <i>only</i> want the above basic functionality.
module Test.LeanCheck.Basic
cons6 :: (Listable a, Listable b, Listable c, Listable d, Listable e, Listable f) => (a -> b -> c -> d -> e -> f -> g) -> [[g]]
cons7 :: (Listable a, Listable b, Listable c, Listable d, Listable e, Listable f, Listable g) => (a -> b -> c -> d -> e -> f -> g -> h) -> [[h]]
cons8 :: (Listable a, Listable b, Listable c, Listable d, Listable e, Listable f, Listable g, Listable h) => (a -> b -> c -> d -> e -> f -> g -> h -> i) -> [[i]]
cons9 :: (Listable a, Listable b, Listable c, Listable d, Listable e, Listable f, Listable g, Listable h, Listable i) => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j) -> [[j]]
cons10 :: (Listable a, Listable b, Listable c, Listable d, Listable e, Listable f, Listable g, Listable h, Listable i, Listable j) => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k) -> [[k]]
cons11 :: (Listable a, Listable b, Listable c, Listable d, Listable e, Listable f, Listable g, Listable h, Listable i, Listable j, Listable k) => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l) -> [[l]]
cons12 :: (Listable a, Listable b, Listable c, Listable d, Listable e, Listable f, Listable g, Listable h, Listable i, Listable j, Listable k, Listable l) => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m) -> [[m]]

-- | Resets the weight of a constructor (or tiers) Typically used as an
--   infix constructor when defining Listable instances:
--   
--   <pre>
--   cons&lt;N&gt; `ofWeight` &lt;W&gt;
--   </pre>
--   
--   Be careful: do not apply <tt><a>ofWeight</a> 0</tt> 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).
--   
--   <a>ofWeight</a> is closely related to <a>reset</a>.
ofWeight :: [[a]] -> Int -> [[a]]

-- | Adds to the weight of tiers of a constructor
--   
--   <a>addWeight</a> is closely related to <a>delay</a>.
addWeight :: [[a]] -> Int -> [[a]]
instance (Test.LeanCheck.Core.Listable a, Test.LeanCheck.Core.Listable b, Test.LeanCheck.Core.Listable c, Test.LeanCheck.Core.Listable d, Test.LeanCheck.Core.Listable e, Test.LeanCheck.Core.Listable f) => Test.LeanCheck.Core.Listable (a, b, c, d, e, f)
instance (Test.LeanCheck.Core.Listable a, Test.LeanCheck.Core.Listable b, Test.LeanCheck.Core.Listable c, Test.LeanCheck.Core.Listable d, Test.LeanCheck.Core.Listable e, Test.LeanCheck.Core.Listable f, Test.LeanCheck.Core.Listable g) => Test.LeanCheck.Core.Listable (a, b, c, d, e, f, g)
instance (Test.LeanCheck.Core.Listable a, Test.LeanCheck.Core.Listable b, Test.LeanCheck.Core.Listable c, Test.LeanCheck.Core.Listable d, Test.LeanCheck.Core.Listable e, Test.LeanCheck.Core.Listable f, Test.LeanCheck.Core.Listable g, Test.LeanCheck.Core.Listable h) => Test.LeanCheck.Core.Listable (a, b, c, d, e, f, g, h)
instance (Test.LeanCheck.Core.Listable a, Test.LeanCheck.Core.Listable b, Test.LeanCheck.Core.Listable c, Test.LeanCheck.Core.Listable d, Test.LeanCheck.Core.Listable e, Test.LeanCheck.Core.Listable f, Test.LeanCheck.Core.Listable g, Test.LeanCheck.Core.Listable h, Test.LeanCheck.Core.Listable i) => Test.LeanCheck.Core.Listable (a, b, c, d, e, f, g, h, i)
instance (Test.LeanCheck.Core.Listable a, Test.LeanCheck.Core.Listable b, Test.LeanCheck.Core.Listable c, Test.LeanCheck.Core.Listable d, Test.LeanCheck.Core.Listable e, Test.LeanCheck.Core.Listable f, Test.LeanCheck.Core.Listable g, Test.LeanCheck.Core.Listable h, Test.LeanCheck.Core.Listable i, Test.LeanCheck.Core.Listable j) => Test.LeanCheck.Core.Listable (a, b, c, d, e, f, g, h, i, j)
instance (Test.LeanCheck.Core.Listable a, Test.LeanCheck.Core.Listable b, Test.LeanCheck.Core.Listable c, Test.LeanCheck.Core.Listable d, Test.LeanCheck.Core.Listable e, Test.LeanCheck.Core.Listable f, Test.LeanCheck.Core.Listable g, Test.LeanCheck.Core.Listable h, Test.LeanCheck.Core.Listable i, Test.LeanCheck.Core.Listable j, Test.LeanCheck.Core.Listable k) => Test.LeanCheck.Core.Listable (a, b, c, d, e, f, g, h, i, j, k)
instance (Test.LeanCheck.Core.Listable a, Test.LeanCheck.Core.Listable b, Test.LeanCheck.Core.Listable c, Test.LeanCheck.Core.Listable d, Test.LeanCheck.Core.Listable e, Test.LeanCheck.Core.Listable f, Test.LeanCheck.Core.Listable g, Test.LeanCheck.Core.Listable h, Test.LeanCheck.Core.Listable i, Test.LeanCheck.Core.Listable j, Test.LeanCheck.Core.Listable k, Test.LeanCheck.Core.Listable l) => Test.LeanCheck.Core.Listable (a, b, c, d, e, f, g, h, i, j, k, l)
instance (GHC.Real.Integral a, Test.LeanCheck.Core.Listable a) => Test.LeanCheck.Core.Listable (GHC.Real.Ratio a)
instance Test.LeanCheck.Core.Listable GHC.Types.Word


-- | This module is part of LeanCheck, a simple enumerative property-based
--   testing library.
--   
--   This is an experimental module for deriving <a>Listable</a> instances.
--   
--   Needs GHC and Template Haskell (tested on GHC 7.4, 7.6, 7.8, 7.10 and
--   8.0).
--   
--   If LeanCheck does not compile under later GHCs, this module is
--   probably the culprit.
module Test.LeanCheck.Derive

-- | Derives a <a>Listable</a> instance for a given type <a>Name</a>.
--   
--   Consider the following <tt>Stack</tt> datatype:
--   
--   <pre>
--   data Stack a = Stack a (Stack a) | Empty
--   </pre>
--   
--   Writing
--   
--   <pre>
--   deriveListable ''Stack
--   </pre>
--   
--   will automatically derive the following <a>Listable</a> instance:
--   
--   <pre>
--   instance Listable a =&gt; Listable (Stack a) where
--     tiers = cons2 Stack \/ cons0 Empty
--   </pre>
--   
--   Needs the <tt>TemplateHaskell</tt> extension.
deriveListable :: Name -> DecsQ

-- | Same as <a>deriveListable</a> but does not warn when instance already
--   exists (<a>deriveListable</a> is preferable).
deriveListableIfNeeded :: Name -> DecsQ

-- | Derives a <a>Listable</a> instance for a given type <a>Name</a>
--   cascading derivation of type arguments as well.
deriveListableCascading :: Name -> DecsQ
deriveTiers :: Name -> ExpQ
deriveList :: Name -> ExpQ


-- | This module is part of LeanCheck, a simple enumerative property-based
--   testing library.
--   
--   A toy Eq instance for Functions.
--   
--   Warning: this is only intended to be used in testing modules. Avoid
--   importing this on modules that are used as libraries.
module Test.LeanCheck.Function.Eq
instance (Test.LeanCheck.Core.Listable a, GHC.Classes.Eq b) => GHC.Classes.Eq (a -> b)


-- | This module is part of LeanCheck, a simple enumerative property-based
--   testing library.
--   
--   QuickCheck-like interface to <a>Test.LeanCheck</a>
module Test.LeanCheck.IO

-- | Checks a property printing results on <tt>stdout</tt>
--   
--   <pre>
--   &gt; check $ \xs -&gt; sort (sort xs) == sort (xs::[Int])
--   +++ OK, passed 200 tests.
--   &gt; check $ \xs ys -&gt; xs `union` ys == ys `union` (xs::[Int])
--   *** Failed! Falsifiable (after 4 tests):
--   [] [0,0]
--   </pre>
check :: Testable a => a -> IO ()

-- | Check a property for a given number of tests printing results on
--   <tt>stdout</tt>
checkFor :: Testable a => Int -> a -> IO ()

-- | Check a property printing results on <tt>stdout</tt> and returning
--   <a>True</a> on success.
--   
--   There is no option to silence this function: for silence, you should
--   use <a>holds</a>.
checkResult :: Testable a => a -> IO Bool

-- | Check a property for a given number of tests printing results on
--   <tt>stdout</tt> and returning <a>True</a> on success.
--   
--   There is no option to silence this function: for silence, you should
--   use <a>holds</a>.
checkResultFor :: Testable a => Int -> a -> IO Bool
instance GHC.Show.Show Test.LeanCheck.IO.Result
instance GHC.Classes.Eq Test.LeanCheck.IO.Result


-- | This module is part of LeanCheck, a simple enumerative property-based
--   testing library.
--   
--   This module exports functions to compute statistics of Listable
--   instances.
module Test.LeanCheck.Stats
classStats :: (Listable a, Show b) => Int -> (a -> b) -> IO ()
classStatsT :: (Listable a, Show b) => Int -> (a -> b) -> IO ()
conditionStats :: Listable a => Int -> [(String, a -> Bool)] -> IO ()
conditionStatsT :: Listable a => Int -> [(String, a -> Bool)] -> IO ()
classify :: Eq a => [a] -> [[a]]
classifyBy :: (a -> a -> Bool) -> [a] -> [[a]]
classifyOn :: Eq b => (a -> b) -> [a] -> [[a]]
counts :: Eq a => [a] -> [(a, Int)]
countsBy :: (a -> a -> Bool) -> [a] -> [(a, Int)]
countsOn :: Eq b => (a -> b) -> [a] -> [(b, Int)]


-- | LeanCheck is a simple enumerative property-based testing library.
--   
--   This module provides advanced functions for manipulating <a>tiers</a>.
--   Most definitions given here are exported by <a>Test.LeanCheck</a>,
--   except: <a>listCons</a>, <a>choices</a>, <a>setChoices</a> and
--   <a>bagChoices</a>.
module Test.LeanCheck.Tiers

-- | Given a constructor that takes a list, return tiers of applications of
--   this constructor.
--   
--   This is basically a type-restricted version of <a>cons1</a>. You
--   should use <a>cons1</a> instead: this serves more as an illustration
--   of how <a>setCons</a> and <a>bagCons</a> work (see source).
listCons :: Listable a => ([a] -> b) -> [[b]]

-- | Given a constructor that takes a set of elements (as a list), lists
--   tiers of applications of this constructor.
--   
--   A naive <a>Listable</a> instance for the <a>Set</a> (of
--   <a>Data.Set</a>) would read:
--   
--   <pre>
--   instance Listable a =&gt; Listable (Set a) where
--     tiers = cons0 empty \/ cons2 insert
--   </pre>
--   
--   The above instance has a problem: it generates repeated sets. A more
--   efficient implementation that does not repeat sets is given by:
--   
--   <pre>
--   tiers = setCons fromList
--   </pre>
--   
--   Alternatively, you can use <a>setsOf</a> direclty.
setCons :: Listable a => ([a] -> b) -> [[b]]

-- | Given a constructor that takes a bag of elements (as a list), lists
--   tiers of applications of this constructor.
--   
--   For example, a <tt>Bag</tt> represented as a list.
--   
--   <pre>
--   bagCons Bag
--   </pre>
bagCons :: Listable a => ([a] -> b) -> [[b]]

-- | Given a constructor that takes a list with no duplicate elements,
--   return tiers of applications of this constructor.
noDupListCons :: Listable a => ([a] -> b) -> [[b]]
maybeCons0 :: Maybe b -> [[b]]
maybeCons1 :: Listable a => (a -> Maybe b) -> [[b]]
maybeCons2 :: (Listable a, Listable b) => (a -> b -> Maybe c) -> [[c]]

-- | Like <a>&gt;&lt;</a>, but over 3 lists of tiers.
product3 :: [[a]] -> [[b]] -> [[c]] -> [[(a, b, c)]]

-- | Like <a>productWith</a>, but over 3 lists of tiers.
product3With :: (a -> b -> c -> d) -> [[a]] -> [[b]] -> [[c]] -> [[d]]

-- | Take the product of lists of tiers by a function returning a
--   <a>Maybe</a> value discarding <a>Nothing</a> values.
productMaybeWith :: (a -> b -> Maybe c) -> [[a]] -> [[b]] -> [[c]]

-- | Takes as argument tiers of element values; returns tiers of lists of
--   elements.
--   
--   <pre>
--   listsOf [[]] == [[[]]]
--   </pre>
--   
--   <pre>
--   listsOf [[x]] == [ [[]]
--                    , [[x]]
--                    , [[x,x]]
--                    , [[x,x,x]]
--                    , ...
--                    ]
--   </pre>
--   
--   <pre>
--   listsOf [[x],[y]] == [ [[]]
--                        , [[x]]
--                        , [[x,x],[y]]
--                        , [[x,x,x],[x,y],[y,x]]
--                        , ...
--                        ]
--   </pre>
listsOf :: [[a]] -> [[[a]]]

-- | Takes as argument tiers of element values; returns tiers of
--   size-ordered lists of elements possibly with repetition.
--   
--   <pre>
--   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]]
--     , ...
--     ]
--   </pre>
bagsOf :: [[a]] -> [[[a]]]

-- | Takes as argument tiers of element values; returns tiers of
--   size-ordered lists of elements without repetition.
--   
--   <pre>
--   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]]
--     , ...
--     ]
--   </pre>
--   
--   Can be used in the constructor of specialized <a>Listable</a>
--   instances. For <a>Set</a> (from <a>Data.Set</a>), we would have:
--   
--   <pre>
--   instance Listable a =&gt; Listable (Set a) where
--     tiers = mapT fromList $ setsOf tiers
--   </pre>
setsOf :: [[a]] -> [[[a]]]

-- | Takes as argument tiers of element values; returns tiers of lists with
--   no repeated elements.
--   
--   <pre>
--   noDupListsOf [[0],[1],[2],...] ==
--     [ [[]]
--     , [[0]]
--     , [[1]]
--     , [[0,1],[1,0],[2]]
--     , [[0,2],[2,0],[3]]
--     , ...
--     ]
--   </pre>
noDupListsOf :: [[a]] -> [[[a]]]

-- | Takes 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.
--   
--   <pre>
--   products [xss] = mapT (:[]) xss
--   products [xss,yss] = mapT (\(x,y) -&gt; [x,y]) (xss &gt;&lt; yss)
--   products [xss,yss,zss] = product3With (\x y z -&gt; [x,y,z]) xss yss zss
--   </pre>
products :: [[[a]]] -> [[[a]]]

-- | Takes as argument an integer length and tiers of element values;
--   returns tiers of lists of element values of the given length.
--   
--   <pre>
--   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]]
--     , ...
--     ]
--   </pre>
listsOfLength :: Int -> [[a]] -> [[[a]]]

-- | Takes as argument tiers of element values; returns tiers of pairs with
--   distinct element values.
--   
--   When argument tiers have no repeated elements:
--   
--   <pre>
--   distinctPairs xss  =  xss &gt;&lt; xss  `suchThat` uncurry (/=)
--   </pre>
distinctPairs :: [[a]] -> [[(a, a)]]

-- | <a>distinctPairs</a> by a given function:
--   
--   <pre>
--   distinctPairsWith f = mapT (uncurry f) . distinctPairs
--   </pre>
distinctPairsWith :: (a -> a -> b) -> [[a]] -> [[b]]

-- | Takes 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.: <tt>(1,2) = (2,1)</tt>. This function will enumerate canonical
--   versions of such pairs where the first element is less than the
--   second.
--   
--   The returned element pairs can be seen as bags with two elements.
--   
--   When argument tiers are listed in <a>Ord</a>:
--   
--   <pre>
--   distinctPairs xss  =  xss &gt;&lt; xss  `suchThat` uncurry (&lt;=)
--   </pre>
unorderedPairs :: [[a]] -> [[(a, a)]]

-- | <a>unorderedPairs</a> by a given function:
--   
--   <pre>
--   unorderedPairsWith f = mapT (uncurry f) . unorderedPairs
--   </pre>
unorderedPairsWith :: (a -> a -> b) -> [[a]] -> [[b]]

-- | Takes as argument tiers of element values; returns tiers of unordered
--   pairs where, in enumeration order, the first element is strictly less
--   than the second.
--   
--   The returned element pairs can be seen as sets with two elements.
--   
--   When argument tiers are listed in <a>Ord</a>:
--   
--   <pre>
--   distinctPairs xss  =  xss &gt;&lt; xss  `suchThat` uncurry (&lt;)
--   </pre>
unorderedDistinctPairs :: [[a]] -> [[(a, a)]]

-- | <a>unorderedPairs</a> by a given function:
--   
--   <pre>
--   unorderedDistinctPairsWith f = mapT (uncurry f) . unorderedDistinctPairs
--   </pre>
unorderedDistinctPairsWith :: (a -> a -> b) -> [[a]] -> [[b]]

-- | Delete the first occurence of an element in a tier.
--   
--   For normalized lists-of-tiers without repetitions, the following
--   holds:
--   
--   <pre>
--   deleteT x = normalizeT . (`suchThat` (/= x))
--   </pre>
deleteT :: Eq a => a -> [[a]] -> [[a]]

-- | Normalizes tiers by removing up to 12 empty tiers from the end of a
--   list of tiers.
--   
--   <pre>
--   normalizeT [xs0,xs1,...,xsN,[]]     =  [xs0,xs1,...,xsN]
--   normalizeT [xs0,xs1,...,xsN,[],[]]  =  [xs0,xs1,...,xsN]
--   </pre>
--   
--   The arbitrary limit of 12 tiers is necessary as this function would
--   loop if there is an infinite trail of empty tiers.
normalizeT :: [[a]] -> [[a]]

-- | Concatenate tiers of maybes
catMaybesT :: [[Maybe a]] -> [[a]]
mapMaybeT :: (a -> Maybe b) -> [[a]] -> [[b]]

-- | Discard elements _not_ matching a predicate.
--   
--   <pre>
--   discardT odd [[1],[2,3],[4]] = [[],[2],[4]]
--   </pre>
discardT :: (a -> Bool) -> [[a]] -> [[a]]

-- | Discard later elements maching a binary predicate (in relation to an
--   earlier element).
--   
--   <pre>
--   discardLaterT (&gt;) [[0],[1],[-1],[2],[-2],...] = [[0],[],[-1],[],[-2],...]
--   discardLaterT (==) [[0],[0,1],[0,1,2],[0,1,2,3],...] = [[0],[1],[2],[3]]
--   </pre>
--   
--   This function is quite innefficient, use with care. Consuming the n-th
--   element takes <tt>O(n^2)</tt> operations.
discardLaterT :: (a -> a -> Bool) -> [[a]] -> [[a]]

-- | Removes repetitions from tiers.
--   
--   <pre>
--   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],...]
--   </pre>
--   
--   Consuming the n-th element takes <tt>O(n^2)</tt> operations.
nubT :: Ord a => [[a]] -> [[a]]

-- | Lists tiers of choices. Choices are pairs of values and tiers
--   excluding that value.
--   
--   <pre>
--   choices [[False,True]] == [[(False,[[True]]),(True,[[False]])]]
--   choices [[1],[2],[3]]
--     == [ [(1,[[],[2],[3]])]
--        , [(2,[[1],[],[3]])]
--        , [(3,[[1],[2],[]])] ]
--   </pre>
--   
--   Each choice is sized by the extracted element.
choices :: [[a]] -> [[(a, [[a]])]]

-- | Like <a>choices</a> but lists tiers of strictly ascending choices.
--   Used to construct <a>setsOf</a> values.
--   
--   <pre>
--   setChoices [[False,True]] == [[(False,[[True]]),(True,[[]])]]
--   setChoices [[1],[2],[3]]
--     == [ [(1,[[],[2],[3]])]
--        , [(2,[[],[],[3]])]
--        , [(3,[[],[],[]])]
--        ]
--   </pre>
setChoices :: [[a]] -> [[(a, [[a]])]]

-- | Like <a>choices</a> but lists tiers of non-decreasing (ascending)
--   choices. Used to construct <a>bagsOf</a> values.
--   
--   <pre>
--   bagChoices [[False,True]] =
--     [ [(False,[[False,True]]), (True,[[True]])]
--     ]
--   </pre>
--   
--   <pre>
--   bagChoices [[1],[2],[3],...] =
--     [ [(1,[[1],[2],[3],...])]
--     , [(2,[[ ],[2],[3],...])]
--     , [(3,[[ ],[ ],[3],...])]
--     , ...
--     ]
--   </pre>
bagChoices :: [[a]] -> [[(a, [[a]])]]

-- | Alternative to <a>print</a> for <a>tiers</a> with one element per
--   line. (useful for debugging, see also <a>showTiers</a>).
--   
--   <pre>
--   &gt; printTiers 3 (tiers :: [[Int]])
--   [ [0]
--   , [1]
--   , [-1]
--   , ...
--   ]
--   &gt; printTiers 3 (tiers :: [[Bool]])
--   [ [ False
--     , True
--     ]
--   ]
--   </pre>
--   
--   This function can be useful when debugging your <a>Listable</a>
--   instances.
printTiers :: Show a => Int -> [[a]] -> IO ()

-- | Alternative to <a>show</a> for <a>tiers</a> with one element per line.
--   (useful for debugging, see also <a>printTiers</a>).
--   
--   This function can be useful when debugging your <a>Listable</a>
--   instances.
showTiers :: Show a => Int -> [[a]] -> String

-- | Checks if a list-of-tiers is finite.
--   
--   <ul>
--   <li>*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.</li>
--   </ul>
finite :: [[a]] -> Bool


-- | LeanCheck is a simple enumerative property-based testing library.
--   
--   A <b>property</b> is a function returning a <a>Bool</a> that should be
--   <a>True</a> for all possible choices of arguments. Properties can be
--   viewed as a parameterized unit tests.
--   
--   To check if a property <a>holds</a> by testing up to a thousand
--   values, we evaluate:
--   
--   <pre>
--   holds 1000 property
--   </pre>
--   
--   <a>True</a> indicates success. <a>False</a> indicates a bug.
--   
--   For example:
--   
--   <pre>
--   holds 1000 $ \xs -&gt; length (sort xs) == length (xs::[Int])
--   </pre>
--   
--   To get the smallest <a>counterExample</a> by testing up to a thousand
--   values, we evaluate:
--   
--   <pre>
--   counterExample 1000 property
--   </pre>
--   
--   Arguments of properties should be instances of the <a>Listable</a>
--   typeclass. <a>Listable</a> instances are provided for the most common
--   Haskell types. New instances are easily defined (see <a>Listable</a>
--   for more info).
module Test.LeanCheck

-- | Does a property <b>hold</b> up to a number of test values?
--   
--   <pre>
--   holds 1000 $ \xs -&gt; length (sort xs) == length xs
--   </pre>
holds :: Testable a => Int -> a -> Bool

-- | Does a property <b>fail</b> for a number of test values?
--   
--   <pre>
--   fails 1000 $ \xs -&gt; xs ++ ys == ys ++ xs
--   </pre>
fails :: Testable a => Int -> a -> Bool

-- | There <b>exists</b> an assignment of values that satisfies a property
--   up to a number of test values?
--   
--   <pre>
--   exists 1000 $ \x -&gt; x &gt; 10
--   </pre>
exists :: Testable a => Int -> a -> Bool

-- | Boolean implication operator. Useful for defining conditional
--   properties:
--   
--   <pre>
--   prop_something x y = condition x y ==&gt; something x y
--   </pre>
(==>) :: Bool -> Bool -> Bool
infixr 0 ==>

-- | Up to a number of tests to a property, returns <a>Just</a> the first
--   counter-example or <a>Nothing</a> if there is none.
--   
--   <pre>
--   counterExample 100 $ \xs -&gt; [] `union` xs == (xs::[Int])
--   -- &gt; Just ["[0,0]"]
--   </pre>
counterExample :: Testable a => Int -> a -> Maybe [String]

-- | Lists all counter-examples for a number of tests to a property,
counterExamples :: Testable a => Int -> a -> [[String]]

-- | Up to a number of tests to a property, returns <a>Just</a> the first
--   witness or <a>Nothing</a> if there is none.
witness :: Testable a => Int -> a -> Maybe [String]

-- | Lists all witnesses up to a number of tests to a property,
witnesses :: Testable a => Int -> a -> [[String]]

-- | Checks a property printing results on <tt>stdout</tt>
--   
--   <pre>
--   &gt; check $ \xs -&gt; sort (sort xs) == sort (xs::[Int])
--   +++ OK, passed 200 tests.
--   &gt; check $ \xs ys -&gt; xs `union` ys == ys `union` (xs::[Int])
--   *** Failed! Falsifiable (after 4 tests):
--   [] [0,0]
--   </pre>
check :: Testable a => a -> IO ()

-- | Check a property for a given number of tests printing results on
--   <tt>stdout</tt>
checkFor :: Testable a => Int -> a -> IO ()

-- | Check a property printing results on <tt>stdout</tt> and returning
--   <a>True</a> on success.
--   
--   There is no option to silence this function: for silence, you should
--   use <a>holds</a>.
checkResult :: Testable a => a -> IO Bool

-- | Check a property for a given number of tests printing results on
--   <tt>stdout</tt> and returning <a>True</a> on success.
--   
--   There is no option to silence this function: for silence, you should
--   use <a>holds</a>.
checkResultFor :: Testable a => Int -> a -> IO Bool

-- | A type is <a>Listable</a> when there exists a function that is able to
--   list (ideally all of) its values.
--   
--   Ideally, instances should be defined by a <a>tiers</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 <a>tiers</a> is
--   
--   <pre>
--   tiers = cons&lt;N&gt; ConstructorA
--        \/ cons&lt;N&gt; ConstructorB
--        \/ ...
--        \/ cons&lt;N&gt; ConstructorZ
--   </pre>
--   
--   where <tt>N</tt> is the number of arguments of each constructor
--   <tt>A...Z</tt>.
--   
--   Instances can be alternatively defined by <a>list</a>. In this case,
--   each sub-list in <a>tiers</a> is a singleton list (each succeeding
--   element of <a>list</a> has +1 size).
--   
--   The function <a>deriveListable</a> from <a>Test.LeanCheck.Derive</a>
--   can automatically derive instances of this typeclass.
--   
--   A <a>Listable</a> instance for functions is also available but is not
--   exported by default. Import <a>Test.LeanCheck.Function</a> if you need
--   to test higher-order properties.
class Listable a
tiers :: Listable a => [[a]]
list :: Listable a => [a]

-- | Given a constructor with no arguments, returns <a>tiers</a> 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.
cons0 :: a -> [[a]]

-- | Given a constructor with one <a>Listable</a> argument, return
--   <a>tiers</a> of applications of this constructor. By default, returned
--   values will have size/weight of 1.
cons1 :: Listable a => (a -> b) -> [[b]]

-- | Given a constructor with two <a>Listable</a> arguments, return
--   <a>tiers</a> of applications of this constructor. By default, returned
--   values will have size/weight of 1.
cons2 :: (Listable a, Listable b) => (a -> b -> c) -> [[c]]

-- | Returns tiers of applications of a 3-argument constructor.
cons3 :: (Listable a, Listable b, Listable c) => (a -> b -> c -> d) -> [[d]]

-- | Returns tiers of applications of a 4-argument constructor.
cons4 :: (Listable a, Listable b, Listable c, Listable d) => (a -> b -> c -> d -> e) -> [[e]]

-- | Returns tiers of applications of a 5-argument constructor.
--   
--   <a>Test.LeanCheck.Basic</a> defines <a>cons6</a> up to <a>cons12</a>.
--   Those are exported by default from <a>Test.LeanCheck</a>, but are
--   hidden from the Haddock documentation.
cons5 :: (Listable a, Listable b, Listable c, Listable d, Listable e) => (a -> b -> c -> d -> e -> f) -> [[f]]

-- | Delays the enumeration of <a>tiers</a>. Conceptually this function
--   adds to the weight of a constructor. Typically used when defining
--   <a>Listable</a> instances:
--   
--   <pre>
--   delay (cons&lt;N&gt; &lt;Constr&gt;)
--   </pre>
delay :: [[a]] -> [[a]]

-- | Resets any delays in a list-of <a>tiers</a>. Conceptually this
--   function makes a constructor "weightless", assuring the first tier is
--   non-empty. Typically used when defining Listable instances:
--   
--   <pre>
--   reset (cons&lt;N&gt; &lt;Constr&gt;)
--   </pre>
--   
--   Be careful: do not apply <tt>reset</tt> to recursive data structure
--   constructors. In general this will make the list of size 0 infinite,
--   breaking the <a>tiers</a> invariant (each tier must be finite).
reset :: [[a]] -> [[a]]

-- | Resets the weight of a constructor (or tiers) Typically used as an
--   infix constructor when defining Listable instances:
--   
--   <pre>
--   cons&lt;N&gt; `ofWeight` &lt;W&gt;
--   </pre>
--   
--   Be careful: do not apply <tt><a>ofWeight</a> 0</tt> 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).
--   
--   <a>ofWeight</a> is closely related to <a>reset</a>.
ofWeight :: [[a]] -> Int -> [[a]]

-- | Adds to the weight of tiers of a constructor
--   
--   <a>addWeight</a> is closely related to <a>delay</a>.
addWeight :: [[a]] -> Int -> [[a]]

-- | Tiers of values that follow a property
--   
--   <pre>
--   cons&lt;N&gt; `suchThat` condition
--   </pre>
suchThat :: [[a]] -> (a -> Bool) -> [[a]]

-- | Append tiers --- sum of two tiers enumerations.
--   
--   <pre>
--   [xs,ys,zs,...] \/ [as,bs,cs,...] = [xs++as,ys++bs,zs++cs,...]
--   </pre>
(\/) :: [[a]] -> [[a]] -> [[a]]
infixr 7 \/

-- | Interleave tiers --- sum of two tiers enumerations. When in doubt, use
--   <a>\/</a> instead.
--   
--   <pre>
--   [xs,ys,zs,...] \/ [as,bs,cs,...] = [xs+|as,ys+|bs,zs+|cs,...]
--   </pre>
(\\//) :: [[a]] -> [[a]] -> [[a]]
infixr 7 \\//

-- | Take a tiered product of lists of tiers.
--   
--   <pre>
--   [t0,t1,t2,...] &gt;&lt; [u0,u1,u2,...] =
--   [ t0**u0
--   , t0**u1 ++ t1**u0
--   , t0**u2 ++ t1**u1 ++ t2**u0
--   , ...       ...       ...       ...
--   ]
--   where xs ** ys = [(x,y) | x &lt;- xs, y &lt;- ys]
--   </pre>
--   
--   Example:
--   
--   <pre>
--   [[0],[1],[2],...] &gt;&lt; [[0],[1],[2],...]
--   == [  [(0,0)]
--      ,  [(1,0),(0,1)]
--      ,  [(2,0),(1,1),(0,2)]
--      ,  [(3,0),(2,1),(1,2),(0,3)]
--      ...
--      ]
--   </pre>
(><) :: [[a]] -> [[b]] -> [[(a, b)]]
infixr 8 ><

-- | Take a tiered product of lists of tiers. <a>productWith</a> can be
--   defined by <a>&gt;&lt;</a>, as:
--   
--   <pre>
--   productWith f xss yss = map (uncurry f) $ xss &gt;&lt; yss
--   </pre>
productWith :: (a -> b -> c) -> [[a]] -> [[b]] -> [[c]]

-- | <a>map</a> over tiers
mapT :: (a -> b) -> [[a]] -> [[b]]

-- | <a>filter</a> tiers
filterT :: (a -> Bool) -> [[a]] -> [[a]]

-- | <a>concat</a> tiers of tiers
concatT :: [[[[a]]]] -> [[a]]

-- | <a>concatMap</a> over tiers
concatMapT :: (a -> [[b]]) -> [[a]] -> [[b]]

-- | Delete the first occurence of an element in a tier.
--   
--   For normalized lists-of-tiers without repetitions, the following
--   holds:
--   
--   <pre>
--   deleteT x = normalizeT . (`suchThat` (/= x))
--   </pre>
deleteT :: Eq a => a -> [[a]] -> [[a]]

-- | Normalizes tiers by removing up to 12 empty tiers from the end of a
--   list of tiers.
--   
--   <pre>
--   normalizeT [xs0,xs1,...,xsN,[]]     =  [xs0,xs1,...,xsN]
--   normalizeT [xs0,xs1,...,xsN,[],[]]  =  [xs0,xs1,...,xsN]
--   </pre>
--   
--   The arbitrary limit of 12 tiers is necessary as this function would
--   loop if there is an infinite trail of empty tiers.
normalizeT :: [[a]] -> [[a]]

-- | Takes a list of values <tt>xs</tt> and transform it into tiers on
--   which each tier is occupied by a single element from <tt>xs</tt>.
--   
--   To convert back to a list, just <a>concat</a>.
toTiers :: [a] -> [[a]]

-- | Derives a <a>Listable</a> instance for a given type <a>Name</a>.
--   
--   Consider the following <tt>Stack</tt> datatype:
--   
--   <pre>
--   data Stack a = Stack a (Stack a) | Empty
--   </pre>
--   
--   Writing
--   
--   <pre>
--   deriveListable ''Stack
--   </pre>
--   
--   will automatically derive the following <a>Listable</a> instance:
--   
--   <pre>
--   instance Listable a =&gt; Listable (Stack a) where
--     tiers = cons2 Stack \/ cons0 Empty
--   </pre>
--   
--   Needs the <tt>TemplateHaskell</tt> extension.
deriveListable :: Name -> DecsQ

-- | Derives a <a>Listable</a> instance for a given type <a>Name</a>
--   cascading derivation of type arguments as well.
deriveListableCascading :: Name -> DecsQ

-- | Given a constructor that takes a set of elements (as a list), lists
--   tiers of applications of this constructor.
--   
--   A naive <a>Listable</a> instance for the <a>Set</a> (of
--   <a>Data.Set</a>) would read:
--   
--   <pre>
--   instance Listable a =&gt; Listable (Set a) where
--     tiers = cons0 empty \/ cons2 insert
--   </pre>
--   
--   The above instance has a problem: it generates repeated sets. A more
--   efficient implementation that does not repeat sets is given by:
--   
--   <pre>
--   tiers = setCons fromList
--   </pre>
--   
--   Alternatively, you can use <a>setsOf</a> direclty.
setCons :: Listable a => ([a] -> b) -> [[b]]

-- | Given a constructor that takes a bag of elements (as a list), lists
--   tiers of applications of this constructor.
--   
--   For example, a <tt>Bag</tt> represented as a list.
--   
--   <pre>
--   bagCons Bag
--   </pre>
bagCons :: Listable a => ([a] -> b) -> [[b]]

-- | Given a constructor that takes a list with no duplicate elements,
--   return tiers of applications of this constructor.
noDupListCons :: Listable a => ([a] -> b) -> [[b]]

-- | Like <a>productWith</a>, but over 3 lists of tiers.
product3With :: (a -> b -> c -> d) -> [[a]] -> [[b]] -> [[c]] -> [[d]]

-- | Take the product of lists of tiers by a function returning a
--   <a>Maybe</a> value discarding <a>Nothing</a> values.
productMaybeWith :: (a -> b -> Maybe c) -> [[a]] -> [[b]] -> [[c]]

-- | Takes as argument tiers of element values; returns tiers of lists of
--   elements.
--   
--   <pre>
--   listsOf [[]] == [[[]]]
--   </pre>
--   
--   <pre>
--   listsOf [[x]] == [ [[]]
--                    , [[x]]
--                    , [[x,x]]
--                    , [[x,x,x]]
--                    , ...
--                    ]
--   </pre>
--   
--   <pre>
--   listsOf [[x],[y]] == [ [[]]
--                        , [[x]]
--                        , [[x,x],[y]]
--                        , [[x,x,x],[x,y],[y,x]]
--                        , ...
--                        ]
--   </pre>
listsOf :: [[a]] -> [[[a]]]

-- | Takes as argument tiers of element values; returns tiers of
--   size-ordered lists of elements without repetition.
--   
--   <pre>
--   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]]
--     , ...
--     ]
--   </pre>
--   
--   Can be used in the constructor of specialized <a>Listable</a>
--   instances. For <a>Set</a> (from <a>Data.Set</a>), we would have:
--   
--   <pre>
--   instance Listable a =&gt; Listable (Set a) where
--     tiers = mapT fromList $ setsOf tiers
--   </pre>
setsOf :: [[a]] -> [[[a]]]

-- | Takes as argument tiers of element values; returns tiers of
--   size-ordered lists of elements possibly with repetition.
--   
--   <pre>
--   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]]
--     , ...
--     ]
--   </pre>
bagsOf :: [[a]] -> [[[a]]]

-- | Takes as argument tiers of element values; returns tiers of lists with
--   no repeated elements.
--   
--   <pre>
--   noDupListsOf [[0],[1],[2],...] ==
--     [ [[]]
--     , [[0]]
--     , [[1]]
--     , [[0,1],[1,0],[2]]
--     , [[0,2],[2,0],[3]]
--     , ...
--     ]
--   </pre>
noDupListsOf :: [[a]] -> [[[a]]]

-- | Takes 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.
--   
--   <pre>
--   products [xss] = mapT (:[]) xss
--   products [xss,yss] = mapT (\(x,y) -&gt; [x,y]) (xss &gt;&lt; yss)
--   products [xss,yss,zss] = product3With (\x y z -&gt; [x,y,z]) xss yss zss
--   </pre>
products :: [[[a]]] -> [[[a]]]

-- | Takes as argument an integer length and tiers of element values;
--   returns tiers of lists of element values of the given length.
--   
--   <pre>
--   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]]
--     , ...
--     ]
--   </pre>
listsOfLength :: Int -> [[a]] -> [[[a]]]

-- | Tiers of <a>Fractional</a> values. This can be used as the
--   implementation of <a>tiers</a> for <a>Fractional</a> types.
tiersFractional :: Fractional a => [[a]]

-- | Tiers of <a>Integral</a> values. Can be used as a default
--   implementation of <a>list</a> for <a>Integral</a> types.
listIntegral :: (Enum a, Num a) => [a]

-- | Lazily interleaves two lists, switching between elements of the two.
--   Union/sum of the elements in the lists.
--   
--   <pre>
--   [x,y,z] +| [a,b,c] == [x,a,y,b,z,c]
--   </pre>
(+|) :: [a] -> [a] -> [a]
infixr 5 +|

-- | <a>Testable</a> values are functions of <a>Listable</a> arguments that
--   return boolean values, e.g.:
--   
--   <ul>
--   <li><pre> Bool</pre></li>
--   <li><pre> Listable a =&gt; a -&gt; Bool</pre></li>
--   <li><pre> Listable a =&gt; a -&gt; a -&gt; Bool</pre></li>
--   <li><pre> Int -&gt; Bool</pre></li>
--   <li><pre> String -&gt; [Int] -&gt; Bool</pre></li>
--   </ul>
class Testable a

-- | List all results of a <a>Testable</a> 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.
results :: Testable a => a -> [([String], Bool)]


-- | This module is part of LeanCheck, a simple enumerative property-based
--   testing library.
--   
--   This module exports means to enumerate functions via lists of pairs.
--   
--   This module considers functions as a finite list of exceptional
--   input-output cases to a default value (list of pairs of arguments and
--   results).
module Test.LeanCheck.Function.ListsOfPairs
(-->>) :: Eq a => [[a]] -> [[b]] -> [[a -> b]]

-- | Given 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 <a>--&gt;&gt;</a>, they
--   represent exceptions to a constant function, hence the name
--   <a>exceptionPairs</a>.
exceptionPairs :: [[a]] -> [[b]] -> [[[(a, b)]]]


-- | This module is part of LeanCheck, a simple enumerative property-based
--   testing library.
--   
--   This module exports a <a>Listable</a> instance for function
--   enumeration via lists of pairs.
--   
--   This module considers functions as a finite list of exceptional
--   input-output cases to a default value (list of pairs of arguments and
--   results).
module Test.LeanCheck.Function.Listable.ListsOfPairs
instance (GHC.Classes.Eq a, Test.LeanCheck.Core.Listable a, Test.LeanCheck.Core.Listable b) => Test.LeanCheck.Core.Listable (a -> b)


-- | This module is part of LeanCheck, a simple enumerative property-based
--   testing library.
--   
--   This module exports a <tt>Listable</tt> instance for functions.
--   
--   LeanCheck provides several alternative definitions of
--   <tt>Listable</tt> functions:
--   
--   <ul>
--   <li><a>Test.LeanCheck.Function.Listable.ListsOfPairs</a>: considers
--   functions as a finite list of exceptional input-output cases to a
--   default value (list of pairs of arguments and results). This is the
--   LeanCheck default, and is the one exported by this module.</li>
--   <li><a>Test.LeanCheck.Function.Listable.CoListable</a>: declares a
--   <tt>CoListable</tt> typeclass similar to SmallCheck's
--   <tt>CoSerial</tt>. Currently a stub.</li>
--   <li><a>Test.LeanCheck.Function.Listable.Periodic</a>: similar to
--   ListsOfPairs, but instead of having a default value, functions are
--   periodic.</li>
--   </ul>
--   
--   Take care: all the above <tt>Listable</tt> instances are
--   <b>experimental</b>. Only one of the above can be imported at a time.
--   
--   Warning: this is only intended to be used in testing modules. Avoid
--   importing this on modules that are used as libraries.
module Test.LeanCheck.Function.Listable


-- | This module is part of LeanCheck, a simple enumerative property-based
--   testing library.
--   
--   This module exports a <a>Listable</a> instance for enumeration of
--   periodic functions.
--   
--   This module <i>barely works</i> and is just a sketch.
module Test.LeanCheck.Function.Listable.Periodic
functions :: Eq b => [a] -> [[b]] -> [[[(a, b)]]]
functionsz :: Eq b => [[a]] -> [[b]] -> [[[(a, b)]]]
lsPeriodsOf :: Eq a => [[a]] -> [[[a]]]
lsPeriodsOfLimit :: Eq a => [b] -> [[a]] -> [[[a]]]
isPeriod :: Eq a => [a] -> Bool
isPeriodOf :: Eq a => [a] -> [a] -> Bool
tiersOfLimit :: [b] -> [[a]] -> [[[a]]]
pairsToFunction :: Eq a => [(a, b)] -> (a -> b)
instance (GHC.Classes.Eq a, GHC.Classes.Eq b, Test.LeanCheck.Core.Listable a, Test.LeanCheck.Core.Listable b) => Test.LeanCheck.Core.Listable (a -> b)


-- | This module is part of LeanCheck, a simple enumerative property-based
--   testing library.
--   
--   This module re-exports <a>Test.LeanCheck</a> but some test functions
--   have been specialized to catch errors (see the explicit export list
--   below).
--   
--   This module is unsafe as it uses <a>unsafePerformIO</a> to catch
--   errors.
module Test.LeanCheck.Error
holds :: Testable a => Int -> a -> Bool
fails :: Testable a => Int -> a -> Bool
exists :: Testable a => Int -> a -> Bool
counterExample :: Testable a => Int -> a -> Maybe [String]
counterExamples :: Testable a => Int -> a -> [[String]]
witness :: Testable a => Int -> a -> Maybe [String]
witnesses :: Testable a => Int -> a -> [[String]]
results :: Testable a => a -> [([String], Bool)]
fromError :: a -> a -> a

-- | Transforms a value into <a>Just</a> that value or <a>Nothing</a> on
--   some errors:
--   
--   <ul>
--   <li>ArithException</li>
--   <li>ArrayException</li>
--   <li>ErrorCall</li>
--   <li>PatternMatchFail</li>
--   </ul>
errorToNothing :: a -> Maybe a
errorToFalse :: Bool -> Bool
errorToTrue :: Bool -> Bool

-- | Transforms a value into <a>Just</a> that value or <a>Nothing</a> on
--   error.
anyErrorToNothing :: a -> Maybe a


-- | This module is part of LeanCheck, a simple enumerative property-based
--   testing library.
--   
--   Some operators for property-based testing.
module Test.LeanCheck.Utils.Operators
(===) :: Eq b => (a -> b) -> (a -> b) -> a -> Bool
infix 4 ===
(====) :: Eq c => (a -> b -> c) -> (a -> b -> c) -> a -> b -> Bool
infix 4 ====
(&&&) :: (a -> Bool) -> (a -> Bool) -> a -> Bool
infixr 3 &&&
(&&&&) :: (a -> b -> Bool) -> (a -> b -> Bool) -> a -> b -> Bool
infixr 3 &&&&
(|||) :: (a -> Bool) -> (a -> Bool) -> a -> Bool
infixr 2 |||
(||||) :: (a -> b -> Bool) -> (a -> b -> Bool) -> a -> b -> Bool
infixr 2 ||||

-- | Is the given function idempotent? <tt>f (f x) == x</tt>
--   
--   <pre>
--   holds n $ idempotent abs
--   holds n $ idempotent sort
--   </pre>
--   
--   <pre>
--   fails n $ idempotent negate
--   </pre>
idempotent :: Eq a => (a -> a) -> a -> Bool

-- | Is the given function an identity? <tt>f x == x</tt>
--   
--   <pre>
--   holds n $ identity (+0)
--   holds n $ identity (sort :: [()])
--   holds n $ identity (not . not)
--   </pre>
identity :: Eq a => (a -> a) -> a -> Bool

-- | Is the given function never an identity? <tt>f x /= x</tt>
--   
--   <pre>
--   holds n $ neverIdentity not
--   </pre>
--   
--   <pre>
--   fails n $ neverIdentity negate   -- yes, fails: negate 0 == 0, hah!
--   </pre>
--   
--   Note: this is not the same as not being an identity.
neverIdentity :: Eq a => (a -> a) -> a -> Bool

-- | Is a given operator commutative? <tt>x + y = y + x</tt>
--   
--   <pre>
--   holds n $ commutative (+)
--   </pre>
--   
--   <pre>
--   fails n $ commutative union  -- union [] [0,0] = [0]
--   </pre>
commutative :: Eq b => (a -> a -> b) -> a -> a -> Bool

-- | Is a given operator associative? <tt>x + (y + z) = (x + y) + z</tt>
associative :: Eq a => (a -> a -> a) -> a -> a -> a -> Bool

-- | Does the first operator, distributes over the second?
distributive :: Eq a => (a -> a -> a) -> (a -> a -> a) -> a -> a -> a -> Bool

-- | Are two operators flipped versions of each other?
--   
--   <pre>
--   holds n $ (&lt;)  `symmetric2` (&gt;)  -:&gt; int
--   holds n $ (&lt;=) `symmetric2` (&gt;=) -:&gt; int
--   </pre>
--   
--   <pre>
--   fails n $ (&lt;)  `symmetric2` (&gt;=) -:&gt; int
--   fails n $ (&lt;=) `symmetric2` (&gt;)  -:&gt; int
--   </pre>
symmetric2 :: Eq b => (a -> a -> b) -> (a -> a -> b) -> a -> a -> Bool

-- | Is a given relation transitive?
transitive :: (a -> a -> Bool) -> a -> a -> a -> Bool

-- | An element is always related to itself.
reflexive :: (a -> a -> Bool) -> a -> Bool

-- | An element is <b>never</b> related to itself.
irreflexive :: (a -> a -> Bool) -> a -> Bool

-- | Is a given relation symmetric? This is a type-restricted version of
--   <a>commutative</a>.
symmetric :: (a -> a -> Bool) -> a -> a -> Bool

-- | Is a given relation asymmetric? Not to be confused with "not
--   symmetric" and "antissymetric".
asymmetric :: (a -> a -> Bool) -> a -> a -> Bool

-- | Is a given relation antisymmetric? Not to be confused with "not
--   symmetric" and "assymetric".
antisymmetric :: Eq a => (a -> a -> Bool) -> a -> a -> Bool
equivalence :: (a -> a -> Bool) -> a -> a -> a -> Bool
partialOrder :: Eq a => (a -> a -> Bool) -> a -> a -> a -> Bool
strictPartialOrder :: (a -> a -> Bool) -> a -> a -> a -> Bool
totalOrder :: Eq a => (a -> a -> Bool) -> a -> a -> a -> Bool
strictTotalOrder :: Eq a => (a -> a -> Bool) -> a -> a -> a -> Bool
comparison :: (a -> a -> Ordering) -> a -> a -> a -> Bool

-- | Equal under, a ternary operator with the same fixity as <a>==</a>.
--   
--   <pre>
--   x =$ f $= y  =  f x = f y
--   </pre>
--   
--   <pre>
--   [1,2,3,4,5] =$  take 2    $= [1,2,4,8,16] -- &gt; True
--   [1,2,3,4,5] =$  take 3    $= [1,2,4,8,16] -- &gt; False
--       [1,2,3] =$    sort    $= [3,2,1]      -- &gt; True
--            42 =$ (`mod` 10) $= 16842        -- &gt; True
--            42 =$ (`mod`  9) $= 16842        -- &gt; False
--           'a' =$  isLetter  $= 'b'          -- &gt; True
--           'a' =$  isLetter  $= '1'          -- &gt; False
--   </pre>
(=$) :: Eq b => a -> (a -> b) -> a -> Bool
infixl 4 =$

-- | See <a>=$</a>
($=) :: (a -> Bool) -> a -> Bool
infixl 4 $=

-- | Check if two lists are equal for <tt>n</tt> values. This operator has
--   the same fixity of <a>==</a>.
--   
--   <pre>
--   xs =| n |= ys  =  take n xs == take n ys
--   </pre>
--   
--   <pre>
--   [1,2,3,4,5] =| 2 |= [1,2,4,8,16] -- &gt; True
--   [1,2,3,4,5] =| 3 |= [1,2,4,8,16] -- &gt; False
--   </pre>
(=|) :: Eq a => [a] -> Int -> [a] -> Bool
infixl 4 =|

-- | See <a>=|</a>
(|=) :: (a -> Bool) -> a -> Bool
infixl 4 |=
okEq :: Eq a => a -> a -> a -> Bool
okOrd :: Ord a => a -> a -> a -> Bool
okEqOrd :: (Eq a, Ord a) => a -> a -> a -> Bool


-- | This module is part of LeanCheck, a simple enumerative property-based
--   testing library.
--   
--   Types to aid in property-based testing.
module Test.LeanCheck.Utils.Types

-- | Single-bit signed integers: -1, 0
newtype Int1
Int1 :: Int -> Int1
[unInt1] :: Int1 -> Int

-- | Two-bit signed integers: -2, -1, 0, 1
newtype Int2
Int2 :: Int -> Int2
[unInt2] :: Int2 -> Int

-- | Three-bit signed integers: -4, -3, -2, -1, 0, 1, 2, 3
newtype Int3
Int3 :: Int -> Int3
[unInt3] :: Int3 -> Int

-- | Four-bit signed integers: -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3,
--   4, 5, 6, 7
newtype Int4
Int4 :: Int -> Int4
[unInt4] :: Int4 -> Int

-- | Single-bit unsigned integer: 0, 1
newtype Word1
Word1 :: Int -> Word1
[unWord1] :: Word1 -> Int

-- | Two-bit unsigned integers: 0, 1, 2, 3
newtype Word2
Word2 :: Int -> Word2
[unWord2] :: Word2 -> Int

-- | Three-bit unsigned integers: 0, 1, 2, 3, 4, 5, 6, 7
newtype Word3
Word3 :: Int -> Word3
[unWord3] :: Word3 -> Int

-- | Four-bit unsigned integers: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
--   13, 14, 15
newtype Word4
Word4 :: Int -> Word4
[unWord4] :: Word4 -> Int

-- | Natural numbers (including 0): 0, 1, 2, 3, 4, 5, 6, 7, ...
--   
--   Internally, this type is represented as an <a>Int</a>. So, it is
--   limited by the <a>maxBound</a> of <a>Int</a>.
newtype Nat
Nat :: Int -> Nat
[unNat] :: Nat -> Int

-- | Natural numbers modulo 1: 0
newtype Nat1
Nat1 :: Int -> Nat1
[unNat1] :: Nat1 -> Int

-- | Natural numbers modulo 2: 0, 1
newtype Nat2
Nat2 :: Int -> Nat2
[unNat2] :: Nat2 -> Int

-- | Natural numbers modulo 3: 0, 1, 2
newtype Nat3
Nat3 :: Int -> Nat3
[unNat3] :: Nat3 -> Int

-- | Natural numbers modulo 4: 0, 1, 2, 3
newtype Nat4
Nat4 :: Int -> Nat4
[unNat4] :: Nat4 -> Int

-- | Natural numbers modulo 5: 0, 1, 2, 3, 4
newtype Nat5
Nat5 :: Int -> Nat5
[unNat5] :: Nat5 -> Int

-- | Natural numbers modulo 6: 0, 1, 2, 3, 4, 5
newtype Nat6
Nat6 :: Int -> Nat6
[unNat6] :: Nat6 -> Int

-- | Natural numbers modulo 7: 0, 1, 2, 3, 4, 5, 6
newtype Nat7
Nat7 :: Int -> Nat7
[unNat7] :: Nat7 -> Int
type UInt1 = Word1
type UInt2 = Word2
type UInt3 = Word3
type UInt4 = Word4

-- | <a>X</a> type to be wrapped around integer types for an
--   e-<a>X</a>-treme integer enumeration. See the <a>Listable</a> instance
--   for <a>X</a>. Use <a>X</a> when testing properties about overflows and
--   the like:
--   
--   <pre>
--   &gt; check $ \x -&gt; x + 1 &gt; (x :: Int)
--   +++ OK, passed 200 tests.
--   </pre>
--   
--   <pre>
--   &gt; check $ \(X x) -&gt; x + 1 &gt; (x :: Int)
--   +++ Failed! Falsifiable (after 4 tests):
--   9223372036854775807
--   </pre>
newtype X a
X :: a -> X a
[unX] :: X a -> a
newtype Xs a
Xs :: [a] -> Xs a
[unXs] :: Xs a -> [a]
newtype NoDup a
NoDup :: [a] -> NoDup a
newtype Bag a
Bag :: [a] -> Bag a
newtype Set a
Set :: [a] -> Set a
instance GHC.Classes.Ord a => GHC.Classes.Ord (Test.LeanCheck.Utils.Types.Xs a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Test.LeanCheck.Utils.Types.Xs a)
instance GHC.Classes.Ord a => GHC.Classes.Ord (Test.LeanCheck.Utils.Types.X a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Test.LeanCheck.Utils.Types.X a)
instance GHC.Classes.Ord a => GHC.Classes.Ord (Test.LeanCheck.Utils.Types.Set a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Test.LeanCheck.Utils.Types.Set a)
instance GHC.Read.Read a => GHC.Read.Read (Test.LeanCheck.Utils.Types.Set a)
instance GHC.Show.Show a => GHC.Show.Show (Test.LeanCheck.Utils.Types.Set a)
instance GHC.Classes.Ord a => GHC.Classes.Ord (Test.LeanCheck.Utils.Types.Bag a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Test.LeanCheck.Utils.Types.Bag a)
instance GHC.Read.Read a => GHC.Read.Read (Test.LeanCheck.Utils.Types.Bag a)
instance GHC.Show.Show a => GHC.Show.Show (Test.LeanCheck.Utils.Types.Bag a)
instance GHC.Classes.Ord a => GHC.Classes.Ord (Test.LeanCheck.Utils.Types.NoDup a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Test.LeanCheck.Utils.Types.NoDup a)
instance GHC.Read.Read a => GHC.Read.Read (Test.LeanCheck.Utils.Types.NoDup a)
instance GHC.Show.Show a => GHC.Show.Show (Test.LeanCheck.Utils.Types.NoDup a)
instance GHC.Classes.Ord Test.LeanCheck.Utils.Types.Nat7
instance GHC.Classes.Eq Test.LeanCheck.Utils.Types.Nat7
instance GHC.Classes.Ord Test.LeanCheck.Utils.Types.Nat6
instance GHC.Classes.Eq Test.LeanCheck.Utils.Types.Nat6
instance GHC.Classes.Ord Test.LeanCheck.Utils.Types.Nat5
instance GHC.Classes.Eq Test.LeanCheck.Utils.Types.Nat5
instance GHC.Classes.Ord Test.LeanCheck.Utils.Types.Nat4
instance GHC.Classes.Eq Test.LeanCheck.Utils.Types.Nat4
instance GHC.Classes.Ord Test.LeanCheck.Utils.Types.Nat3
instance GHC.Classes.Eq Test.LeanCheck.Utils.Types.Nat3
instance GHC.Classes.Ord Test.LeanCheck.Utils.Types.Nat2
instance GHC.Classes.Eq Test.LeanCheck.Utils.Types.Nat2
instance GHC.Classes.Ord Test.LeanCheck.Utils.Types.Nat1
instance GHC.Classes.Eq Test.LeanCheck.Utils.Types.Nat1
instance GHC.Classes.Ord Test.LeanCheck.Utils.Types.Nat
instance GHC.Classes.Eq Test.LeanCheck.Utils.Types.Nat
instance GHC.Classes.Ord Test.LeanCheck.Utils.Types.Word4
instance GHC.Classes.Eq Test.LeanCheck.Utils.Types.Word4
instance GHC.Classes.Ord Test.LeanCheck.Utils.Types.Word3
instance GHC.Classes.Eq Test.LeanCheck.Utils.Types.Word3
instance GHC.Classes.Ord Test.LeanCheck.Utils.Types.Word2
instance GHC.Classes.Eq Test.LeanCheck.Utils.Types.Word2
instance GHC.Classes.Ord Test.LeanCheck.Utils.Types.Word1
instance GHC.Classes.Eq Test.LeanCheck.Utils.Types.Word1
instance GHC.Classes.Ord Test.LeanCheck.Utils.Types.Int4
instance GHC.Classes.Eq Test.LeanCheck.Utils.Types.Int4
instance GHC.Classes.Ord Test.LeanCheck.Utils.Types.Int3
instance GHC.Classes.Eq Test.LeanCheck.Utils.Types.Int3
instance GHC.Classes.Ord Test.LeanCheck.Utils.Types.Int2
instance GHC.Classes.Eq Test.LeanCheck.Utils.Types.Int2
instance GHC.Classes.Ord Test.LeanCheck.Utils.Types.Int1
instance GHC.Classes.Eq Test.LeanCheck.Utils.Types.Int1
instance GHC.Show.Show a => GHC.Show.Show (Test.LeanCheck.Utils.Types.Xs a)
instance (GHC.Real.Integral a, GHC.Enum.Bounded a) => Test.LeanCheck.Core.Listable (Test.LeanCheck.Utils.Types.Xs a)
instance GHC.Show.Show a => GHC.Show.Show (Test.LeanCheck.Utils.Types.X a)
instance (GHC.Real.Integral a, GHC.Enum.Bounded a) => Test.LeanCheck.Core.Listable (Test.LeanCheck.Utils.Types.X a)
instance Test.LeanCheck.Core.Listable a => Test.LeanCheck.Core.Listable (Test.LeanCheck.Utils.Types.Set a)
instance Test.LeanCheck.Core.Listable a => Test.LeanCheck.Core.Listable (Test.LeanCheck.Utils.Types.Bag a)
instance Test.LeanCheck.Core.Listable a => Test.LeanCheck.Core.Listable (Test.LeanCheck.Utils.Types.NoDup a)
instance GHC.Show.Show Test.LeanCheck.Utils.Types.Nat7
instance GHC.Read.Read Test.LeanCheck.Utils.Types.Nat7
instance GHC.Num.Num Test.LeanCheck.Utils.Types.Nat7
instance GHC.Real.Real Test.LeanCheck.Utils.Types.Nat7
instance GHC.Real.Integral Test.LeanCheck.Utils.Types.Nat7
instance GHC.Enum.Bounded Test.LeanCheck.Utils.Types.Nat7
instance GHC.Enum.Enum Test.LeanCheck.Utils.Types.Nat7
instance Test.LeanCheck.Core.Listable Test.LeanCheck.Utils.Types.Nat7
instance GHC.Show.Show Test.LeanCheck.Utils.Types.Nat6
instance GHC.Read.Read Test.LeanCheck.Utils.Types.Nat6
instance GHC.Num.Num Test.LeanCheck.Utils.Types.Nat6
instance GHC.Real.Real Test.LeanCheck.Utils.Types.Nat6
instance GHC.Real.Integral Test.LeanCheck.Utils.Types.Nat6
instance GHC.Enum.Bounded Test.LeanCheck.Utils.Types.Nat6
instance GHC.Enum.Enum Test.LeanCheck.Utils.Types.Nat6
instance Test.LeanCheck.Core.Listable Test.LeanCheck.Utils.Types.Nat6
instance GHC.Show.Show Test.LeanCheck.Utils.Types.Nat5
instance GHC.Read.Read Test.LeanCheck.Utils.Types.Nat5
instance GHC.Num.Num Test.LeanCheck.Utils.Types.Nat5
instance GHC.Real.Real Test.LeanCheck.Utils.Types.Nat5
instance GHC.Real.Integral Test.LeanCheck.Utils.Types.Nat5
instance GHC.Enum.Bounded Test.LeanCheck.Utils.Types.Nat5
instance GHC.Enum.Enum Test.LeanCheck.Utils.Types.Nat5
instance Test.LeanCheck.Core.Listable Test.LeanCheck.Utils.Types.Nat5
instance GHC.Show.Show Test.LeanCheck.Utils.Types.Nat4
instance GHC.Read.Read Test.LeanCheck.Utils.Types.Nat4
instance GHC.Num.Num Test.LeanCheck.Utils.Types.Nat4
instance GHC.Real.Real Test.LeanCheck.Utils.Types.Nat4
instance GHC.Real.Integral Test.LeanCheck.Utils.Types.Nat4
instance GHC.Enum.Bounded Test.LeanCheck.Utils.Types.Nat4
instance GHC.Enum.Enum Test.LeanCheck.Utils.Types.Nat4
instance Test.LeanCheck.Core.Listable Test.LeanCheck.Utils.Types.Nat4
instance GHC.Show.Show Test.LeanCheck.Utils.Types.Nat3
instance GHC.Read.Read Test.LeanCheck.Utils.Types.Nat3
instance GHC.Num.Num Test.LeanCheck.Utils.Types.Nat3
instance GHC.Real.Real Test.LeanCheck.Utils.Types.Nat3
instance GHC.Real.Integral Test.LeanCheck.Utils.Types.Nat3
instance GHC.Enum.Bounded Test.LeanCheck.Utils.Types.Nat3
instance GHC.Enum.Enum Test.LeanCheck.Utils.Types.Nat3
instance Test.LeanCheck.Core.Listable Test.LeanCheck.Utils.Types.Nat3
instance GHC.Show.Show Test.LeanCheck.Utils.Types.Nat2
instance GHC.Read.Read Test.LeanCheck.Utils.Types.Nat2
instance GHC.Num.Num Test.LeanCheck.Utils.Types.Nat2
instance GHC.Real.Real Test.LeanCheck.Utils.Types.Nat2
instance GHC.Real.Integral Test.LeanCheck.Utils.Types.Nat2
instance GHC.Enum.Bounded Test.LeanCheck.Utils.Types.Nat2
instance GHC.Enum.Enum Test.LeanCheck.Utils.Types.Nat2
instance Test.LeanCheck.Core.Listable Test.LeanCheck.Utils.Types.Nat2
instance GHC.Show.Show Test.LeanCheck.Utils.Types.Nat1
instance GHC.Read.Read Test.LeanCheck.Utils.Types.Nat1
instance GHC.Num.Num Test.LeanCheck.Utils.Types.Nat1
instance GHC.Real.Real Test.LeanCheck.Utils.Types.Nat1
instance GHC.Real.Integral Test.LeanCheck.Utils.Types.Nat1
instance GHC.Enum.Bounded Test.LeanCheck.Utils.Types.Nat1
instance GHC.Enum.Enum Test.LeanCheck.Utils.Types.Nat1
instance Test.LeanCheck.Core.Listable Test.LeanCheck.Utils.Types.Nat1
instance GHC.Show.Show Test.LeanCheck.Utils.Types.Nat
instance GHC.Read.Read Test.LeanCheck.Utils.Types.Nat
instance GHC.Num.Num Test.LeanCheck.Utils.Types.Nat
instance GHC.Real.Real Test.LeanCheck.Utils.Types.Nat
instance GHC.Real.Integral Test.LeanCheck.Utils.Types.Nat
instance GHC.Enum.Enum Test.LeanCheck.Utils.Types.Nat
instance Test.LeanCheck.Core.Listable Test.LeanCheck.Utils.Types.Nat
instance GHC.Show.Show Test.LeanCheck.Utils.Types.Word4
instance GHC.Read.Read Test.LeanCheck.Utils.Types.Word4
instance GHC.Num.Num Test.LeanCheck.Utils.Types.Word4
instance GHC.Real.Real Test.LeanCheck.Utils.Types.Word4
instance GHC.Real.Integral Test.LeanCheck.Utils.Types.Word4
instance GHC.Enum.Bounded Test.LeanCheck.Utils.Types.Word4
instance GHC.Enum.Enum Test.LeanCheck.Utils.Types.Word4
instance Test.LeanCheck.Core.Listable Test.LeanCheck.Utils.Types.Word4
instance GHC.Show.Show Test.LeanCheck.Utils.Types.Word3
instance GHC.Read.Read Test.LeanCheck.Utils.Types.Word3
instance GHC.Num.Num Test.LeanCheck.Utils.Types.Word3
instance GHC.Real.Real Test.LeanCheck.Utils.Types.Word3
instance GHC.Real.Integral Test.LeanCheck.Utils.Types.Word3
instance GHC.Enum.Bounded Test.LeanCheck.Utils.Types.Word3
instance GHC.Enum.Enum Test.LeanCheck.Utils.Types.Word3
instance Test.LeanCheck.Core.Listable Test.LeanCheck.Utils.Types.Word3
instance GHC.Show.Show Test.LeanCheck.Utils.Types.Word2
instance GHC.Read.Read Test.LeanCheck.Utils.Types.Word2
instance GHC.Num.Num Test.LeanCheck.Utils.Types.Word2
instance GHC.Real.Real Test.LeanCheck.Utils.Types.Word2
instance GHC.Real.Integral Test.LeanCheck.Utils.Types.Word2
instance GHC.Enum.Bounded Test.LeanCheck.Utils.Types.Word2
instance GHC.Enum.Enum Test.LeanCheck.Utils.Types.Word2
instance Test.LeanCheck.Core.Listable Test.LeanCheck.Utils.Types.Word2
instance GHC.Show.Show Test.LeanCheck.Utils.Types.Word1
instance GHC.Read.Read Test.LeanCheck.Utils.Types.Word1
instance GHC.Num.Num Test.LeanCheck.Utils.Types.Word1
instance GHC.Real.Real Test.LeanCheck.Utils.Types.Word1
instance GHC.Real.Integral Test.LeanCheck.Utils.Types.Word1
instance GHC.Enum.Bounded Test.LeanCheck.Utils.Types.Word1
instance GHC.Enum.Enum Test.LeanCheck.Utils.Types.Word1
instance Test.LeanCheck.Core.Listable Test.LeanCheck.Utils.Types.Word1
instance GHC.Show.Show Test.LeanCheck.Utils.Types.Int4
instance GHC.Read.Read Test.LeanCheck.Utils.Types.Int4
instance GHC.Num.Num Test.LeanCheck.Utils.Types.Int4
instance GHC.Real.Real Test.LeanCheck.Utils.Types.Int4
instance GHC.Real.Integral Test.LeanCheck.Utils.Types.Int4
instance GHC.Enum.Bounded Test.LeanCheck.Utils.Types.Int4
instance GHC.Enum.Enum Test.LeanCheck.Utils.Types.Int4
instance Test.LeanCheck.Core.Listable Test.LeanCheck.Utils.Types.Int4
instance GHC.Show.Show Test.LeanCheck.Utils.Types.Int3
instance GHC.Read.Read Test.LeanCheck.Utils.Types.Int3
instance GHC.Num.Num Test.LeanCheck.Utils.Types.Int3
instance GHC.Real.Real Test.LeanCheck.Utils.Types.Int3
instance GHC.Real.Integral Test.LeanCheck.Utils.Types.Int3
instance GHC.Enum.Bounded Test.LeanCheck.Utils.Types.Int3
instance GHC.Enum.Enum Test.LeanCheck.Utils.Types.Int3
instance Test.LeanCheck.Core.Listable Test.LeanCheck.Utils.Types.Int3
instance GHC.Show.Show Test.LeanCheck.Utils.Types.Int2
instance GHC.Read.Read Test.LeanCheck.Utils.Types.Int2
instance GHC.Num.Num Test.LeanCheck.Utils.Types.Int2
instance GHC.Real.Real Test.LeanCheck.Utils.Types.Int2
instance GHC.Real.Integral Test.LeanCheck.Utils.Types.Int2
instance GHC.Enum.Bounded Test.LeanCheck.Utils.Types.Int2
instance GHC.Enum.Enum Test.LeanCheck.Utils.Types.Int2
instance Test.LeanCheck.Core.Listable Test.LeanCheck.Utils.Types.Int2
instance GHC.Show.Show Test.LeanCheck.Utils.Types.Int1
instance GHC.Read.Read Test.LeanCheck.Utils.Types.Int1
instance GHC.Num.Num Test.LeanCheck.Utils.Types.Int1
instance GHC.Real.Real Test.LeanCheck.Utils.Types.Int1
instance GHC.Real.Integral Test.LeanCheck.Utils.Types.Int1
instance GHC.Enum.Bounded Test.LeanCheck.Utils.Types.Int1
instance GHC.Enum.Enum Test.LeanCheck.Utils.Types.Int1
instance Test.LeanCheck.Core.Listable Test.LeanCheck.Utils.Types.Int1


-- | This module is part of LeanCheck, a simple enumerative property-based
--   testing library.
--   
--   Infix operators for type binding using dummy first-class values.
--   
--   Those are useful when property based testing to avoid repetition.
--   Suppose:
--   
--   <pre>
--   prop_sortAppend :: Ord a =&gt; [a] -&gt; Bool
--   prop_sortAppend xs =  sort (xs++ys) == sort (ys++xs)
--   </pre>
--   
--   Then this:
--   
--   <pre>
--   testResults n =
--     [ holds n (prop_sortAppend :: [Int] -&gt; [Int] -&gt; Bool)
--     , holds n (prop_sortAppend :: [UInt2] -&gt; [UInt2] -&gt; Bool)
--     , holds n (prop_sortAppend :: [Bool] -&gt; [Bool] -&gt; Bool)
--     , holds n (prop_sortAppend :: [Char] -&gt; [Char] -&gt; Bool)
--     , holds n (prop_sortAppend :: [String] -&gt; [String] -&gt; Bool)
--     , holds n (prop_sortAppend :: [()] -&gt; [()] -&gt; Bool)
--     ]
--   </pre>
--   
--   Becomes this:
--   
--   <pre>
--   testResults n =
--     [ holds n $ prop_sortAppend -:&gt; [int]
--     , holds n $ prop_sortAppend -:&gt; [uint2]
--     , holds n $ prop_sortAppend -:&gt; [bool]
--     , holds n $ prop_sortAppend -:&gt; [char]
--     , holds n $ prop_sortAppend -:&gt; [string]
--     , holds n $ prop_sortAppend -:&gt; [()]
--     ]
--   </pre>
--   
--   Or even:
--   
--   <pre>
--   testResults n = concat
--     [ for int, for uint2, for bool, for (), for char, for string ]
--     where for a = [ holds n $ prop_sortAppend -:&gt; a ]
--   </pre>
--   
--   This last form is useful when testing multiple properties for multiple
--   types.
module Test.LeanCheck.Utils.TypeBinding

-- | Type restricted version of const that forces its first argument to
--   have the same type as the second. A symnonym to <a>asTypeOf</a>:
--   
--   <pre>
--   value -: ty  =  value :: Ty
--   </pre>
--   
--   Examples:
--   
--   <pre>
--   10 -: int   =  10 :: Int
--   undefined -: 'a' &gt;- 'b'  =  undefined :: Char -&gt; Char
--   </pre>
(-:) :: a -> a -> a
infixl 1 -:

-- | Type restricted version of const that forces the argument of its first
--   argument to have the same type as the second:
--   
--   <pre>
--   f -:&gt; ty  =  f -: ty &gt;- und  =  f :: Ty -&gt; a
--   </pre>
--   
--   Example:
--   
--   <pre>
--   abs -:&gt; int   =  abs -: int &gt;- und  =  abs :: Int -&gt; Int
--   </pre>
(-:>) :: (a -> b) -> a -> (a -> b)
infixl 1 -:>

-- | Type restricted version of const that forces the result of its first
--   argument to have the same type as the second.
--   
--   <pre>
--   f -&gt;: ty  =  f -: und &gt;- ty  =  f :: a -&gt; Ty
--   </pre>
(->:) :: (a -> b) -> b -> (a -> b)
infixl 1 ->:

-- | Type restricted version of const that forces the second argument of
--   its first argument to have the same type as the second.
--   
--   <pre>
--   f -&gt;:&gt; ty   =  f -: und -&gt; ty -&gt; und  =  f :: a -&gt; Ty -&gt; b
--   </pre>
(->:>) :: (a -> b -> c) -> b -> (a -> b -> c)
infixl 1 ->:>

-- | Type restricted version of const that forces the result of the result
--   of its first argument to have the same type as the second.
--   
--   <pre>
--   f -&gt;&gt;: ty   =  f -: und -&gt; und -&gt; ty  =  f :: a -&gt; b -&gt; Ty
--   </pre>
(->>:) :: (a -> b -> c) -> c -> (a -> b -> c)
infixl 1 ->>:

-- | Type restricted version of const that forces the third argument of its
--   first argument to have the same type as the second.
(->>:>) :: (a -> b -> c -> d) -> c -> (a -> b -> c -> d)
infixl 1 ->>:>

-- | Type 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.
(->>>:) :: (a -> b -> c -> d) -> d -> (a -> b -> c -> d)
infixl 1 ->>>:
(->>>:>) :: (a -> b -> c -> d -> e) -> d -> (a -> b -> c -> d -> e)
infixl 1 ->>>:>
(->>>>:) :: (a -> b -> c -> d -> e) -> e -> (a -> b -> c -> d -> e)
infixl 1 ->>>>:
(->>>>:>) :: (a -> b -> c -> d -> e -> f) -> e -> (a -> b -> c -> d -> e -> f)
infixl 1 ->>>>:>
(->>>>>:) :: (a -> b -> c -> d -> e -> f) -> f -> (a -> b -> c -> d -> e -> f)
infixl 1 ->>>>>:
(->>>>>:>) :: (a -> b -> c -> d -> e -> f -> g) -> f -> (a -> b -> c -> d -> e -> f -> g)
infixl 1 ->>>>>:>
(->>>>>>:) :: (a -> b -> c -> d -> e -> f -> g) -> g -> (a -> b -> c -> d -> e -> f -> g)
infixl 1 ->>>>>>:
(->>>>>>:>) :: (a -> b -> c -> d -> e -> f -> g -> h) -> g -> (a -> b -> c -> d -> e -> f -> g -> h)
infixl 1 ->>>>>>:>
(->>>>>>>:) :: (a -> b -> c -> d -> e -> f -> g -> h) -> h -> (a -> b -> c -> d -> e -> f -> g -> h)
infixl 1 ->>>>>>>:
(->>>>>>>:>) :: (a -> b -> c -> d -> e -> f -> g -> h -> i) -> h -> (a -> b -> c -> d -> e -> f -> g -> h -> i)
infixl 1 ->>>>>>>:>
(->>>>>>>>:) :: (a -> b -> c -> d -> e -> f -> g -> h -> i) -> i -> (a -> b -> c -> d -> e -> f -> g -> h -> i)
infixl 1 ->>>>>>>>:
(->>>>>>>>:>) :: (a -> b -> c -> d -> e -> f -> g -> h -> i -> j) -> i -> (a -> b -> c -> d -> e -> f -> g -> h -> i -> j)
infixl 1 ->>>>>>>>:>
(->>>>>>>>>:) :: (a -> b -> c -> d -> e -> f -> g -> h -> i -> j) -> j -> (a -> b -> c -> d -> e -> f -> g -> h -> i -> j)
infixl 1 ->>>>>>>>>:
(->>>>>>>>>:>) :: (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k) -> j -> (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k)
infixl 1 ->>>>>>>>>:>
(->>>>>>>>>>:) :: (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k) -> k -> (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k)
infixl 1 ->>>>>>>>>>:
(->>>>>>>>>>:>) :: (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l) -> k -> (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l)
infixl 1 ->>>>>>>>>>:>
(->>>>>>>>>>>:) :: (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l) -> l -> (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l)
infixl 1 ->>>>>>>>>>>:
(->>>>>>>>>>>:>) :: (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m) -> m -> (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m)
infixl 1 ->>>>>>>>>>>:>
(->>>>>>>>>>>>:) :: (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m) -> m -> (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m)
infixl 1 ->>>>>>>>>>>>:

-- | Shorthand for undefined
und :: a

-- | Returns 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.
--   
--   <pre>
--   ty &gt;- ty  =  (undefined :: Ty -&gt; Ty)
--   </pre>
--   
--   Examples:
--   
--   <pre>
--   'a' &gt;- 'b'  =  char &gt;- char  =  (undefined :: Char -&gt; Char)
--   int &gt;- bool &gt;- int  =  undefined :: Int -&gt; Bool -&gt; Int
--   </pre>
(>-) :: a -> b -> (a -> b)
infixr 9 >-
bool :: Bool
int :: Int
integer :: Integer
float :: Float
double :: Double
char :: Char
string :: String
ordering :: Ordering

-- | It might be better to just use <a>Just</a>
mayb :: a -> Maybe a
eith :: a -> b -> Either a b
nat :: Nat
int1 :: Int1
uint1 :: UInt1
int2 :: Int2
uint2 :: UInt2
int3 :: Int3
uint3 :: UInt3
int4 :: Int4
uint4 :: UInt4


-- | This module is part of LeanCheck, a simple enumerative property-based
--   testing library.
--   
--   Some utilities for property-based testing with <a>LeanCheck</a>.
--   
--   Those utilities are general-purpose enough to be used with other
--   property-based based testing libraries. See each exported module for
--   details.
--   
--   This is not exported by <a>Test.LeanCheck</a>. You need to import this
--   explicitly.
module Test.LeanCheck.Utils


-- | This module is part of LeanCheck, a simple enumerative property-based
--   testing library.
--   
--   This module exports a <a>Listable</a> instance for function
--   enumeration by means of a <a>FunListable</a> typeclass (similar to
--   <tt>CoListable</tt>).
--   
--   This module <i>does not currently work</i>, it it just a sketch and a
--   stub.
module Test.LeanCheck.Function.Listable.FunListable
sndArgTypeOf :: b -> (a -> b -> c) -> b
(\+:/) :: [[a]] -> [[a]] -> [[a]]
infixr 9 \+:/
class FunListable a
validResults :: FunListable a => a -> [b] -> Bool
invalidResults :: FunListable a => a -> [b] -> Bool
funtiers :: FunListable a => [[(Int, [b] -> (a -> b))]]
toMatrix :: Int -> [a] -> [[a]]
instance (Test.LeanCheck.Function.Listable.FunListable.FunListable a, Test.LeanCheck.Core.Listable b) => Test.LeanCheck.Core.Listable (a -> b)
instance Test.LeanCheck.Function.Listable.FunListable.FunListable ()
instance Test.LeanCheck.Function.Listable.FunListable.FunListable GHC.Types.Bool
instance Test.LeanCheck.Function.Listable.FunListable.FunListable a => Test.LeanCheck.Function.Listable.FunListable.FunListable (GHC.Base.Maybe a)
instance (Test.LeanCheck.Function.Listable.FunListable.FunListable a, Test.LeanCheck.Function.Listable.FunListable.FunListable b) => Test.LeanCheck.Function.Listable.FunListable.FunListable (Data.Either.Either a b)
instance Test.LeanCheck.Function.Listable.FunListable.FunListable a => Test.LeanCheck.Function.Listable.FunListable.FunListable [a]
instance (Test.LeanCheck.Function.Listable.FunListable.FunListable a, Test.LeanCheck.Function.Listable.FunListable.FunListable b) => Test.LeanCheck.Function.Listable.FunListable.FunListable (a, b)
instance Test.LeanCheck.Function.Listable.FunListable.FunListable GHC.Types.Int
instance Test.LeanCheck.Function.Listable.FunListable.FunListable Test.LeanCheck.Utils.Types.Nat
instance Test.LeanCheck.Function.Listable.FunListable.FunListable Test.LeanCheck.Utils.Types.Nat2
instance Test.LeanCheck.Function.Listable.FunListable.FunListable Test.LeanCheck.Utils.Types.Nat3


-- | This module is part of LeanCheck, a simple enumerative property-based
--   testing library.
--   
--   This module exports functions to define a <a>Listable</a> instance for
--   function enumeration by means of a <a>CoListable</a> typeclass. This
--   is very similar to the coseries enumeration of SmallCheck.
--   
--   This module <i>does not currently work</i>, it it just a sketch and a
--   stub.
module Test.LeanCheck.Function.CoListable
class CoListable a
cotiers :: CoListable a => [[b]] -> [[a -> b]]
instance Test.LeanCheck.Function.CoListable.CoListable ()
instance Test.LeanCheck.Function.CoListable.CoListable GHC.Types.Bool
instance Test.LeanCheck.Function.CoListable.CoListable a => Test.LeanCheck.Function.CoListable.CoListable (GHC.Base.Maybe a)
instance (Test.LeanCheck.Function.CoListable.CoListable a, Test.LeanCheck.Function.CoListable.CoListable b) => Test.LeanCheck.Function.CoListable.CoListable (Data.Either.Either a b)
instance Test.LeanCheck.Function.CoListable.CoListable a => Test.LeanCheck.Function.CoListable.CoListable [a]
instance (Test.LeanCheck.Function.CoListable.CoListable a, Test.LeanCheck.Function.CoListable.CoListable b) => Test.LeanCheck.Function.CoListable.CoListable (a, b)
instance Test.LeanCheck.Function.CoListable.CoListable GHC.Types.Int
instance Test.LeanCheck.Function.CoListable.CoListable Test.LeanCheck.Utils.Types.Nat
instance Test.LeanCheck.Function.CoListable.CoListable Test.LeanCheck.Utils.Types.Nat2
instance Test.LeanCheck.Function.CoListable.CoListable Test.LeanCheck.Utils.Types.Nat3


-- | This module is part of LeanCheck, a simple enumerative property-based
--   testing library.
--   
--   This module exports a <a>Listable</a> instance for function
--   enumeration by combining several enumeration strategies.
module Test.LeanCheck.Function.Listable.Mixed
instance (GHC.Classes.Eq a, Test.LeanCheck.Core.Listable a, Test.LeanCheck.Function.CoListable.CoListable a, Test.LeanCheck.Core.Listable b) => Test.LeanCheck.Core.Listable (a -> b)


-- | This module is part of LeanCheck, a simple enumerative property-based
--   testing library.
--   
--   This module exports a <a>Listable</a> instance for function
--   enumeration by means of a <a>CoListable</a> typeclass. This is very
--   similar to the coseries enumeration of SmallCheck.
--   
--   This module <i>does not currently work</i>, it it just a sketch and a
--   stub.
module Test.LeanCheck.Function.Listable.CoListable
instance (Test.LeanCheck.Function.CoListable.CoListable a, Test.LeanCheck.Core.Listable b) => Test.LeanCheck.Core.Listable (a -> b)


-- | This module is part of LeanCheck, a simple enumerative property-based
--   testing library.
--   
--   This module exports the <a>ShowFunction</a> typeclass, its instances
--   and related functions.
--   
--   Using this module, it is possible to implement a Show instance for
--   functions:
--   
--   <pre>
--   import Test.LeanCheck.ShowFunction
--   instance (Show a, Listable a, ShowFunction b) =&gt; Show (a-&gt;b) where
--     show = showFunction 8
--   </pre>
--   
--   This shows functions as a case pattern with up to 8 cases.
--   
--   The module <tt>Test.LeanCheck.Function.Show</tt> (<a>Show</a>) exports
--   an instance like the one above.
module Test.LeanCheck.Function.ShowFunction

-- | Given a number of patterns to show, shows a <a>ShowFunction</a> value.
--   
--   <pre>
--   showFunction undefined True == "True"
--   showFunction 3 (id::Int) == "\\x -&gt; case x of\n\
--                                \        0 -&gt; 0\n\
--                                \        1 -&gt; 1\n\
--                                \        -1 -&gt; -1\n\
--                                \        ...\n"
--   showFunction 4 (&amp;&amp;) == "\\x y -&gt; case (x,y) of\n\
--                           \          (False,False) -&gt; False\n\
--                           \          (False,True) -&gt; False\n\
--                           \          (True,False) -&gt; False\n\
--                           \          (True,True) -&gt; True\n"
--   </pre>
--   
--   This can be used as an implementation of show for functions:
--   
--   <pre>
--   instance (Show a, Listable a, ShowFunction b) =&gt; Show (a-&gt;b) where
--     show = showFunction 8
--   </pre>
showFunction :: ShowFunction a => Int -> a -> String

-- | Same as showFunction, but has no line breaks.
--   
--   <pre>
--   showFunction 2 (id::Int) == "\\x -&gt; case x of 0 -&gt; 0; 1 -&gt; 1; ..."
--   </pre>
showFunctionLine :: ShowFunction a => Int -> a -> String

-- | A functional binding in a showable format.
type Binding = ([String], Maybe String)

-- | Given a <a>ShowFunction</a> value, return a list of bindings for
--   printing. Examples:
--   
--   <pre>
--   bindings True == [([],True)]
--   bindings (id::Int) == [(["0"],"0"), (["1"],"1"), (["-1"],"-1"), ...
--   bindings (&amp;&amp;) == [ (["False","False"], "False")
--                    , (["False","True"], "False")
--                    , (["True","False"], "False")
--                    , (["True","True"], "True")
--                    ]
--   </pre>
bindings :: ShowFunction a => a -> [Binding]

-- | <a>ShowFunction</a> values are those for which we can return a list of
--   functional bindings.
--   
--   As a user, you probably want <a>showFunction</a> and
--   <a>showFunctionLine</a>.
--   
--   Non functional instances should be defined by:
--   
--   <pre>
--   instance ShowFunction Ty where tBindings = tBindingsShow
--   </pre>
class ShowFunction a
tBindings :: ShowFunction a => a -> [[Binding]]

-- | A default implementation of tBindings for already <a>Show</a>-able
--   types.
tBindingsShow :: Show a => a -> [[Binding]]

-- | A type is <a>Listable</a> when there exists a function that is able to
--   list (ideally all of) its values.
--   
--   Ideally, instances should be defined by a <a>tiers</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 <a>tiers</a> is
--   
--   <pre>
--   tiers = cons&lt;N&gt; ConstructorA
--        \/ cons&lt;N&gt; ConstructorB
--        \/ ...
--        \/ cons&lt;N&gt; ConstructorZ
--   </pre>
--   
--   where <tt>N</tt> is the number of arguments of each constructor
--   <tt>A...Z</tt>.
--   
--   Instances can be alternatively defined by <a>list</a>. In this case,
--   each sub-list in <a>tiers</a> is a singleton list (each succeeding
--   element of <a>list</a> has +1 size).
--   
--   The function <a>deriveListable</a> from <a>Test.LeanCheck.Derive</a>
--   can automatically derive instances of this typeclass.
--   
--   A <a>Listable</a> instance for functions is also available but is not
--   exported by default. Import <a>Test.LeanCheck.Function</a> if you need
--   to test higher-order properties.
class Listable a
instance Test.LeanCheck.Function.ShowFunction.ShowFunction ()
instance Test.LeanCheck.Function.ShowFunction.ShowFunction GHC.Types.Bool
instance Test.LeanCheck.Function.ShowFunction.ShowFunction GHC.Types.Int
instance Test.LeanCheck.Function.ShowFunction.ShowFunction GHC.Integer.Type.Integer
instance Test.LeanCheck.Function.ShowFunction.ShowFunction GHC.Types.Char
instance Test.LeanCheck.Function.ShowFunction.ShowFunction GHC.Types.Float
instance Test.LeanCheck.Function.ShowFunction.ShowFunction GHC.Types.Double
instance Test.LeanCheck.Function.ShowFunction.ShowFunction GHC.Types.Ordering
instance GHC.Show.Show a => Test.LeanCheck.Function.ShowFunction.ShowFunction [a]
instance GHC.Show.Show a => Test.LeanCheck.Function.ShowFunction.ShowFunction (GHC.Base.Maybe a)
instance (GHC.Show.Show a, GHC.Show.Show b) => Test.LeanCheck.Function.ShowFunction.ShowFunction (Data.Either.Either a b)
instance (GHC.Show.Show a, GHC.Show.Show b) => Test.LeanCheck.Function.ShowFunction.ShowFunction (a, b)
instance (GHC.Show.Show a, Test.LeanCheck.Core.Listable a, Test.LeanCheck.Function.ShowFunction.ShowFunction b) => Test.LeanCheck.Function.ShowFunction.ShowFunction (a -> b)
instance (GHC.Show.Show a, GHC.Show.Show b, GHC.Show.Show c) => Test.LeanCheck.Function.ShowFunction.ShowFunction (a, b, c)
instance (GHC.Show.Show a, GHC.Show.Show b, GHC.Show.Show c, GHC.Show.Show d) => Test.LeanCheck.Function.ShowFunction.ShowFunction (a, b, c, d)
instance (GHC.Show.Show a, GHC.Show.Show b, GHC.Show.Show c, GHC.Show.Show d, GHC.Show.Show e) => Test.LeanCheck.Function.ShowFunction.ShowFunction (a, b, c, d, e)
instance (GHC.Show.Show a, GHC.Show.Show b, GHC.Show.Show c, GHC.Show.Show d, GHC.Show.Show e, GHC.Show.Show f) => Test.LeanCheck.Function.ShowFunction.ShowFunction (a, b, c, d, e, f)
instance (GHC.Show.Show a, GHC.Show.Show b, GHC.Show.Show c, GHC.Show.Show d, GHC.Show.Show e, GHC.Show.Show f, GHC.Show.Show g) => Test.LeanCheck.Function.ShowFunction.ShowFunction (a, b, c, d, e, f, g)
instance (GHC.Show.Show a, GHC.Show.Show b, GHC.Show.Show c, GHC.Show.Show d, GHC.Show.Show e, GHC.Show.Show f, GHC.Show.Show g, GHC.Show.Show h) => Test.LeanCheck.Function.ShowFunction.ShowFunction (a, b, c, d, e, f, g, h)
instance Test.LeanCheck.Function.ShowFunction.ShowFunction Test.LeanCheck.Utils.Types.Nat
instance Test.LeanCheck.Function.ShowFunction.ShowFunction Test.LeanCheck.Utils.Types.Nat1
instance Test.LeanCheck.Function.ShowFunction.ShowFunction Test.LeanCheck.Utils.Types.Nat2
instance Test.LeanCheck.Function.ShowFunction.ShowFunction Test.LeanCheck.Utils.Types.Nat3
instance Test.LeanCheck.Function.ShowFunction.ShowFunction Test.LeanCheck.Utils.Types.Nat4
instance Test.LeanCheck.Function.ShowFunction.ShowFunction Test.LeanCheck.Utils.Types.Nat5
instance Test.LeanCheck.Function.ShowFunction.ShowFunction Test.LeanCheck.Utils.Types.Nat6
instance Test.LeanCheck.Function.ShowFunction.ShowFunction Test.LeanCheck.Utils.Types.Nat7
instance Test.LeanCheck.Function.ShowFunction.ShowFunction Test.LeanCheck.Utils.Types.Int1
instance Test.LeanCheck.Function.ShowFunction.ShowFunction Test.LeanCheck.Utils.Types.Int2
instance Test.LeanCheck.Function.ShowFunction.ShowFunction Test.LeanCheck.Utils.Types.Int3
instance Test.LeanCheck.Function.ShowFunction.ShowFunction Test.LeanCheck.Utils.Types.Int4
instance Test.LeanCheck.Function.ShowFunction.ShowFunction Test.LeanCheck.Utils.Types.Word1
instance Test.LeanCheck.Function.ShowFunction.ShowFunction Test.LeanCheck.Utils.Types.Word2
instance Test.LeanCheck.Function.ShowFunction.ShowFunction Test.LeanCheck.Utils.Types.Word3
instance Test.LeanCheck.Function.ShowFunction.ShowFunction Test.LeanCheck.Utils.Types.Word4


-- | This module is part of LeanCheck, a simple enumerative property-based
--   testing library.
--   
--   A <a>Show</a> instance for functions.
--   
--   Warning: this is only intended to be used in testing modules. Avoid
--   importing this on modules that are used as libraries.
module Test.LeanCheck.Function.Show
instance (GHC.Show.Show a, Test.LeanCheck.Core.Listable a, Test.LeanCheck.Function.ShowFunction.ShowFunction b) => GHC.Show.Show (a -> b)


-- | This module is part of LeanCheck, a simple enumerative property-based
--   testing library.
--   
--   This module exports <tt>Listable</tt> and <a>Show</a> function
--   typeclass instances. These can be useful for testing higher-order
--   properties --- properties that take functions as arguments.
--   
--   Warning: this is only intended to be used in testing modules. Avoid
--   importing this on modules that are used as libraries.
module Test.LeanCheck.Function
