-- |
-- Module      : Test.LeanCheck.Utils.Types
-- Copyright   : (c) 2015-2020 Rudy Matela
-- License     : 3-Clause BSD  (see the file LICENSE)
-- Maintainer  : Rudy Matela <rudy@matela.com.br>
--
-- This module is part of LeanCheck,
-- a simple enumerative property-based testing library.
--
-- Types to aid in property-based testing.
{-# LANGUAGE CPP #-}
#if __GLASGOW_HASKELL__ == 708
{-# LANGUAGE DeriveDataTypeable, StandaloneDeriving #-}
#endif
module Test.LeanCheck.Utils.Types
  (
  -- * Integer types
  --
  -- | Small-width integer types to aid in property-based testing.
  -- Sometimes it is useful to limit the possibilities of enumerated values
  -- when testing polymorphic functions, these types allow that.
  --
  -- The signed integer types @IntN@ are of limited bit width @N@
  -- bounded by @-2^(N-1)@ to @2^(N-1)-1@.
  -- The unsigned integer types @WordN@ are of limited bit width @N@
  -- bounded by @0@ to @2^N-1@.
  --
  -- Operations are closed and modulo @2^N@.  e.g.:
  --
  -- > maxBound + 1      = minBound
  -- > read "2"          = -2 :: Int2
  -- > abs minBound      = minBound
  -- > negate n          = 2^N - n :: WordN
    Int1 (..)
  , Int2 (..)
  , Int3 (..)
  , Int4 (..)
  , Word1 (..)
  , Word2 (..)
  , Word3 (..)
  , Word4 (..)
  , Nat (..)
  , Nat1 (..)
  , Nat2 (..)
  , Nat3 (..)
  , Nat4 (..)
  , Nat5 (..)
  , Nat6 (..)
  , Nat7 (..)
  , Natural (..)

  -- ** Aliases to word types (deprecated)
  , UInt1
  , UInt2
  , UInt3
  , UInt4

  -- * Extreme Integers
  , X (..)
  , Xs (..)

  -- * List-wrapper types
  , NoDup (..)
  , Bag (..)
  , Set (..)
  , Map (..)

  -- * Character types
  , Space (..)
  , Lower (..)
  , Upper (..)
  , Alpha (..)
  , Digit (..)
  , AlphaNum (..)
  , Letter (..)

  -- * String types
  , Spaces (..)
  , Lowers (..)
  , Uppers (..)
  , Alphas (..)
  , Digits (..)
  , AlphaNums (..)
  , Letters (..)

  -- * Generic types
  , A, B, C, D, E, F
  )
where

import Test.LeanCheck (Listable(..), listIntegral)
import Test.LeanCheck.Core ((+|),cons1)
import Test.LeanCheck.Tiers (noDupListCons, setCons, bagCons, mapCons)
import Data.Ratio ((%))
import Data.Ix
#if __GLASGOW_HASKELL__ == 708
import Data.Typeable (Typeable)
#endif

narrowU :: Int -> Int -> Int
narrowU :: Int -> Int -> Int
narrowU Int
w Int
i  =  Int
i forall a. Integral a => a -> a -> a
`mod` Int
2forall a b. (Num a, Integral b) => a -> b -> a
^Int
w

narrowS :: Int -> Int -> Int
narrowS :: Int -> Int -> Int
narrowS Int
w Int
i  =  if Int
i' forall a. Ord a => a -> a -> Bool
< Int
2forall a b. (Num a, Integral b) => a -> b -> a
^(Int
wforall a. Num a => a -> a -> a
-Int
1)
                then Int
i'
                else Int
i' forall a. Num a => a -> a -> a
- Int
l
                where
                l :: Int
l   =  Int
2forall a b. (Num a, Integral b) => a -> b -> a
^Int
w
                i' :: Int
i'  =  Int
i forall a. Integral a => a -> a -> a
`mod` Int
l


mapTuple :: (a -> b) -> (a,a) -> (b,b)
mapTuple :: forall a b. (a -> b) -> (a, a) -> (b, b)
mapTuple a -> b
f (a
x,a
y)  =  (a -> b
f a
x, a -> b
f a
y)

mapFst :: (a -> b) -> (a,c) -> (b,c)
mapFst :: forall a b c. (a -> b) -> (a, c) -> (b, c)
mapFst a -> b
f (a
x,c
y)  =  (a -> b
f a
x, c
y)

oNewtype :: (a -> b) -> (b -> a) -> (a -> a -> a) -> (b -> b -> b)
oNewtype :: forall a b. (a -> b) -> (b -> a) -> (a -> a -> a) -> b -> b -> b
oNewtype a -> b
con b -> a
des a -> a -> a
o  =  \b
x b
y -> a -> b
con forall a b. (a -> b) -> a -> b
$ b -> a
des b
x a -> a -> a
`o` b -> a
des b
y

fNewtype :: (a -> b) -> (b -> a) -> (a -> a) -> (b -> b)
fNewtype :: forall a b. (a -> b) -> (b -> a) -> (a -> a) -> b -> b
fNewtype a -> b
con b -> a
des a -> a
f  =  a -> b
con forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> a
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. b -> a
des

otNewtype :: (a -> b) -> (b -> a) -> (a -> a -> (a,a)) -> (b -> b -> (b,b))
otNewtype :: forall a b.
(a -> b) -> (b -> a) -> (a -> a -> (a, a)) -> b -> b -> (b, b)
otNewtype a -> b
con b -> a
des a -> a -> (a, a)
o  =  \b
x b
y -> forall a b. (a -> b) -> (a, a) -> (b, b)
mapTuple a -> b
con forall a b. (a -> b) -> a -> b
$ b -> a
des b
x a -> a -> (a, a)
`o` b -> a
des b
y

readsPrecNewtype :: Read a => (a -> b) -> Int -> String -> [(b,String)]
readsPrecNewtype :: forall a b. Read a => (a -> b) -> Int -> String -> [(b, String)]
readsPrecNewtype a -> b
con Int
n  =  forall a b. (a -> b) -> [a] -> [b]
map (forall a b c. (a -> b) -> (a, c) -> (b, c)
mapFst a -> b
con) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Read a => Int -> ReadS a
readsPrec Int
n

boundedEnumFrom :: (Ord a,Bounded a,Enum a) => a -> [a]
boundedEnumFrom :: forall a. (Ord a, Bounded a, Enum a) => a -> [a]
boundedEnumFrom a
x  =  [a
x..forall a. Bounded a => a
maxBound]

boundedEnumFromThen :: (Ord a,Bounded a,Enum a) => a -> a -> [a]
boundedEnumFromThen :: forall a. (Ord a, Bounded a, Enum a) => a -> a -> [a]
boundedEnumFromThen a
x a
y  | a
x forall a. Ord a => a -> a -> Bool
> a
y      =  [a
x,a
y..forall a. Bounded a => a
minBound]
                         | Bool
otherwise  =  [a
x,a
y..forall a. Bounded a => a
maxBound]

-- | Single-bit signed integers: -1, 0
newtype Int1  =  Int1 { Int1 -> Int
unInt1 :: Int }  deriving (Int1 -> Int1 -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Int1 -> Int1 -> Bool
$c/= :: Int1 -> Int1 -> Bool
== :: Int1 -> Int1 -> Bool
$c== :: Int1 -> Int1 -> Bool
Eq, Eq Int1
Int1 -> Int1 -> Bool
Int1 -> Int1 -> Ordering
Int1 -> Int1 -> Int1
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Int1 -> Int1 -> Int1
$cmin :: Int1 -> Int1 -> Int1
max :: Int1 -> Int1 -> Int1
$cmax :: Int1 -> Int1 -> Int1
>= :: Int1 -> Int1 -> Bool
$c>= :: Int1 -> Int1 -> Bool
> :: Int1 -> Int1 -> Bool
$c> :: Int1 -> Int1 -> Bool
<= :: Int1 -> Int1 -> Bool
$c<= :: Int1 -> Int1 -> Bool
< :: Int1 -> Int1 -> Bool
$c< :: Int1 -> Int1 -> Bool
compare :: Int1 -> Int1 -> Ordering
$ccompare :: Int1 -> Int1 -> Ordering
Ord)

-- | Two-bit signed integers: -2, -1, 0, 1
newtype Int2  =  Int2 { Int2 -> Int
unInt2 :: Int }  deriving (Int2 -> Int2 -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Int2 -> Int2 -> Bool
$c/= :: Int2 -> Int2 -> Bool
== :: Int2 -> Int2 -> Bool
$c== :: Int2 -> Int2 -> Bool
Eq, Eq Int2
Int2 -> Int2 -> Bool
Int2 -> Int2 -> Ordering
Int2 -> Int2 -> Int2
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Int2 -> Int2 -> Int2
$cmin :: Int2 -> Int2 -> Int2
max :: Int2 -> Int2 -> Int2
$cmax :: Int2 -> Int2 -> Int2
>= :: Int2 -> Int2 -> Bool
$c>= :: Int2 -> Int2 -> Bool
> :: Int2 -> Int2 -> Bool
$c> :: Int2 -> Int2 -> Bool
<= :: Int2 -> Int2 -> Bool
$c<= :: Int2 -> Int2 -> Bool
< :: Int2 -> Int2 -> Bool
$c< :: Int2 -> Int2 -> Bool
compare :: Int2 -> Int2 -> Ordering
$ccompare :: Int2 -> Int2 -> Ordering
Ord)

-- | Three-bit signed integers: -4, -3, -2, -1, 0, 1, 2, 3
newtype Int3  =  Int3 { Int3 -> Int
unInt3 :: Int }  deriving  (Int3 -> Int3 -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Int3 -> Int3 -> Bool
$c/= :: Int3 -> Int3 -> Bool
== :: Int3 -> Int3 -> Bool
$c== :: Int3 -> Int3 -> Bool
Eq, Eq Int3
Int3 -> Int3 -> Bool
Int3 -> Int3 -> Ordering
Int3 -> Int3 -> Int3
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Int3 -> Int3 -> Int3
$cmin :: Int3 -> Int3 -> Int3
max :: Int3 -> Int3 -> Int3
$cmax :: Int3 -> Int3 -> Int3
>= :: Int3 -> Int3 -> Bool
$c>= :: Int3 -> Int3 -> Bool
> :: Int3 -> Int3 -> Bool
$c> :: Int3 -> Int3 -> Bool
<= :: Int3 -> Int3 -> Bool
$c<= :: Int3 -> Int3 -> Bool
< :: Int3 -> Int3 -> Bool
$c< :: Int3 -> Int3 -> Bool
compare :: Int3 -> Int3 -> Ordering
$ccompare :: Int3 -> Int3 -> Ordering
Ord)

-- | Four-bit signed integers:
-- -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7
newtype Int4  =  Int4 { Int4 -> Int
unInt4 :: Int }  deriving (Int4 -> Int4 -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Int4 -> Int4 -> Bool
$c/= :: Int4 -> Int4 -> Bool
== :: Int4 -> Int4 -> Bool
$c== :: Int4 -> Int4 -> Bool
Eq, Eq Int4
Int4 -> Int4 -> Bool
Int4 -> Int4 -> Ordering
Int4 -> Int4 -> Int4
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Int4 -> Int4 -> Int4
$cmin :: Int4 -> Int4 -> Int4
max :: Int4 -> Int4 -> Int4
$cmax :: Int4 -> Int4 -> Int4
>= :: Int4 -> Int4 -> Bool
$c>= :: Int4 -> Int4 -> Bool
> :: Int4 -> Int4 -> Bool
$c> :: Int4 -> Int4 -> Bool
<= :: Int4 -> Int4 -> Bool
$c<= :: Int4 -> Int4 -> Bool
< :: Int4 -> Int4 -> Bool
$c< :: Int4 -> Int4 -> Bool
compare :: Int4 -> Int4 -> Ordering
$ccompare :: Int4 -> Int4 -> Ordering
Ord)

-- | Single-bit unsigned integer: 0, 1
newtype Word1  =  Word1 { Word1 -> Int
unWord1 :: Int }  deriving (Word1 -> Word1 -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Word1 -> Word1 -> Bool
$c/= :: Word1 -> Word1 -> Bool
== :: Word1 -> Word1 -> Bool
$c== :: Word1 -> Word1 -> Bool
Eq, Eq Word1
Word1 -> Word1 -> Bool
Word1 -> Word1 -> Ordering
Word1 -> Word1 -> Word1
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Word1 -> Word1 -> Word1
$cmin :: Word1 -> Word1 -> Word1
max :: Word1 -> Word1 -> Word1
$cmax :: Word1 -> Word1 -> Word1
>= :: Word1 -> Word1 -> Bool
$c>= :: Word1 -> Word1 -> Bool
> :: Word1 -> Word1 -> Bool
$c> :: Word1 -> Word1 -> Bool
<= :: Word1 -> Word1 -> Bool
$c<= :: Word1 -> Word1 -> Bool
< :: Word1 -> Word1 -> Bool
$c< :: Word1 -> Word1 -> Bool
compare :: Word1 -> Word1 -> Ordering
$ccompare :: Word1 -> Word1 -> Ordering
Ord)

-- | Two-bit unsigned integers: 0, 1, 2, 3
newtype Word2  =  Word2 { Word2 -> Int
unWord2 :: Int }  deriving (Word2 -> Word2 -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Word2 -> Word2 -> Bool
$c/= :: Word2 -> Word2 -> Bool
== :: Word2 -> Word2 -> Bool
$c== :: Word2 -> Word2 -> Bool
Eq, Eq Word2
Word2 -> Word2 -> Bool
Word2 -> Word2 -> Ordering
Word2 -> Word2 -> Word2
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Word2 -> Word2 -> Word2
$cmin :: Word2 -> Word2 -> Word2
max :: Word2 -> Word2 -> Word2
$cmax :: Word2 -> Word2 -> Word2
>= :: Word2 -> Word2 -> Bool
$c>= :: Word2 -> Word2 -> Bool
> :: Word2 -> Word2 -> Bool
$c> :: Word2 -> Word2 -> Bool
<= :: Word2 -> Word2 -> Bool
$c<= :: Word2 -> Word2 -> Bool
< :: Word2 -> Word2 -> Bool
$c< :: Word2 -> Word2 -> Bool
compare :: Word2 -> Word2 -> Ordering
$ccompare :: Word2 -> Word2 -> Ordering
Ord)

-- | Three-bit unsigned integers: 0, 1, 2, 3, 4, 5, 6, 7
newtype Word3  =  Word3 { Word3 -> Int
unWord3 :: Int }  deriving (Word3 -> Word3 -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Word3 -> Word3 -> Bool
$c/= :: Word3 -> Word3 -> Bool
== :: Word3 -> Word3 -> Bool
$c== :: Word3 -> Word3 -> Bool
Eq, Eq Word3
Word3 -> Word3 -> Bool
Word3 -> Word3 -> Ordering
Word3 -> Word3 -> Word3
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Word3 -> Word3 -> Word3
$cmin :: Word3 -> Word3 -> Word3
max :: Word3 -> Word3 -> Word3
$cmax :: Word3 -> Word3 -> Word3
>= :: Word3 -> Word3 -> Bool
$c>= :: Word3 -> Word3 -> Bool
> :: Word3 -> Word3 -> Bool
$c> :: Word3 -> Word3 -> Bool
<= :: Word3 -> Word3 -> Bool
$c<= :: Word3 -> Word3 -> Bool
< :: Word3 -> Word3 -> Bool
$c< :: Word3 -> Word3 -> Bool
compare :: Word3 -> Word3 -> Ordering
$ccompare :: Word3 -> Word3 -> Ordering
Ord)

-- | Four-bit unsigned integers:
-- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
newtype Word4  =  Word4 { Word4 -> Int
unWord4 :: Int }  deriving (Word4 -> Word4 -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Word4 -> Word4 -> Bool
$c/= :: Word4 -> Word4 -> Bool
== :: Word4 -> Word4 -> Bool
$c== :: Word4 -> Word4 -> Bool
Eq, Eq Word4
Word4 -> Word4 -> Bool
Word4 -> Word4 -> Ordering
Word4 -> Word4 -> Word4
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Word4 -> Word4 -> Word4
$cmin :: Word4 -> Word4 -> Word4
max :: Word4 -> Word4 -> Word4
$cmax :: Word4 -> Word4 -> Word4
>= :: Word4 -> Word4 -> Bool
$c>= :: Word4 -> Word4 -> Bool
> :: Word4 -> Word4 -> Bool
$c> :: Word4 -> Word4 -> Bool
<= :: Word4 -> Word4 -> Bool
$c<= :: Word4 -> Word4 -> Bool
< :: Word4 -> Word4 -> Bool
$c< :: Word4 -> Word4 -> Bool
compare :: Word4 -> Word4 -> Ordering
$ccompare :: Word4 -> Word4 -> Ordering
Ord)

-- | Natural numbers (including 0): 0, 1, 2, 3, 4, 5, 6, 7, ...
--
-- Internally, this type is represented as an 'Integer'
-- allowing for an infinity of possible values.
--
-- Its 'Enum', 'Listable' and 'Num' instances only produce non-negative values.
-- When @x < y@ then @x - y = 0@.
newtype Natural  =  Natural { Natural -> Integer
unNatural :: Integer }  deriving (Natural -> Natural -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Natural -> Natural -> Bool
$c/= :: Natural -> Natural -> Bool
== :: Natural -> Natural -> Bool
$c== :: Natural -> Natural -> Bool
Eq, Eq Natural
Natural -> Natural -> Bool
Natural -> Natural -> Ordering
Natural -> Natural -> Natural
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Natural -> Natural -> Natural
$cmin :: Natural -> Natural -> Natural
max :: Natural -> Natural -> Natural
$cmax :: Natural -> Natural -> Natural
>= :: Natural -> Natural -> Bool
$c>= :: Natural -> Natural -> Bool
> :: Natural -> Natural -> Bool
$c> :: Natural -> Natural -> Bool
<= :: Natural -> Natural -> Bool
$c<= :: Natural -> Natural -> Bool
< :: Natural -> Natural -> Bool
$c< :: Natural -> Natural -> Bool
compare :: Natural -> Natural -> Ordering
$ccompare :: Natural -> Natural -> Ordering
Ord)

-- | Natural numbers (including 0): 0, 1, 2, 3, 4, 5, 6, 7, ...
--
-- Internally, this type is represented as an 'Int'.
-- So, it is limited by the 'maxBound' of 'Int'.
--
-- Its 'Enum', 'Listable' and 'Num' instances only produce non-negative values.
-- When @x < y@ then @x - y = 0@.
newtype Nat  =  Nat { Nat -> Int
unNat :: Int }  deriving (Nat -> Nat -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Nat -> Nat -> Bool
$c/= :: Nat -> Nat -> Bool
== :: Nat -> Nat -> Bool
$c== :: Nat -> Nat -> Bool
Eq, Eq Nat
Nat -> Nat -> Bool
Nat -> Nat -> Ordering
Nat -> Nat -> Nat
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Nat -> Nat -> Nat
$cmin :: Nat -> Nat -> Nat
max :: Nat -> Nat -> Nat
$cmax :: Nat -> Nat -> Nat
>= :: Nat -> Nat -> Bool
$c>= :: Nat -> Nat -> Bool
> :: Nat -> Nat -> Bool
$c> :: Nat -> Nat -> Bool
<= :: Nat -> Nat -> Bool
$c<= :: Nat -> Nat -> Bool
< :: Nat -> Nat -> Bool
$c< :: Nat -> Nat -> Bool
compare :: Nat -> Nat -> Ordering
$ccompare :: Nat -> Nat -> Ordering
Ord)

-- | Natural numbers modulo 1: 0
newtype Nat1  =  Nat1 { Nat1 -> Int
unNat1 :: Int }  deriving (Nat1 -> Nat1 -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Nat1 -> Nat1 -> Bool
$c/= :: Nat1 -> Nat1 -> Bool
== :: Nat1 -> Nat1 -> Bool
$c== :: Nat1 -> Nat1 -> Bool
Eq, Eq Nat1
Nat1 -> Nat1 -> Bool
Nat1 -> Nat1 -> Ordering
Nat1 -> Nat1 -> Nat1
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Nat1 -> Nat1 -> Nat1
$cmin :: Nat1 -> Nat1 -> Nat1
max :: Nat1 -> Nat1 -> Nat1
$cmax :: Nat1 -> Nat1 -> Nat1
>= :: Nat1 -> Nat1 -> Bool
$c>= :: Nat1 -> Nat1 -> Bool
> :: Nat1 -> Nat1 -> Bool
$c> :: Nat1 -> Nat1 -> Bool
<= :: Nat1 -> Nat1 -> Bool
$c<= :: Nat1 -> Nat1 -> Bool
< :: Nat1 -> Nat1 -> Bool
$c< :: Nat1 -> Nat1 -> Bool
compare :: Nat1 -> Nat1 -> Ordering
$ccompare :: Nat1 -> Nat1 -> Ordering
Ord)

-- | Natural numbers modulo 2: 0, 1
newtype Nat2  =  Nat2 { Nat2 -> Int
unNat2 :: Int }  deriving (Nat2 -> Nat2 -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Nat2 -> Nat2 -> Bool
$c/= :: Nat2 -> Nat2 -> Bool
== :: Nat2 -> Nat2 -> Bool
$c== :: Nat2 -> Nat2 -> Bool
Eq, Eq Nat2
Nat2 -> Nat2 -> Bool
Nat2 -> Nat2 -> Ordering
Nat2 -> Nat2 -> Nat2
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Nat2 -> Nat2 -> Nat2
$cmin :: Nat2 -> Nat2 -> Nat2
max :: Nat2 -> Nat2 -> Nat2
$cmax :: Nat2 -> Nat2 -> Nat2
>= :: Nat2 -> Nat2 -> Bool
$c>= :: Nat2 -> Nat2 -> Bool
> :: Nat2 -> Nat2 -> Bool
$c> :: Nat2 -> Nat2 -> Bool
<= :: Nat2 -> Nat2 -> Bool
$c<= :: Nat2 -> Nat2 -> Bool
< :: Nat2 -> Nat2 -> Bool
$c< :: Nat2 -> Nat2 -> Bool
compare :: Nat2 -> Nat2 -> Ordering
$ccompare :: Nat2 -> Nat2 -> Ordering
Ord)

-- | Natural numbers modulo 3: 0, 1, 2
newtype Nat3  =  Nat3 { Nat3 -> Int
unNat3 :: Int }  deriving (Nat3 -> Nat3 -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Nat3 -> Nat3 -> Bool
$c/= :: Nat3 -> Nat3 -> Bool
== :: Nat3 -> Nat3 -> Bool
$c== :: Nat3 -> Nat3 -> Bool
Eq, Eq Nat3
Nat3 -> Nat3 -> Bool
Nat3 -> Nat3 -> Ordering
Nat3 -> Nat3 -> Nat3
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Nat3 -> Nat3 -> Nat3
$cmin :: Nat3 -> Nat3 -> Nat3
max :: Nat3 -> Nat3 -> Nat3
$cmax :: Nat3 -> Nat3 -> Nat3
>= :: Nat3 -> Nat3 -> Bool
$c>= :: Nat3 -> Nat3 -> Bool
> :: Nat3 -> Nat3 -> Bool
$c> :: Nat3 -> Nat3 -> Bool
<= :: Nat3 -> Nat3 -> Bool
$c<= :: Nat3 -> Nat3 -> Bool
< :: Nat3 -> Nat3 -> Bool
$c< :: Nat3 -> Nat3 -> Bool
compare :: Nat3 -> Nat3 -> Ordering
$ccompare :: Nat3 -> Nat3 -> Ordering
Ord)

-- | Natural numbers modulo 4: 0, 1, 2, 3
newtype Nat4  =  Nat4 { Nat4 -> Int
unNat4 :: Int }  deriving (Nat4 -> Nat4 -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Nat4 -> Nat4 -> Bool
$c/= :: Nat4 -> Nat4 -> Bool
== :: Nat4 -> Nat4 -> Bool
$c== :: Nat4 -> Nat4 -> Bool
Eq, Eq Nat4
Nat4 -> Nat4 -> Bool
Nat4 -> Nat4 -> Ordering
Nat4 -> Nat4 -> Nat4
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Nat4 -> Nat4 -> Nat4
$cmin :: Nat4 -> Nat4 -> Nat4
max :: Nat4 -> Nat4 -> Nat4
$cmax :: Nat4 -> Nat4 -> Nat4
>= :: Nat4 -> Nat4 -> Bool
$c>= :: Nat4 -> Nat4 -> Bool
> :: Nat4 -> Nat4 -> Bool
$c> :: Nat4 -> Nat4 -> Bool
<= :: Nat4 -> Nat4 -> Bool
$c<= :: Nat4 -> Nat4 -> Bool
< :: Nat4 -> Nat4 -> Bool
$c< :: Nat4 -> Nat4 -> Bool
compare :: Nat4 -> Nat4 -> Ordering
$ccompare :: Nat4 -> Nat4 -> Ordering
Ord)

-- | Natural numbers modulo 5: 0, 1, 2, 3, 4
newtype Nat5  =  Nat5 { Nat5 -> Int
unNat5 :: Int }  deriving (Nat5 -> Nat5 -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Nat5 -> Nat5 -> Bool
$c/= :: Nat5 -> Nat5 -> Bool
== :: Nat5 -> Nat5 -> Bool
$c== :: Nat5 -> Nat5 -> Bool
Eq, Eq Nat5
Nat5 -> Nat5 -> Bool
Nat5 -> Nat5 -> Ordering
Nat5 -> Nat5 -> Nat5
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Nat5 -> Nat5 -> Nat5
$cmin :: Nat5 -> Nat5 -> Nat5
max :: Nat5 -> Nat5 -> Nat5
$cmax :: Nat5 -> Nat5 -> Nat5
>= :: Nat5 -> Nat5 -> Bool
$c>= :: Nat5 -> Nat5 -> Bool
> :: Nat5 -> Nat5 -> Bool
$c> :: Nat5 -> Nat5 -> Bool
<= :: Nat5 -> Nat5 -> Bool
$c<= :: Nat5 -> Nat5 -> Bool
< :: Nat5 -> Nat5 -> Bool
$c< :: Nat5 -> Nat5 -> Bool
compare :: Nat5 -> Nat5 -> Ordering
$ccompare :: Nat5 -> Nat5 -> Ordering
Ord)

-- | Natural numbers modulo 6: 0, 1, 2, 3, 4, 5
newtype Nat6  =  Nat6 { Nat6 -> Int
unNat6 :: Int }  deriving (Nat6 -> Nat6 -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Nat6 -> Nat6 -> Bool
$c/= :: Nat6 -> Nat6 -> Bool
== :: Nat6 -> Nat6 -> Bool
$c== :: Nat6 -> Nat6 -> Bool
Eq, Eq Nat6
Nat6 -> Nat6 -> Bool
Nat6 -> Nat6 -> Ordering
Nat6 -> Nat6 -> Nat6
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Nat6 -> Nat6 -> Nat6
$cmin :: Nat6 -> Nat6 -> Nat6
max :: Nat6 -> Nat6 -> Nat6
$cmax :: Nat6 -> Nat6 -> Nat6
>= :: Nat6 -> Nat6 -> Bool
$c>= :: Nat6 -> Nat6 -> Bool
> :: Nat6 -> Nat6 -> Bool
$c> :: Nat6 -> Nat6 -> Bool
<= :: Nat6 -> Nat6 -> Bool
$c<= :: Nat6 -> Nat6 -> Bool
< :: Nat6 -> Nat6 -> Bool
$c< :: Nat6 -> Nat6 -> Bool
compare :: Nat6 -> Nat6 -> Ordering
$ccompare :: Nat6 -> Nat6 -> Ordering
Ord)

-- | Natural numbers modulo 7: 0, 1, 2, 3, 4, 5, 6
newtype Nat7  =  Nat7 { Nat7 -> Int
unNat7 :: Int }  deriving (Nat7 -> Nat7 -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Nat7 -> Nat7 -> Bool
$c/= :: Nat7 -> Nat7 -> Bool
== :: Nat7 -> Nat7 -> Bool
$c== :: Nat7 -> Nat7 -> Bool
Eq, Eq Nat7
Nat7 -> Nat7 -> Bool
Nat7 -> Nat7 -> Ordering
Nat7 -> Nat7 -> Nat7
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Nat7 -> Nat7 -> Nat7
$cmin :: Nat7 -> Nat7 -> Nat7
max :: Nat7 -> Nat7 -> Nat7
$cmax :: Nat7 -> Nat7 -> Nat7
>= :: Nat7 -> Nat7 -> Bool
$c>= :: Nat7 -> Nat7 -> Bool
> :: Nat7 -> Nat7 -> Bool
$c> :: Nat7 -> Nat7 -> Bool
<= :: Nat7 -> Nat7 -> Bool
$c<= :: Nat7 -> Nat7 -> Bool
< :: Nat7 -> Nat7 -> Bool
$c< :: Nat7 -> Nat7 -> Bool
compare :: Nat7 -> Nat7 -> Ordering
$ccompare :: Nat7 -> Nat7 -> Ordering
Ord)

-- | Generic type 'A'.
--
-- Can be used to test polymorphic functions with a type variable
-- such as 'take' or 'sort':
--
-- > take :: Int -> [a] -> [a]
-- > sort :: Ord a => [a] -> [a]
--
-- by binding them to the following types:
--
-- > take :: Int -> [A] -> [A]
-- > sort :: [A] -> [A]
--
-- This type is homomorphic to 'Nat6', 'B', 'C', 'D', 'E' and 'F'.
--
-- It is instance to several typeclasses so that it can be used
-- to test functions with type contexts.
newtype A  =  A Int  deriving (A -> A -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: A -> A -> Bool
$c/= :: A -> A -> Bool
== :: A -> A -> Bool
$c== :: A -> A -> Bool
Eq, Eq A
A -> A -> Bool
A -> A -> Ordering
A -> A -> A
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: A -> A -> A
$cmin :: A -> A -> A
max :: A -> A -> A
$cmax :: A -> A -> A
>= :: A -> A -> Bool
$c>= :: A -> A -> Bool
> :: A -> A -> Bool
$c> :: A -> A -> Bool
<= :: A -> A -> Bool
$c<= :: A -> A -> Bool
< :: A -> A -> Bool
$c< :: A -> A -> Bool
compare :: A -> A -> Ordering
$ccompare :: A -> A -> Ordering
Ord)

-- | Generic type 'B'.
--
-- Can be used to test polymorphic functions with two type variables
-- such as 'map' or 'foldr':
--
-- > map :: (a -> b) -> [a] -> [b]
-- > foldr :: (a -> b -> b) -> b -> [a] -> b
--
-- by binding them to the following types:
--
-- > map :: (A -> B) -> [A] -> [B]
-- > foldr :: (A -> B -> B) -> B -> [A] -> B
--
-- This type is homomorphic to 'A', 'Nat6', 'C', 'D', 'E' and 'F'.
newtype B  =  B Int  deriving (B -> B -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: B -> B -> Bool
$c/= :: B -> B -> Bool
== :: B -> B -> Bool
$c== :: B -> B -> Bool
Eq, Eq B
B -> B -> Bool
B -> B -> Ordering
B -> B -> B
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: B -> B -> B
$cmin :: B -> B -> B
max :: B -> B -> B
$cmax :: B -> B -> B
>= :: B -> B -> Bool
$c>= :: B -> B -> Bool
> :: B -> B -> Bool
$c> :: B -> B -> Bool
<= :: B -> B -> Bool
$c<= :: B -> B -> Bool
< :: B -> B -> Bool
$c< :: B -> B -> Bool
compare :: B -> B -> Ordering
$ccompare :: B -> B -> Ordering
Ord)

-- | Generic type 'C'.
--
-- Can be used to test polymorphic functions with three type variables
-- such as 'uncurry' or 'zipWith':
--
-- > uncurry :: (a -> b -> c) -> (a, b) -> c
-- > zipWith :: (a -> b -> c) -> [a] -> [b] -> [c]
--
-- by binding them to the following types:
--
-- > uncurry :: (A -> B -> C) -> (A, B) -> C
-- > zipWith :: (A -> B -> C) -> [A] -> [B] -> [C]
--
-- This type is homomorphic to 'A', 'B', 'Nat6', 'D', 'E' and 'F'.
newtype C  =  C Int  deriving (C -> C -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: C -> C -> Bool
$c/= :: C -> C -> Bool
== :: C -> C -> Bool
$c== :: C -> C -> Bool
Eq, Eq C
C -> C -> Bool
C -> C -> Ordering
C -> C -> C
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: C -> C -> C
$cmin :: C -> C -> C
max :: C -> C -> C
$cmax :: C -> C -> C
>= :: C -> C -> Bool
$c>= :: C -> C -> Bool
> :: C -> C -> Bool
$c> :: C -> C -> Bool
<= :: C -> C -> Bool
$c<= :: C -> C -> Bool
< :: C -> C -> Bool
$c< :: C -> C -> Bool
compare :: C -> C -> Ordering
$ccompare :: C -> C -> Ordering
Ord)

-- | Generic type 'D'.
--
-- Can be used to test polymorphic functions with four type variables.
--
-- This type is homomorphic to 'A', 'B', 'C', 'Nat6', 'E' and 'F'.
newtype D  =  D Int  deriving (D -> D -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: D -> D -> Bool
$c/= :: D -> D -> Bool
== :: D -> D -> Bool
$c== :: D -> D -> Bool
Eq, Eq D
D -> D -> Bool
D -> D -> Ordering
D -> D -> D
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: D -> D -> D
$cmin :: D -> D -> D
max :: D -> D -> D
$cmax :: D -> D -> D
>= :: D -> D -> Bool
$c>= :: D -> D -> Bool
> :: D -> D -> Bool
$c> :: D -> D -> Bool
<= :: D -> D -> Bool
$c<= :: D -> D -> Bool
< :: D -> D -> Bool
$c< :: D -> D -> Bool
compare :: D -> D -> Ordering
$ccompare :: D -> D -> Ordering
Ord)

-- | Generic type 'E'.
--
-- Can be used to test polymorphic functions with five type variables.
--
-- This type is homomorphic to 'A', 'B', 'C', 'D', 'Nat6' and 'F'.
newtype E  =  E Int  deriving (E -> E -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: E -> E -> Bool
$c/= :: E -> E -> Bool
== :: E -> E -> Bool
$c== :: E -> E -> Bool
Eq, Eq E
E -> E -> Bool
E -> E -> Ordering
E -> E -> E
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: E -> E -> E
$cmin :: E -> E -> E
max :: E -> E -> E
$cmax :: E -> E -> E
>= :: E -> E -> Bool
$c>= :: E -> E -> Bool
> :: E -> E -> Bool
$c> :: E -> E -> Bool
<= :: E -> E -> Bool
$c<= :: E -> E -> Bool
< :: E -> E -> Bool
$c< :: E -> E -> Bool
compare :: E -> E -> Ordering
$ccompare :: E -> E -> Ordering
Ord)

-- | Generic type 'F'.
--
-- Can be used to test polymorphic functions with five type variables.
--
-- This type is homomorphic to 'A', 'B', 'C', 'D', 'E' and 'Nat6'.
newtype F  =  F Int  deriving (F -> F -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: F -> F -> Bool
$c/= :: F -> F -> Bool
== :: F -> F -> Bool
$c== :: F -> F -> Bool
Eq, Eq F
F -> F -> Bool
F -> F -> Ordering
F -> F -> F
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: F -> F -> F
$cmin :: F -> F -> F
max :: F -> F -> F
$cmax :: F -> F -> F
>= :: F -> F -> Bool
$c>= :: F -> F -> Bool
> :: F -> F -> Bool
$c> :: F -> F -> Bool
<= :: F -> F -> Bool
$c<= :: F -> F -> Bool
< :: F -> F -> Bool
$c< :: F -> F -> Bool
compare :: F -> F -> Ordering
$ccompare :: F -> F -> Ordering
Ord)

unA :: A -> Int;  unA :: A -> Int
unA (A Int
n)  =  Int
n
unB :: B -> Int;  unB :: B -> Int
unB (B Int
n)  =  Int
n
unC :: C -> Int;  unC :: C -> Int
unC (C Int
n)  =  Int
n
unD :: D -> Int;  unD :: D -> Int
unD (D Int
n)  =  Int
n
unE :: E -> Int;  unE :: E -> Int
unE (E Int
n)  =  Int
n
unF :: F -> Int;  unF :: F -> Int
unF (F Int
n)  =  Int
n

negativeToZero :: (Ord a, Num a) => a -> a
negativeToZero :: forall a. (Ord a, Num a) => a -> a
negativeToZero a
x  | a
x forall a. Ord a => a -> a -> Bool
< a
0      =  a
0
                  | Bool
otherwise  =  a
x

int1  :: Int -> Int1;   int1 :: Int -> Int1
int1   =  Int -> Int1
Int1  forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Int -> Int
narrowS Int
1
int2  :: Int -> Int2;   int2 :: Int -> Int2
int2   =  Int -> Int2
Int2  forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Int -> Int
narrowS Int
2
int3  :: Int -> Int3;   int3 :: Int -> Int3
int3   =  Int -> Int3
Int3  forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Int -> Int
narrowS Int
3
int4  :: Int -> Int4;   int4 :: Int -> Int4
int4   =  Int -> Int4
Int4  forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Int -> Int
narrowS Int
4
word1 :: Int -> Word1;  word1 :: Int -> Word1
word1  =  Int -> Word1
Word1 forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Int -> Int
narrowU Int
1
word2 :: Int -> Word2;  word2 :: Int -> Word2
word2  =  Int -> Word2
Word2 forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Int -> Int
narrowU Int
2
word3 :: Int -> Word3;  word3 :: Int -> Word3
word3  =  Int -> Word3
Word3 forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Int -> Int
narrowU Int
3
word4 :: Int -> Word4;  word4 :: Int -> Word4
word4  =  Int -> Word4
Word4 forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Int -> Int
narrowU Int
4
nat1 :: Int -> Nat1;  nat1 :: Int -> Nat1
nat1  =  Int -> Nat1
Nat1 forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall a. Integral a => a -> a -> a
`mod` Int
1)
nat2 :: Int -> Nat2;  nat2 :: Int -> Nat2
nat2  =  Int -> Nat2
Nat2 forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall a. Integral a => a -> a -> a
`mod` Int
2)
nat3 :: Int -> Nat3;  nat3 :: Int -> Nat3
nat3  =  Int -> Nat3
Nat3 forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall a. Integral a => a -> a -> a
`mod` Int
3)
nat4 :: Int -> Nat4;  nat4 :: Int -> Nat4
nat4  =  Int -> Nat4
Nat4 forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall a. Integral a => a -> a -> a
`mod` Int
4)
nat5 :: Int -> Nat5;  nat5 :: Int -> Nat5
nat5  =  Int -> Nat5
Nat5 forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall a. Integral a => a -> a -> a
`mod` Int
5)
nat6 :: Int -> Nat6;  nat6 :: Int -> Nat6
nat6  =  Int -> Nat6
Nat6 forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall a. Integral a => a -> a -> a
`mod` Int
6)
nat7 :: Int -> Nat7;  nat7 :: Int -> Nat7
nat7  =  Int -> Nat7
Nat7 forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall a. Integral a => a -> a -> a
`mod` Int
7)
nat  :: Int -> Nat;   nat :: Int -> Nat
nat   =  Int -> Nat
Nat  forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. (Ord a, Num a) => a -> a
negativeToZero
natural :: Integer -> Natural;  natural :: Integer -> Natural
natural  =  Integer -> Natural
Natural forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. (Ord a, Num a) => a -> a
negativeToZero
mkA :: Int -> A;  mkA :: Int -> A
mkA  =  Int -> A
A forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall a. Integral a => a -> a -> a
`mod` Int
6)
mkB :: Int -> B;  mkB :: Int -> B
mkB  =  Int -> B
B forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall a. Integral a => a -> a -> a
`mod` Int
6)
mkC :: Int -> C;  mkC :: Int -> C
mkC  =  Int -> C
C forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall a. Integral a => a -> a -> a
`mod` Int
6)
mkD :: Int -> D;  mkD :: Int -> D
mkD  =  Int -> D
D forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall a. Integral a => a -> a -> a
`mod` Int
6)
mkE :: Int -> E;  mkE :: Int -> E
mkE  =  Int -> E
E forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall a. Integral a => a -> a -> a
`mod` Int
6)
mkF :: Int -> F;  mkF :: Int -> F
mkF  =  Int -> F
F forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall a. Integral a => a -> a -> a
`mod` Int
6)

type ONewtype a  =  (Int -> Int -> Int) -> (a -> a -> a)

oInt1  :: ONewtype Int1;   oInt1 :: ONewtype Int1
oInt1   =  forall a b. (a -> b) -> (b -> a) -> (a -> a -> a) -> b -> b -> b
oNewtype Int -> Int1
int1  Int1 -> Int
unInt1
oInt2  :: ONewtype Int2;   oInt2 :: ONewtype Int2
oInt2   =  forall a b. (a -> b) -> (b -> a) -> (a -> a -> a) -> b -> b -> b
oNewtype Int -> Int2
int2  Int2 -> Int
unInt2
oInt3  :: ONewtype Int3;   oInt3 :: ONewtype Int3
oInt3   =  forall a b. (a -> b) -> (b -> a) -> (a -> a -> a) -> b -> b -> b
oNewtype Int -> Int3
int3  Int3 -> Int
unInt3
oInt4  :: ONewtype Int4;   oInt4 :: ONewtype Int4
oInt4   =  forall a b. (a -> b) -> (b -> a) -> (a -> a -> a) -> b -> b -> b
oNewtype Int -> Int4
int4  Int4 -> Int
unInt4
oWord1 :: ONewtype Word1;  oWord1 :: ONewtype Word1
oWord1  =  forall a b. (a -> b) -> (b -> a) -> (a -> a -> a) -> b -> b -> b
oNewtype Int -> Word1
word1 Word1 -> Int
unWord1
oWord2 :: ONewtype Word2;  oWord2 :: ONewtype Word2
oWord2  =  forall a b. (a -> b) -> (b -> a) -> (a -> a -> a) -> b -> b -> b
oNewtype Int -> Word2
word2 Word2 -> Int
unWord2
oWord3 :: ONewtype Word3;  oWord3 :: ONewtype Word3
oWord3  =  forall a b. (a -> b) -> (b -> a) -> (a -> a -> a) -> b -> b -> b
oNewtype Int -> Word3
word3 Word3 -> Int
unWord3
oWord4 :: ONewtype Word4;  oWord4 :: ONewtype Word4
oWord4  =  forall a b. (a -> b) -> (b -> a) -> (a -> a -> a) -> b -> b -> b
oNewtype Int -> Word4
word4 Word4 -> Int
unWord4
oNat   :: ONewtype Nat;    oNat :: ONewtype Nat
oNat    =  forall a b. (a -> b) -> (b -> a) -> (a -> a -> a) -> b -> b -> b
oNewtype Int -> Nat
nat   Nat -> Int
unNat
oNat1  :: ONewtype Nat1;   oNat1 :: ONewtype Nat1
oNat1   =  forall a b. (a -> b) -> (b -> a) -> (a -> a -> a) -> b -> b -> b
oNewtype Int -> Nat1
nat1  Nat1 -> Int
unNat1
oNat2  :: ONewtype Nat2;   oNat2 :: ONewtype Nat2
oNat2   =  forall a b. (a -> b) -> (b -> a) -> (a -> a -> a) -> b -> b -> b
oNewtype Int -> Nat2
nat2  Nat2 -> Int
unNat2
oNat3  :: ONewtype Nat3;   oNat3 :: ONewtype Nat3
oNat3   =  forall a b. (a -> b) -> (b -> a) -> (a -> a -> a) -> b -> b -> b
oNewtype Int -> Nat3
nat3  Nat3 -> Int
unNat3
oNat4  :: ONewtype Nat4;   oNat4 :: ONewtype Nat4
oNat4   =  forall a b. (a -> b) -> (b -> a) -> (a -> a -> a) -> b -> b -> b
oNewtype Int -> Nat4
nat4  Nat4 -> Int
unNat4
oNat5  :: ONewtype Nat5;   oNat5 :: ONewtype Nat5
oNat5   =  forall a b. (a -> b) -> (b -> a) -> (a -> a -> a) -> b -> b -> b
oNewtype Int -> Nat5
nat5  Nat5 -> Int
unNat5
oNat6  :: ONewtype Nat6;   oNat6 :: ONewtype Nat6
oNat6   =  forall a b. (a -> b) -> (b -> a) -> (a -> a -> a) -> b -> b -> b
oNewtype Int -> Nat6
nat6  Nat6 -> Int
unNat6
oNat7  :: ONewtype Nat7;   oNat7 :: ONewtype Nat7
oNat7   =  forall a b. (a -> b) -> (b -> a) -> (a -> a -> a) -> b -> b -> b
oNewtype Int -> Nat7
nat7  Nat7 -> Int
unNat7
oNatural :: (Integer -> Integer -> Integer) -> (Natural -> Natural -> Natural)
oNatural :: (Integer -> Integer -> Integer) -> Natural -> Natural -> Natural
oNatural  =  forall a b. (a -> b) -> (b -> a) -> (a -> a -> a) -> b -> b -> b
oNewtype Integer -> Natural
natural Natural -> Integer
unNatural
oA :: ONewtype A;  oA :: ONewtype A
oA  =  forall a b. (a -> b) -> (b -> a) -> (a -> a -> a) -> b -> b -> b
oNewtype Int -> A
mkA A -> Int
unA
oB :: ONewtype B;  oB :: ONewtype B
oB  =  forall a b. (a -> b) -> (b -> a) -> (a -> a -> a) -> b -> b -> b
oNewtype Int -> B
mkB B -> Int
unB
oC :: ONewtype C;  oC :: ONewtype C
oC  =  forall a b. (a -> b) -> (b -> a) -> (a -> a -> a) -> b -> b -> b
oNewtype Int -> C
mkC C -> Int
unC
oD :: ONewtype D;  oD :: ONewtype D
oD  =  forall a b. (a -> b) -> (b -> a) -> (a -> a -> a) -> b -> b -> b
oNewtype Int -> D
mkD D -> Int
unD
oE :: ONewtype E;  oE :: ONewtype E
oE  =  forall a b. (a -> b) -> (b -> a) -> (a -> a -> a) -> b -> b -> b
oNewtype Int -> E
mkE E -> Int
unE
oF :: ONewtype F;  oF :: ONewtype F
oF  =  forall a b. (a -> b) -> (b -> a) -> (a -> a -> a) -> b -> b -> b
oNewtype Int -> F
mkF F -> Int
unF

fInt1  :: (Int->Int) -> (Int1->Int1)  ;  fInt1 :: (Int -> Int) -> Int1 -> Int1
fInt1   =  forall a b. (a -> b) -> (b -> a) -> (a -> a) -> b -> b
fNewtype Int -> Int1
int1  Int1 -> Int
unInt1
fInt2  :: (Int->Int) -> (Int2->Int2)  ;  fInt2 :: (Int -> Int) -> Int2 -> Int2
fInt2   =  forall a b. (a -> b) -> (b -> a) -> (a -> a) -> b -> b
fNewtype Int -> Int2
int2  Int2 -> Int
unInt2
fInt3  :: (Int->Int) -> (Int3->Int3)  ;  fInt3 :: (Int -> Int) -> Int3 -> Int3
fInt3   =  forall a b. (a -> b) -> (b -> a) -> (a -> a) -> b -> b
fNewtype Int -> Int3
int3  Int3 -> Int
unInt3
fInt4  :: (Int->Int) -> (Int4->Int4)  ;  fInt4 :: (Int -> Int) -> Int4 -> Int4
fInt4   =  forall a b. (a -> b) -> (b -> a) -> (a -> a) -> b -> b
fNewtype Int -> Int4
int4  Int4 -> Int
unInt4
fWord1 :: (Int->Int) -> (Word1->Word1);  fWord1 :: (Int -> Int) -> Word1 -> Word1
fWord1  =  forall a b. (a -> b) -> (b -> a) -> (a -> a) -> b -> b
fNewtype Int -> Word1
word1 Word1 -> Int
unWord1
fWord2 :: (Int->Int) -> (Word2->Word2);  fWord2 :: (Int -> Int) -> Word2 -> Word2
fWord2  =  forall a b. (a -> b) -> (b -> a) -> (a -> a) -> b -> b
fNewtype Int -> Word2
word2 Word2 -> Int
unWord2
fWord3 :: (Int->Int) -> (Word3->Word3);  fWord3 :: (Int -> Int) -> Word3 -> Word3
fWord3  =  forall a b. (a -> b) -> (b -> a) -> (a -> a) -> b -> b
fNewtype Int -> Word3
word3 Word3 -> Int
unWord3
fWord4 :: (Int->Int) -> (Word4->Word4);  fWord4 :: (Int -> Int) -> Word4 -> Word4
fWord4  =  forall a b. (a -> b) -> (b -> a) -> (a -> a) -> b -> b
fNewtype Int -> Word4
word4 Word4 -> Int
unWord4
fNat   :: (Int->Int) -> (Nat->Nat)    ;  fNat :: (Int -> Int) -> Nat -> Nat
fNat    =  forall a b. (a -> b) -> (b -> a) -> (a -> a) -> b -> b
fNewtype Int -> Nat
Nat   Nat -> Int
unNat
fNat1  :: (Int->Int) -> (Nat1->Nat1)  ;  fNat1 :: (Int -> Int) -> Nat1 -> Nat1
fNat1   =  forall a b. (a -> b) -> (b -> a) -> (a -> a) -> b -> b
fNewtype Int -> Nat1
nat1  Nat1 -> Int
unNat1
fNat2  :: (Int->Int) -> (Nat2->Nat2)  ;  fNat2 :: (Int -> Int) -> Nat2 -> Nat2
fNat2   =  forall a b. (a -> b) -> (b -> a) -> (a -> a) -> b -> b
fNewtype Int -> Nat2
nat2  Nat2 -> Int
unNat2
fNat3  :: (Int->Int) -> (Nat3->Nat3)  ;  fNat3 :: (Int -> Int) -> Nat3 -> Nat3
fNat3   =  forall a b. (a -> b) -> (b -> a) -> (a -> a) -> b -> b
fNewtype Int -> Nat3
nat3  Nat3 -> Int
unNat3
fNat4  :: (Int->Int) -> (Nat4->Nat4)  ;  fNat4 :: (Int -> Int) -> Nat4 -> Nat4
fNat4   =  forall a b. (a -> b) -> (b -> a) -> (a -> a) -> b -> b
fNewtype Int -> Nat4
nat4  Nat4 -> Int
unNat4
fNat5  :: (Int->Int) -> (Nat5->Nat5)  ;  fNat5 :: (Int -> Int) -> Nat5 -> Nat5
fNat5   =  forall a b. (a -> b) -> (b -> a) -> (a -> a) -> b -> b
fNewtype Int -> Nat5
nat5  Nat5 -> Int
unNat5
fNat6  :: (Int->Int) -> (Nat6->Nat6)  ;  fNat6 :: (Int -> Int) -> Nat6 -> Nat6
fNat6   =  forall a b. (a -> b) -> (b -> a) -> (a -> a) -> b -> b
fNewtype Int -> Nat6
nat6  Nat6 -> Int
unNat6
fNat7  :: (Int->Int) -> (Nat7->Nat7)  ;  fNat7 :: (Int -> Int) -> Nat7 -> Nat7
fNat7   =  forall a b. (a -> b) -> (b -> a) -> (a -> a) -> b -> b
fNewtype Int -> Nat7
nat7  Nat7 -> Int
unNat7
fNatural :: (Integer->Integer) -> (Natural->Natural)
fNatural :: (Integer -> Integer) -> Natural -> Natural
fNatural  =  forall a b. (a -> b) -> (b -> a) -> (a -> a) -> b -> b
fNewtype Integer -> Natural
Natural Natural -> Integer
unNatural
fA :: (Int -> Int) -> (A -> A);  fA :: (Int -> Int) -> A -> A
fA  =  forall a b. (a -> b) -> (b -> a) -> (a -> a) -> b -> b
fNewtype Int -> A
mkA A -> Int
unA
fB :: (Int -> Int) -> (B -> B);  fB :: (Int -> Int) -> B -> B
fB  =  forall a b. (a -> b) -> (b -> a) -> (a -> a) -> b -> b
fNewtype Int -> B
mkB B -> Int
unB
fC :: (Int -> Int) -> (C -> C);  fC :: (Int -> Int) -> C -> C
fC  =  forall a b. (a -> b) -> (b -> a) -> (a -> a) -> b -> b
fNewtype Int -> C
mkC C -> Int
unC
fD :: (Int -> Int) -> (D -> D);  fD :: (Int -> Int) -> D -> D
fD  =  forall a b. (a -> b) -> (b -> a) -> (a -> a) -> b -> b
fNewtype Int -> D
mkD D -> Int
unD
fE :: (Int -> Int) -> (E -> E);  fE :: (Int -> Int) -> E -> E
fE  =  forall a b. (a -> b) -> (b -> a) -> (a -> a) -> b -> b
fNewtype Int -> E
mkE E -> Int
unE
fF :: (Int -> Int) -> (F -> F);  fF :: (Int -> Int) -> F -> F
fF  =  forall a b. (a -> b) -> (b -> a) -> (a -> a) -> b -> b
fNewtype Int -> F
mkF F -> Int
unF

instance Show Int1 where  show :: Int1 -> String
show  =  forall a. Show a => a -> String
show forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int1 -> Int
unInt1
instance Show Int2 where  show :: Int2 -> String
show  =  forall a. Show a => a -> String
show forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int2 -> Int
unInt2
instance Show Int3 where  show :: Int3 -> String
show  =  forall a. Show a => a -> String
show forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int3 -> Int
unInt3
instance Show Int4 where  show :: Int4 -> String
show  =  forall a. Show a => a -> String
show forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int4 -> Int
unInt4
instance Show Word1 where  show :: Word1 -> String
show  =  forall a. Show a => a -> String
show forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word1 -> Int
unWord1
instance Show Word2 where  show :: Word2 -> String
show  =  forall a. Show a => a -> String
show forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word2 -> Int
unWord2
instance Show Word3 where  show :: Word3 -> String
show  =  forall a. Show a => a -> String
show forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word3 -> Int
unWord3
instance Show Word4 where  show :: Word4 -> String
show  =  forall a. Show a => a -> String
show forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word4 -> Int
unWord4
instance Show Nat where  show :: Nat -> String
show (Nat Int
x)  =  forall a. Show a => a -> String
show Int
x
instance Show Nat1 where  show :: Nat1 -> String
show  =  forall a. Show a => a -> String
show forall b c a. (b -> c) -> (a -> b) -> a -> c
. Nat1 -> Int
unNat1
instance Show Nat2 where  show :: Nat2 -> String
show  =  forall a. Show a => a -> String
show forall b c a. (b -> c) -> (a -> b) -> a -> c
. Nat2 -> Int
unNat2
instance Show Nat3 where  show :: Nat3 -> String
show  =  forall a. Show a => a -> String
show forall b c a. (b -> c) -> (a -> b) -> a -> c
. Nat3 -> Int
unNat3
instance Show Nat4 where  show :: Nat4 -> String
show  =  forall a. Show a => a -> String
show forall b c a. (b -> c) -> (a -> b) -> a -> c
. Nat4 -> Int
unNat4
instance Show Nat5 where  show :: Nat5 -> String
show  =  forall a. Show a => a -> String
show forall b c a. (b -> c) -> (a -> b) -> a -> c
. Nat5 -> Int
unNat5
instance Show Nat6 where  show :: Nat6 -> String
show  =  forall a. Show a => a -> String
show forall b c a. (b -> c) -> (a -> b) -> a -> c
. Nat6 -> Int
unNat6
instance Show Nat7 where  show :: Nat7 -> String
show  =  forall a. Show a => a -> String
show forall b c a. (b -> c) -> (a -> b) -> a -> c
. Nat7 -> Int
unNat7
instance Show Natural where  show :: Natural -> String
show (Natural Integer
x)  =  forall a. Show a => a -> String
show Integer
x
instance Show A where  show :: A -> String
show  =  forall a. Show a => a -> String
show forall b c a. (b -> c) -> (a -> b) -> a -> c
. A -> Int
unA
instance Show B where  show :: B -> String
show  =  forall a. Show a => a -> String
show forall b c a. (b -> c) -> (a -> b) -> a -> c
. B -> Int
unB
instance Show C where  show :: C -> String
show  =  forall a. Show a => a -> String
show forall b c a. (b -> c) -> (a -> b) -> a -> c
. C -> Int
unC
instance Show D where  show :: D -> String
show  =  forall a. Show a => a -> String
show forall b c a. (b -> c) -> (a -> b) -> a -> c
. D -> Int
unD
instance Show E where  show :: E -> String
show  =  forall a. Show a => a -> String
show forall b c a. (b -> c) -> (a -> b) -> a -> c
. E -> Int
unE
instance Show F where  show :: F -> String
show  =  forall a. Show a => a -> String
show forall b c a. (b -> c) -> (a -> b) -> a -> c
. F -> Int
unF

instance Read Int1 where  readsPrec :: Int -> ReadS Int1
readsPrec  =  forall a b. Read a => (a -> b) -> Int -> String -> [(b, String)]
readsPrecNewtype Int -> Int1
int1
instance Read Int2 where  readsPrec :: Int -> ReadS Int2
readsPrec  =  forall a b. Read a => (a -> b) -> Int -> String -> [(b, String)]
readsPrecNewtype Int -> Int2
int2
instance Read Int3 where  readsPrec :: Int -> ReadS Int3
readsPrec  =  forall a b. Read a => (a -> b) -> Int -> String -> [(b, String)]
readsPrecNewtype Int -> Int3
int3
instance Read Int4 where  readsPrec :: Int -> ReadS Int4
readsPrec  =  forall a b. Read a => (a -> b) -> Int -> String -> [(b, String)]
readsPrecNewtype Int -> Int4
int4
instance Read Word1 where  readsPrec :: Int -> ReadS Word1
readsPrec  =  forall a b. Read a => (a -> b) -> Int -> String -> [(b, String)]
readsPrecNewtype Int -> Word1
word1
instance Read Word2 where  readsPrec :: Int -> ReadS Word2
readsPrec  =  forall a b. Read a => (a -> b) -> Int -> String -> [(b, String)]
readsPrecNewtype Int -> Word2
word2
instance Read Word3 where  readsPrec :: Int -> ReadS Word3
readsPrec  =  forall a b. Read a => (a -> b) -> Int -> String -> [(b, String)]
readsPrecNewtype Int -> Word3
word3
instance Read Word4 where  readsPrec :: Int -> ReadS Word4
readsPrec  =  forall a b. Read a => (a -> b) -> Int -> String -> [(b, String)]
readsPrecNewtype Int -> Word4
word4
instance Read Nat where  readsPrec :: Int -> ReadS Nat
readsPrec  =  forall a b. Read a => (a -> b) -> Int -> String -> [(b, String)]
readsPrecNewtype Int -> Nat
nat
instance Read Nat1 where  readsPrec :: Int -> ReadS Nat1
readsPrec  =  forall a b. Read a => (a -> b) -> Int -> String -> [(b, String)]
readsPrecNewtype Int -> Nat1
nat1
instance Read Nat2 where  readsPrec :: Int -> ReadS Nat2
readsPrec  =  forall a b. Read a => (a -> b) -> Int -> String -> [(b, String)]
readsPrecNewtype Int -> Nat2
nat2
instance Read Nat3 where  readsPrec :: Int -> ReadS Nat3
readsPrec  =  forall a b. Read a => (a -> b) -> Int -> String -> [(b, String)]
readsPrecNewtype Int -> Nat3
nat3
instance Read Nat4 where  readsPrec :: Int -> ReadS Nat4
readsPrec  =  forall a b. Read a => (a -> b) -> Int -> String -> [(b, String)]
readsPrecNewtype Int -> Nat4
nat4
instance Read Nat5 where  readsPrec :: Int -> ReadS Nat5
readsPrec  =  forall a b. Read a => (a -> b) -> Int -> String -> [(b, String)]
readsPrecNewtype Int -> Nat5
nat5
instance Read Nat6 where  readsPrec :: Int -> ReadS Nat6
readsPrec  =  forall a b. Read a => (a -> b) -> Int -> String -> [(b, String)]
readsPrecNewtype Int -> Nat6
nat6
instance Read Nat7 where  readsPrec :: Int -> ReadS Nat7
readsPrec  =  forall a b. Read a => (a -> b) -> Int -> String -> [(b, String)]
readsPrecNewtype Int -> Nat7
nat7
instance Read Natural where  readsPrec :: Int -> ReadS Natural
readsPrec  =  forall a b. Read a => (a -> b) -> Int -> String -> [(b, String)]
readsPrecNewtype Integer -> Natural
natural
instance Read A where  readsPrec :: Int -> ReadS A
readsPrec  =  forall a b. Read a => (a -> b) -> Int -> String -> [(b, String)]
readsPrecNewtype Int -> A
mkA
instance Read B where  readsPrec :: Int -> ReadS B
readsPrec  =  forall a b. Read a => (a -> b) -> Int -> String -> [(b, String)]
readsPrecNewtype Int -> B
mkB
instance Read C where  readsPrec :: Int -> ReadS C
readsPrec  =  forall a b. Read a => (a -> b) -> Int -> String -> [(b, String)]
readsPrecNewtype Int -> C
mkC
instance Read D where  readsPrec :: Int -> ReadS D
readsPrec  =  forall a b. Read a => (a -> b) -> Int -> String -> [(b, String)]
readsPrecNewtype Int -> D
mkD
instance Read E where  readsPrec :: Int -> ReadS E
readsPrec  =  forall a b. Read a => (a -> b) -> Int -> String -> [(b, String)]
readsPrecNewtype Int -> E
mkE
instance Read F where  readsPrec :: Int -> ReadS F
readsPrec  =  forall a b. Read a => (a -> b) -> Int -> String -> [(b, String)]
readsPrecNewtype Int -> F
mkF


instance Num Int1 where
  + :: Int1 -> Int1 -> Int1
(+)  =  ONewtype Int1
oInt1 forall a. Num a => a -> a -> a
(+);  abs :: Int1 -> Int1
abs     =  (Int -> Int) -> Int1 -> Int1
fInt1 forall a. Num a => a -> a
abs
  (-)  =  ONewtype Int1
oInt1 (-);  signum :: Int1 -> Int1
signum  =  (Int -> Int) -> Int1 -> Int1
fInt1 forall a. Num a => a -> a
signum
  * :: Int1 -> Int1 -> Int1
(*)  =  ONewtype Int1
oInt1 forall a. Num a => a -> a -> a
(*);  fromInteger :: Integer -> Int1
fromInteger  =  Int -> Int1
int1 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Num a => Integer -> a
fromInteger

instance Num Int2 where
  + :: Int2 -> Int2 -> Int2
(+)  =  ONewtype Int2
oInt2 forall a. Num a => a -> a -> a
(+);  abs :: Int2 -> Int2
abs     =  (Int -> Int) -> Int2 -> Int2
fInt2 forall a. Num a => a -> a
abs
  (-)  =  ONewtype Int2
oInt2 (-);  signum :: Int2 -> Int2
signum  =  (Int -> Int) -> Int2 -> Int2
fInt2 forall a. Num a => a -> a
signum
  * :: Int2 -> Int2 -> Int2
(*)  =  ONewtype Int2
oInt2 forall a. Num a => a -> a -> a
(*);  fromInteger :: Integer -> Int2
fromInteger  =  Int -> Int2
int2 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Num a => Integer -> a
fromInteger

instance Num Int3 where
  + :: Int3 -> Int3 -> Int3
(+)  =  ONewtype Int3
oInt3 forall a. Num a => a -> a -> a
(+);  abs :: Int3 -> Int3
abs     =  (Int -> Int) -> Int3 -> Int3
fInt3 forall a. Num a => a -> a
abs
  (-)  =  ONewtype Int3
oInt3 (-);  signum :: Int3 -> Int3
signum  =  (Int -> Int) -> Int3 -> Int3
fInt3 forall a. Num a => a -> a
signum
  * :: Int3 -> Int3 -> Int3
(*)  =  ONewtype Int3
oInt3 forall a. Num a => a -> a -> a
(*);  fromInteger :: Integer -> Int3
fromInteger  =  Int -> Int3
int3 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Num a => Integer -> a
fromInteger

instance Num Int4 where
  + :: Int4 -> Int4 -> Int4
(+)  =  ONewtype Int4
oInt4 forall a. Num a => a -> a -> a
(+);  abs :: Int4 -> Int4
abs     =  (Int -> Int) -> Int4 -> Int4
fInt4 forall a. Num a => a -> a
abs
  (-)  =  ONewtype Int4
oInt4 (-);  signum :: Int4 -> Int4
signum  =  (Int -> Int) -> Int4 -> Int4
fInt4 forall a. Num a => a -> a
signum
  * :: Int4 -> Int4 -> Int4
(*)  =  ONewtype Int4
oInt4 forall a. Num a => a -> a -> a
(*);  fromInteger :: Integer -> Int4
fromInteger  =  Int -> Int4
int4 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Num a => Integer -> a
fromInteger

instance Num Word1 where
  + :: Word1 -> Word1 -> Word1
(+)  =  ONewtype Word1
oWord1 forall a. Num a => a -> a -> a
(+);  abs :: Word1 -> Word1
abs     =  (Int -> Int) -> Word1 -> Word1
fWord1 forall a. Num a => a -> a
abs
  (-)  =  ONewtype Word1
oWord1 (-);  signum :: Word1 -> Word1
signum  =  (Int -> Int) -> Word1 -> Word1
fWord1 forall a. Num a => a -> a
signum
  * :: Word1 -> Word1 -> Word1
(*)  =  ONewtype Word1
oWord1 forall a. Num a => a -> a -> a
(*);  fromInteger :: Integer -> Word1
fromInteger  =  Int -> Word1
word1 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Num a => Integer -> a
fromInteger

instance Num Word2 where
  + :: Word2 -> Word2 -> Word2
(+)  =  ONewtype Word2
oWord2 forall a. Num a => a -> a -> a
(+);  abs :: Word2 -> Word2
abs     =  (Int -> Int) -> Word2 -> Word2
fWord2 forall a. Num a => a -> a
abs
  (-)  =  ONewtype Word2
oWord2 (-);  signum :: Word2 -> Word2
signum  =  (Int -> Int) -> Word2 -> Word2
fWord2 forall a. Num a => a -> a
signum
  * :: Word2 -> Word2 -> Word2
(*)  =  ONewtype Word2
oWord2 forall a. Num a => a -> a -> a
(*);  fromInteger :: Integer -> Word2
fromInteger  =  Int -> Word2
word2 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Num a => Integer -> a
fromInteger

instance Num Word3 where
  + :: Word3 -> Word3 -> Word3
(+)  =  ONewtype Word3
oWord3 forall a. Num a => a -> a -> a
(+);  abs :: Word3 -> Word3
abs     =  (Int -> Int) -> Word3 -> Word3
fWord3 forall a. Num a => a -> a
abs
  (-)  =  ONewtype Word3
oWord3 (-);  signum :: Word3 -> Word3
signum  =  (Int -> Int) -> Word3 -> Word3
fWord3 forall a. Num a => a -> a
signum
  * :: Word3 -> Word3 -> Word3
(*)  =  ONewtype Word3
oWord3 forall a. Num a => a -> a -> a
(*);  fromInteger :: Integer -> Word3
fromInteger  =  Int -> Word3
word3 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Num a => Integer -> a
fromInteger

instance Num Word4 where
  + :: Word4 -> Word4 -> Word4
(+)  =  ONewtype Word4
oWord4 forall a. Num a => a -> a -> a
(+);  abs :: Word4 -> Word4
abs     =  (Int -> Int) -> Word4 -> Word4
fWord4 forall a. Num a => a -> a
abs
  (-)  =  ONewtype Word4
oWord4 (-);  signum :: Word4 -> Word4
signum  =  (Int -> Int) -> Word4 -> Word4
fWord4 forall a. Num a => a -> a
signum
  * :: Word4 -> Word4 -> Word4
(*)  =  ONewtype Word4
oWord4 forall a. Num a => a -> a -> a
(*);  fromInteger :: Integer -> Word4
fromInteger  =  Int -> Word4
word4 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Num a => Integer -> a
fromInteger

instance Num Nat where
  + :: Nat -> Nat -> Nat
(+)  =  ONewtype Nat
oNat forall a. Num a => a -> a -> a
(+);  abs :: Nat -> Nat
abs     =  (Int -> Int) -> Nat -> Nat
fNat forall a. Num a => a -> a
abs
  (-)  =  ONewtype Nat
oNat (-);  signum :: Nat -> Nat
signum  =  (Int -> Int) -> Nat -> Nat
fNat forall a. Num a => a -> a
signum
  * :: Nat -> Nat -> Nat
(*)  =  ONewtype Nat
oNat forall a. Num a => a -> a -> a
(*);  fromInteger :: Integer -> Nat
fromInteger  =  Int -> Nat
nat forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Num a => Integer -> a
fromInteger

instance Num Nat1 where
  + :: Nat1 -> Nat1 -> Nat1
(+)  =  ONewtype Nat1
oNat1 forall a. Num a => a -> a -> a
(+);  abs :: Nat1 -> Nat1
abs     =  (Int -> Int) -> Nat1 -> Nat1
fNat1 forall a. Num a => a -> a
abs
  (-)  =  ONewtype Nat1
oNat1 (-);  signum :: Nat1 -> Nat1
signum  =  (Int -> Int) -> Nat1 -> Nat1
fNat1 forall a. Num a => a -> a
signum
  * :: Nat1 -> Nat1 -> Nat1
(*)  =  ONewtype Nat1
oNat1 forall a. Num a => a -> a -> a
(*);  fromInteger :: Integer -> Nat1
fromInteger  =  Int -> Nat1
nat1 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Num a => Integer -> a
fromInteger

instance Num Nat2 where
  + :: Nat2 -> Nat2 -> Nat2
(+)  =  ONewtype Nat2
oNat2 forall a. Num a => a -> a -> a
(+);  abs :: Nat2 -> Nat2
abs     =  (Int -> Int) -> Nat2 -> Nat2
fNat2 forall a. Num a => a -> a
abs
  (-)  =  ONewtype Nat2
oNat2 (-);  signum :: Nat2 -> Nat2
signum  =  (Int -> Int) -> Nat2 -> Nat2
fNat2 forall a. Num a => a -> a
signum
  * :: Nat2 -> Nat2 -> Nat2
(*)  =  ONewtype Nat2
oNat2 forall a. Num a => a -> a -> a
(*);  fromInteger :: Integer -> Nat2
fromInteger  =  Int -> Nat2
nat2 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Num a => Integer -> a
fromInteger

instance Num Nat3 where
  + :: Nat3 -> Nat3 -> Nat3
(+)  =  ONewtype Nat3
oNat3 forall a. Num a => a -> a -> a
(+);  abs :: Nat3 -> Nat3
abs     =  (Int -> Int) -> Nat3 -> Nat3
fNat3 forall a. Num a => a -> a
abs
  (-)  =  ONewtype Nat3
oNat3 (-);  signum :: Nat3 -> Nat3
signum  =  (Int -> Int) -> Nat3 -> Nat3
fNat3 forall a. Num a => a -> a
signum
  * :: Nat3 -> Nat3 -> Nat3
(*)  =  ONewtype Nat3
oNat3 forall a. Num a => a -> a -> a
(*);  fromInteger :: Integer -> Nat3
fromInteger  =  Int -> Nat3
nat3 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Num a => Integer -> a
fromInteger

instance Num Nat4 where
  + :: Nat4 -> Nat4 -> Nat4
(+)  =  ONewtype Nat4
oNat4 forall a. Num a => a -> a -> a
(+);  abs :: Nat4 -> Nat4
abs     =  (Int -> Int) -> Nat4 -> Nat4
fNat4 forall a. Num a => a -> a
abs
  (-)  =  ONewtype Nat4
oNat4 (-);  signum :: Nat4 -> Nat4
signum  =  (Int -> Int) -> Nat4 -> Nat4
fNat4 forall a. Num a => a -> a
signum
  * :: Nat4 -> Nat4 -> Nat4
(*)  =  ONewtype Nat4
oNat4 forall a. Num a => a -> a -> a
(*);  fromInteger :: Integer -> Nat4
fromInteger  =  Int -> Nat4
nat4 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Num a => Integer -> a
fromInteger

instance Num Nat5 where
  + :: Nat5 -> Nat5 -> Nat5
(+)  =  ONewtype Nat5
oNat5 forall a. Num a => a -> a -> a
(+);  abs :: Nat5 -> Nat5
abs     =  (Int -> Int) -> Nat5 -> Nat5
fNat5 forall a. Num a => a -> a
abs
  (-)  =  ONewtype Nat5
oNat5 (-);  signum :: Nat5 -> Nat5
signum  =  (Int -> Int) -> Nat5 -> Nat5
fNat5 forall a. Num a => a -> a
signum
  * :: Nat5 -> Nat5 -> Nat5
(*)  =  ONewtype Nat5
oNat5 forall a. Num a => a -> a -> a
(*);  fromInteger :: Integer -> Nat5
fromInteger  =  Int -> Nat5
nat5 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Num a => Integer -> a
fromInteger

instance Num Nat6 where
  + :: Nat6 -> Nat6 -> Nat6
(+)  =  ONewtype Nat6
oNat6 forall a. Num a => a -> a -> a
(+);  abs :: Nat6 -> Nat6
abs     =  (Int -> Int) -> Nat6 -> Nat6
fNat6 forall a. Num a => a -> a
abs
  (-)  =  ONewtype Nat6
oNat6 (-);  signum :: Nat6 -> Nat6
signum  =  (Int -> Int) -> Nat6 -> Nat6
fNat6 forall a. Num a => a -> a
signum
  * :: Nat6 -> Nat6 -> Nat6
(*)  =  ONewtype Nat6
oNat6 forall a. Num a => a -> a -> a
(*);  fromInteger :: Integer -> Nat6
fromInteger  =  Int -> Nat6
nat6 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Num a => Integer -> a
fromInteger

instance Num Nat7 where
  + :: Nat7 -> Nat7 -> Nat7
(+)  =  ONewtype Nat7
oNat7 forall a. Num a => a -> a -> a
(+);  abs :: Nat7 -> Nat7
abs     =  (Int -> Int) -> Nat7 -> Nat7
fNat7 forall a. Num a => a -> a
abs
  (-)  =  ONewtype Nat7
oNat7 (-);  signum :: Nat7 -> Nat7
signum  =  (Int -> Int) -> Nat7 -> Nat7
fNat7 forall a. Num a => a -> a
signum
  * :: Nat7 -> Nat7 -> Nat7
(*)  =  ONewtype Nat7
oNat7 forall a. Num a => a -> a -> a
(*);  fromInteger :: Integer -> Nat7
fromInteger  =  Int -> Nat7
nat7 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Num a => Integer -> a
fromInteger

instance Num Natural where
  + :: Natural -> Natural -> Natural
(+)  =  (Integer -> Integer -> Integer) -> Natural -> Natural -> Natural
oNatural forall a. Num a => a -> a -> a
(+);  abs :: Natural -> Natural
abs     =  (Integer -> Integer) -> Natural -> Natural
fNatural forall a. Num a => a -> a
abs
  (-)  =  (Integer -> Integer -> Integer) -> Natural -> Natural -> Natural
oNatural (-);  signum :: Natural -> Natural
signum  =  (Integer -> Integer) -> Natural -> Natural
fNatural forall a. Num a => a -> a
signum
  * :: Natural -> Natural -> Natural
(*)  =  (Integer -> Integer -> Integer) -> Natural -> Natural -> Natural
oNatural forall a. Num a => a -> a -> a
(*);  fromInteger :: Integer -> Natural
fromInteger  =  Integer -> Natural
natural forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Num a => Integer -> a
fromInteger

instance Num A where
  + :: A -> A -> A
(+)  =  ONewtype A
oA forall a. Num a => a -> a -> a
(+);  abs :: A -> A
abs     =  (Int -> Int) -> A -> A
fA forall a. Num a => a -> a
abs
  (-)  =  ONewtype A
oA (-);  signum :: A -> A
signum  =  (Int -> Int) -> A -> A
fA forall a. Num a => a -> a
signum
  * :: A -> A -> A
(*)  =  ONewtype A
oA forall a. Num a => a -> a -> a
(*);  fromInteger :: Integer -> A
fromInteger  =  Int -> A
mkA forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Num a => Integer -> a
fromInteger

instance Num B where
  + :: B -> B -> B
(+)  =  ONewtype B
oB forall a. Num a => a -> a -> a
(+);  abs :: B -> B
abs     =  (Int -> Int) -> B -> B
fB forall a. Num a => a -> a
abs
  (-)  =  ONewtype B
oB (-);  signum :: B -> B
signum  =  (Int -> Int) -> B -> B
fB forall a. Num a => a -> a
signum
  * :: B -> B -> B
(*)  =  ONewtype B
oB forall a. Num a => a -> a -> a
(*);  fromInteger :: Integer -> B
fromInteger  =  Int -> B
mkB forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Num a => Integer -> a
fromInteger

instance Num C where
  + :: C -> C -> C
(+)  =  ONewtype C
oC forall a. Num a => a -> a -> a
(+);  abs :: C -> C
abs     =  (Int -> Int) -> C -> C
fC forall a. Num a => a -> a
abs
  (-)  =  ONewtype C
oC (-);  signum :: C -> C
signum  =  (Int -> Int) -> C -> C
fC forall a. Num a => a -> a
signum
  * :: C -> C -> C
(*)  =  ONewtype C
oC forall a. Num a => a -> a -> a
(*);  fromInteger :: Integer -> C
fromInteger  =  Int -> C
mkC forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Num a => Integer -> a
fromInteger

instance Num D where
  + :: D -> D -> D
(+)  =  ONewtype D
oD forall a. Num a => a -> a -> a
(+);  abs :: D -> D
abs     =  (Int -> Int) -> D -> D
fD forall a. Num a => a -> a
abs
  (-)  =  ONewtype D
oD (-);  signum :: D -> D
signum  =  (Int -> Int) -> D -> D
fD forall a. Num a => a -> a
signum
  * :: D -> D -> D
(*)  =  ONewtype D
oD forall a. Num a => a -> a -> a
(*);  fromInteger :: Integer -> D
fromInteger  =  Int -> D
mkD forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Num a => Integer -> a
fromInteger

instance Num E where
  + :: E -> E -> E
(+)  =  ONewtype E
oE forall a. Num a => a -> a -> a
(+);  abs :: E -> E
abs     =  (Int -> Int) -> E -> E
fE forall a. Num a => a -> a
abs
  (-)  =  ONewtype E
oE (-);  signum :: E -> E
signum  =  (Int -> Int) -> E -> E
fE forall a. Num a => a -> a
signum
  * :: E -> E -> E
(*)  =  ONewtype E
oE forall a. Num a => a -> a -> a
(*);  fromInteger :: Integer -> E
fromInteger  =  Int -> E
mkE forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Num a => Integer -> a
fromInteger

instance Num F where
  + :: F -> F -> F
(+)  =  ONewtype F
oF forall a. Num a => a -> a -> a
(+);  abs :: F -> F
abs     =  (Int -> Int) -> F -> F
fF forall a. Num a => a -> a
abs
  (-)  =  ONewtype F
oF (-);  signum :: F -> F
signum  =  (Int -> Int) -> F -> F
fF forall a. Num a => a -> a
signum
  * :: F -> F -> F
(*)  =  ONewtype F
oF forall a. Num a => a -> a -> a
(*);  fromInteger :: Integer -> F
fromInteger  =  Int -> F
mkF forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Num a => Integer -> a
fromInteger


instance Real Int1 where  toRational :: Int1 -> Rational
toRational (Int1 Int
x)  =  forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
x forall a. Integral a => a -> a -> Ratio a
% Integer
1
instance Real Int2 where  toRational :: Int2 -> Rational
toRational (Int2 Int
x)  =  forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
x forall a. Integral a => a -> a -> Ratio a
% Integer
1
instance Real Int3 where  toRational :: Int3 -> Rational
toRational (Int3 Int
x)  =  forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
x forall a. Integral a => a -> a -> Ratio a
% Integer
1
instance Real Int4 where  toRational :: Int4 -> Rational
toRational (Int4 Int
x)  =  forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
x forall a. Integral a => a -> a -> Ratio a
% Integer
1
instance Real Word1 where  toRational :: Word1 -> Rational
toRational (Word1 Int
x)  =  forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
x forall a. Integral a => a -> a -> Ratio a
% Integer
1
instance Real Word2 where  toRational :: Word2 -> Rational
toRational (Word2 Int
x)  =  forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
x forall a. Integral a => a -> a -> Ratio a
% Integer
1
instance Real Word3 where  toRational :: Word3 -> Rational
toRational (Word3 Int
x)  =  forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
x forall a. Integral a => a -> a -> Ratio a
% Integer
1
instance Real Word4 where  toRational :: Word4 -> Rational
toRational (Word4 Int
x)  =  forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
x forall a. Integral a => a -> a -> Ratio a
% Integer
1
instance Real Nat where  toRational :: Nat -> Rational
toRational (Nat Int
x)  =  forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
x forall a. Integral a => a -> a -> Ratio a
% Integer
1
instance Real Nat1 where  toRational :: Nat1 -> Rational
toRational (Nat1 Int
x)  =  forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
x forall a. Integral a => a -> a -> Ratio a
% Integer
1
instance Real Nat2 where  toRational :: Nat2 -> Rational
toRational (Nat2 Int
x)  =  forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
x forall a. Integral a => a -> a -> Ratio a
% Integer
1
instance Real Nat3 where  toRational :: Nat3 -> Rational
toRational (Nat3 Int
x)  =  forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
x forall a. Integral a => a -> a -> Ratio a
% Integer
1
instance Real Nat4 where  toRational :: Nat4 -> Rational
toRational (Nat4 Int
x)  =  forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
x forall a. Integral a => a -> a -> Ratio a
% Integer
1
instance Real Nat5 where  toRational :: Nat5 -> Rational
toRational (Nat5 Int
x)  =  forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
x forall a. Integral a => a -> a -> Ratio a
% Integer
1
instance Real Nat6 where  toRational :: Nat6 -> Rational
toRational (Nat6 Int
x)  =  forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
x forall a. Integral a => a -> a -> Ratio a
% Integer
1
instance Real Nat7 where  toRational :: Nat7 -> Rational
toRational (Nat7 Int
x)  =  forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
x forall a. Integral a => a -> a -> Ratio a
% Integer
1
instance Real Natural where  toRational :: Natural -> Rational
toRational (Natural Integer
x)  =  forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
x forall a. Integral a => a -> a -> Ratio a
% Integer
1
instance Real A where  toRational :: A -> Rational
toRational (A Int
x)  =  forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
x forall a. Integral a => a -> a -> Ratio a
% Integer
1
instance Real B where  toRational :: B -> Rational
toRational (B Int
x)  =  forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
x forall a. Integral a => a -> a -> Ratio a
% Integer
1
instance Real C where  toRational :: C -> Rational
toRational (C Int
x)  =  forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
x forall a. Integral a => a -> a -> Ratio a
% Integer
1
instance Real D where  toRational :: D -> Rational
toRational (D Int
x)  =  forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
x forall a. Integral a => a -> a -> Ratio a
% Integer
1
instance Real E where  toRational :: E -> Rational
toRational (E Int
x)  =  forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
x forall a. Integral a => a -> a -> Ratio a
% Integer
1
instance Real F where  toRational :: F -> Rational
toRational (F Int
x)  =  forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
x forall a. Integral a => a -> a -> Ratio a
% Integer
1

instance Integral Int1 where  quotRem :: Int1 -> Int1 -> (Int1, Int1)
quotRem  =  forall a b.
(a -> b) -> (b -> a) -> (a -> a -> (a, a)) -> b -> b -> (b, b)
otNewtype Int -> Int1
int1 Int1 -> Int
unInt1 forall a. Integral a => a -> a -> (a, a)
quotRem
                              toInteger :: Int1 -> Integer
toInteger  =  forall a. Integral a => a -> Integer
toInteger forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int1 -> Int
unInt1

instance Integral Int2 where  quotRem :: Int2 -> Int2 -> (Int2, Int2)
quotRem  =  forall a b.
(a -> b) -> (b -> a) -> (a -> a -> (a, a)) -> b -> b -> (b, b)
otNewtype Int -> Int2
int2 Int2 -> Int
unInt2 forall a. Integral a => a -> a -> (a, a)
quotRem
                              toInteger :: Int2 -> Integer
toInteger  =  forall a. Integral a => a -> Integer
toInteger forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int2 -> Int
unInt2

instance Integral Int3 where  quotRem :: Int3 -> Int3 -> (Int3, Int3)
quotRem  =  forall a b.
(a -> b) -> (b -> a) -> (a -> a -> (a, a)) -> b -> b -> (b, b)
otNewtype Int -> Int3
int3 Int3 -> Int
unInt3 forall a. Integral a => a -> a -> (a, a)
quotRem
                              toInteger :: Int3 -> Integer
toInteger  =  forall a. Integral a => a -> Integer
toInteger forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int3 -> Int
unInt3

instance Integral Int4 where  quotRem :: Int4 -> Int4 -> (Int4, Int4)
quotRem  =  forall a b.
(a -> b) -> (b -> a) -> (a -> a -> (a, a)) -> b -> b -> (b, b)
otNewtype Int -> Int4
int4 Int4 -> Int
unInt4 forall a. Integral a => a -> a -> (a, a)
quotRem
                              toInteger :: Int4 -> Integer
toInteger  =  forall a. Integral a => a -> Integer
toInteger forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int4 -> Int
unInt4

instance Integral Word1 where  quotRem :: Word1 -> Word1 -> (Word1, Word1)
quotRem  =  forall a b.
(a -> b) -> (b -> a) -> (a -> a -> (a, a)) -> b -> b -> (b, b)
otNewtype Int -> Word1
word1 Word1 -> Int
unWord1 forall a. Integral a => a -> a -> (a, a)
quotRem
                               toInteger :: Word1 -> Integer
toInteger  =  forall a. Integral a => a -> Integer
toInteger forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word1 -> Int
unWord1

instance Integral Word2 where  quotRem :: Word2 -> Word2 -> (Word2, Word2)
quotRem  =  forall a b.
(a -> b) -> (b -> a) -> (a -> a -> (a, a)) -> b -> b -> (b, b)
otNewtype Int -> Word2
word2 Word2 -> Int
unWord2 forall a. Integral a => a -> a -> (a, a)
quotRem
                               toInteger :: Word2 -> Integer
toInteger  =  forall a. Integral a => a -> Integer
toInteger forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word2 -> Int
unWord2

instance Integral Word3 where  quotRem :: Word3 -> Word3 -> (Word3, Word3)
quotRem  =  forall a b.
(a -> b) -> (b -> a) -> (a -> a -> (a, a)) -> b -> b -> (b, b)
otNewtype Int -> Word3
word3 Word3 -> Int
unWord3 forall a. Integral a => a -> a -> (a, a)
quotRem
                               toInteger :: Word3 -> Integer
toInteger  =  forall a. Integral a => a -> Integer
toInteger forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word3 -> Int
unWord3

instance Integral Word4 where  quotRem :: Word4 -> Word4 -> (Word4, Word4)
quotRem  =  forall a b.
(a -> b) -> (b -> a) -> (a -> a -> (a, a)) -> b -> b -> (b, b)
otNewtype Int -> Word4
word4 Word4 -> Int
unWord4 forall a. Integral a => a -> a -> (a, a)
quotRem
                               toInteger :: Word4 -> Integer
toInteger  =  forall a. Integral a => a -> Integer
toInteger forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word4 -> Int
unWord4

instance Integral Nat where  quotRem :: Nat -> Nat -> (Nat, Nat)
quotRem  =  forall a b.
(a -> b) -> (b -> a) -> (a -> a -> (a, a)) -> b -> b -> (b, b)
otNewtype Int -> Nat
Nat Nat -> Int
unNat forall a. Integral a => a -> a -> (a, a)
quotRem
                             toInteger :: Nat -> Integer
toInteger  =  forall a. Integral a => a -> Integer
toInteger forall b c a. (b -> c) -> (a -> b) -> a -> c
. Nat -> Int
unNat

instance Integral Nat1 where  quotRem :: Nat1 -> Nat1 -> (Nat1, Nat1)
quotRem  =  forall a b.
(a -> b) -> (b -> a) -> (a -> a -> (a, a)) -> b -> b -> (b, b)
otNewtype Int -> Nat1
nat1 Nat1 -> Int
unNat1 forall a. Integral a => a -> a -> (a, a)
quotRem
                              toInteger :: Nat1 -> Integer
toInteger  =  forall a. Integral a => a -> Integer
toInteger forall b c a. (b -> c) -> (a -> b) -> a -> c
. Nat1 -> Int
unNat1

instance Integral Nat2 where  quotRem :: Nat2 -> Nat2 -> (Nat2, Nat2)
quotRem  =  forall a b.
(a -> b) -> (b -> a) -> (a -> a -> (a, a)) -> b -> b -> (b, b)
otNewtype Int -> Nat2
nat2 Nat2 -> Int
unNat2 forall a. Integral a => a -> a -> (a, a)
quotRem
                              toInteger :: Nat2 -> Integer
toInteger  =  forall a. Integral a => a -> Integer
toInteger forall b c a. (b -> c) -> (a -> b) -> a -> c
. Nat2 -> Int
unNat2

instance Integral Nat3 where  quotRem :: Nat3 -> Nat3 -> (Nat3, Nat3)
quotRem  =  forall a b.
(a -> b) -> (b -> a) -> (a -> a -> (a, a)) -> b -> b -> (b, b)
otNewtype Int -> Nat3
nat3 Nat3 -> Int
unNat3 forall a. Integral a => a -> a -> (a, a)
quotRem
                              toInteger :: Nat3 -> Integer
toInteger  =  forall a. Integral a => a -> Integer
toInteger forall b c a. (b -> c) -> (a -> b) -> a -> c
. Nat3 -> Int
unNat3

instance Integral Nat4 where  quotRem :: Nat4 -> Nat4 -> (Nat4, Nat4)
quotRem  =  forall a b.
(a -> b) -> (b -> a) -> (a -> a -> (a, a)) -> b -> b -> (b, b)
otNewtype Int -> Nat4
nat4 Nat4 -> Int
unNat4 forall a. Integral a => a -> a -> (a, a)
quotRem
                              toInteger :: Nat4 -> Integer
toInteger  =  forall a. Integral a => a -> Integer
toInteger forall b c a. (b -> c) -> (a -> b) -> a -> c
. Nat4 -> Int
unNat4

instance Integral Nat5 where  quotRem :: Nat5 -> Nat5 -> (Nat5, Nat5)
quotRem  =  forall a b.
(a -> b) -> (b -> a) -> (a -> a -> (a, a)) -> b -> b -> (b, b)
otNewtype Int -> Nat5
nat5 Nat5 -> Int
unNat5 forall a. Integral a => a -> a -> (a, a)
quotRem
                              toInteger :: Nat5 -> Integer
toInteger  =  forall a. Integral a => a -> Integer
toInteger forall b c a. (b -> c) -> (a -> b) -> a -> c
. Nat5 -> Int
unNat5

instance Integral Nat6 where  quotRem :: Nat6 -> Nat6 -> (Nat6, Nat6)
quotRem  =  forall a b.
(a -> b) -> (b -> a) -> (a -> a -> (a, a)) -> b -> b -> (b, b)
otNewtype Int -> Nat6
nat6 Nat6 -> Int
unNat6 forall a. Integral a => a -> a -> (a, a)
quotRem
                              toInteger :: Nat6 -> Integer
toInteger  =  forall a. Integral a => a -> Integer
toInteger forall b c a. (b -> c) -> (a -> b) -> a -> c
. Nat6 -> Int
unNat6

instance Integral Nat7 where  quotRem :: Nat7 -> Nat7 -> (Nat7, Nat7)
quotRem  =  forall a b.
(a -> b) -> (b -> a) -> (a -> a -> (a, a)) -> b -> b -> (b, b)
otNewtype Int -> Nat7
nat7 Nat7 -> Int
unNat7 forall a. Integral a => a -> a -> (a, a)
quotRem
                              toInteger :: Nat7 -> Integer
toInteger  =  forall a. Integral a => a -> Integer
toInteger forall b c a. (b -> c) -> (a -> b) -> a -> c
. Nat7 -> Int
unNat7

instance Integral Natural where  quotRem :: Natural -> Natural -> (Natural, Natural)
quotRem  =  forall a b.
(a -> b) -> (b -> a) -> (a -> a -> (a, a)) -> b -> b -> (b, b)
otNewtype Integer -> Natural
natural Natural -> Integer
unNatural forall a. Integral a => a -> a -> (a, a)
quotRem
                                 toInteger :: Natural -> Integer
toInteger  =  forall a. Integral a => a -> Integer
toInteger forall b c a. (b -> c) -> (a -> b) -> a -> c
. Natural -> Integer
unNatural

instance Integral A where  quotRem :: A -> A -> (A, A)
quotRem  =  forall a b.
(a -> b) -> (b -> a) -> (a -> a -> (a, a)) -> b -> b -> (b, b)
otNewtype Int -> A
mkA A -> Int
unA forall a. Integral a => a -> a -> (a, a)
quotRem
                           toInteger :: A -> Integer
toInteger  =  forall a. Integral a => a -> Integer
toInteger forall b c a. (b -> c) -> (a -> b) -> a -> c
. A -> Int
unA

instance Integral B where  quotRem :: B -> B -> (B, B)
quotRem  =  forall a b.
(a -> b) -> (b -> a) -> (a -> a -> (a, a)) -> b -> b -> (b, b)
otNewtype Int -> B
mkB B -> Int
unB forall a. Integral a => a -> a -> (a, a)
quotRem
                           toInteger :: B -> Integer
toInteger  =  forall a. Integral a => a -> Integer
toInteger forall b c a. (b -> c) -> (a -> b) -> a -> c
. B -> Int
unB

instance Integral C where  quotRem :: C -> C -> (C, C)
quotRem  =  forall a b.
(a -> b) -> (b -> a) -> (a -> a -> (a, a)) -> b -> b -> (b, b)
otNewtype Int -> C
mkC C -> Int
unC forall a. Integral a => a -> a -> (a, a)
quotRem
                           toInteger :: C -> Integer
toInteger  =  forall a. Integral a => a -> Integer
toInteger forall b c a. (b -> c) -> (a -> b) -> a -> c
. C -> Int
unC

instance Integral D where  quotRem :: D -> D -> (D, D)
quotRem  =  forall a b.
(a -> b) -> (b -> a) -> (a -> a -> (a, a)) -> b -> b -> (b, b)
otNewtype Int -> D
mkD D -> Int
unD forall a. Integral a => a -> a -> (a, a)
quotRem
                           toInteger :: D -> Integer
toInteger  =  forall a. Integral a => a -> Integer
toInteger forall b c a. (b -> c) -> (a -> b) -> a -> c
. D -> Int
unD

instance Integral E where  quotRem :: E -> E -> (E, E)
quotRem  =  forall a b.
(a -> b) -> (b -> a) -> (a -> a -> (a, a)) -> b -> b -> (b, b)
otNewtype Int -> E
mkE E -> Int
unE forall a. Integral a => a -> a -> (a, a)
quotRem
                           toInteger :: E -> Integer
toInteger  =  forall a. Integral a => a -> Integer
toInteger forall b c a. (b -> c) -> (a -> b) -> a -> c
. E -> Int
unE

instance Integral F where  quotRem :: F -> F -> (F, F)
quotRem  =  forall a b.
(a -> b) -> (b -> a) -> (a -> a -> (a, a)) -> b -> b -> (b, b)
otNewtype Int -> F
mkF F -> Int
unF forall a. Integral a => a -> a -> (a, a)
quotRem
                           toInteger :: F -> Integer
toInteger  =  forall a. Integral a => a -> Integer
toInteger forall b c a. (b -> c) -> (a -> b) -> a -> c
. F -> Int
unF

instance Bounded Int1 where  maxBound :: Int1
maxBound  =  Int -> Int1
Int1 Int
0;  minBound :: Int1
minBound  =  Int -> Int1
Int1 (-Int
1)
instance Bounded Int2 where  maxBound :: Int2
maxBound  =  Int -> Int2
Int2 Int
1;  minBound :: Int2
minBound  =  Int -> Int2
Int2 (-Int
2)
instance Bounded Int3 where  maxBound :: Int3
maxBound  =  Int -> Int3
Int3 Int
3;  minBound :: Int3
minBound  =  Int -> Int3
Int3 (-Int
4)
instance Bounded Int4 where  maxBound :: Int4
maxBound  =  Int -> Int4
Int4 Int
7;  minBound :: Int4
minBound  =  Int -> Int4
Int4 (-Int
8)
instance Bounded Word1 where  maxBound :: Word1
maxBound  =  Int -> Word1
Word1 Int
1;  minBound :: Word1
minBound  =  Int -> Word1
Word1 Int
0
instance Bounded Word2 where  maxBound :: Word2
maxBound  =  Int -> Word2
Word2 Int
3;  minBound :: Word2
minBound  =  Int -> Word2
Word2 Int
0
instance Bounded Word3 where  maxBound :: Word3
maxBound  =  Int -> Word3
Word3 Int
7;  minBound :: Word3
minBound  =  Int -> Word3
Word3 Int
0
instance Bounded Word4 where  maxBound :: Word4
maxBound  =  Int -> Word4
Word4 Int
15;  minBound :: Word4
minBound  =  Int -> Word4
Word4 Int
0
instance Bounded Nat where  maxBound :: Nat
maxBound  =  Int -> Nat
Nat forall a. Bounded a => a
maxBound;  minBound :: Nat
minBound  =  Int -> Nat
Nat Int
0
instance Bounded Nat1 where  maxBound :: Nat1
maxBound  =  Int -> Nat1
Nat1 Int
0;  minBound :: Nat1
minBound  =  Int -> Nat1
Nat1 Int
0
instance Bounded Nat2 where  maxBound :: Nat2
maxBound  =  Int -> Nat2
Nat2 Int
1;  minBound :: Nat2
minBound  =  Int -> Nat2
Nat2 Int
0
instance Bounded Nat3 where  maxBound :: Nat3
maxBound  =  Int -> Nat3
Nat3 Int
2;  minBound :: Nat3
minBound  =  Int -> Nat3
Nat3 Int
0
instance Bounded Nat4 where  maxBound :: Nat4
maxBound  =  Int -> Nat4
Nat4 Int
3;  minBound :: Nat4
minBound  =  Int -> Nat4
Nat4 Int
0
instance Bounded Nat5 where  maxBound :: Nat5
maxBound  =  Int -> Nat5
Nat5 Int
4;  minBound :: Nat5
minBound  =  Int -> Nat5
Nat5 Int
0
instance Bounded Nat6 where  maxBound :: Nat6
maxBound  =  Int -> Nat6
Nat6 Int
5;  minBound :: Nat6
minBound  =  Int -> Nat6
Nat6 Int
0
instance Bounded Nat7 where  maxBound :: Nat7
maxBound  =  Int -> Nat7
Nat7 Int
6;  minBound :: Nat7
minBound  =  Int -> Nat7
Nat7 Int
0
instance Bounded A where  maxBound :: A
maxBound  =  Int -> A
A Int
5;  minBound :: A
minBound  =  Int -> A
A Int
0
instance Bounded B where  maxBound :: B
maxBound  =  Int -> B
B Int
5;  minBound :: B
minBound  =  Int -> B
B Int
0
instance Bounded C where  maxBound :: C
maxBound  =  Int -> C
C Int
5;  minBound :: C
minBound  =  Int -> C
C Int
0
instance Bounded D where  maxBound :: D
maxBound  =  Int -> D
D Int
5;  minBound :: D
minBound  =  Int -> D
D Int
0
instance Bounded E where  maxBound :: E
maxBound  =  Int -> E
E Int
5;  minBound :: E
minBound  =  Int -> E
E Int
0
instance Bounded F where  maxBound :: F
maxBound  =  Int -> F
F Int
5;  minBound :: F
minBound  =  Int -> F
F Int
0

instance Enum Int1 where
  toEnum :: Int -> Int1
toEnum    =  Int -> Int1
int1;    enumFrom :: Int1 -> [Int1]
enumFrom      =  forall a. (Ord a, Bounded a, Enum a) => a -> [a]
boundedEnumFrom
  fromEnum :: Int1 -> Int
fromEnum  =  Int1 -> Int
unInt1;  enumFromThen :: Int1 -> Int1 -> [Int1]
enumFromThen  =  forall a. (Ord a, Bounded a, Enum a) => a -> a -> [a]
boundedEnumFromThen

instance Enum Int2 where
  toEnum :: Int -> Int2
toEnum    =  Int -> Int2
int2;    enumFrom :: Int2 -> [Int2]
enumFrom      =  forall a. (Ord a, Bounded a, Enum a) => a -> [a]
boundedEnumFrom
  fromEnum :: Int2 -> Int
fromEnum  =  Int2 -> Int
unInt2;  enumFromThen :: Int2 -> Int2 -> [Int2]
enumFromThen  =  forall a. (Ord a, Bounded a, Enum a) => a -> a -> [a]
boundedEnumFromThen

instance Enum Int3 where
  toEnum :: Int -> Int3
toEnum    =  Int -> Int3
int3;    enumFrom :: Int3 -> [Int3]
enumFrom      =  forall a. (Ord a, Bounded a, Enum a) => a -> [a]
boundedEnumFrom
  fromEnum :: Int3 -> Int
fromEnum  =  Int3 -> Int
unInt3;  enumFromThen :: Int3 -> Int3 -> [Int3]
enumFromThen  =  forall a. (Ord a, Bounded a, Enum a) => a -> a -> [a]
boundedEnumFromThen

instance Enum Int4 where
  toEnum :: Int -> Int4
toEnum    =  Int -> Int4
int4;    enumFrom :: Int4 -> [Int4]
enumFrom      =  forall a. (Ord a, Bounded a, Enum a) => a -> [a]
boundedEnumFrom
  fromEnum :: Int4 -> Int
fromEnum  =  Int4 -> Int
unInt4;  enumFromThen :: Int4 -> Int4 -> [Int4]
enumFromThen  =  forall a. (Ord a, Bounded a, Enum a) => a -> a -> [a]
boundedEnumFromThen

instance Enum Word1 where
  toEnum :: Int -> Word1
toEnum    =  Int -> Word1
word1;    enumFrom :: Word1 -> [Word1]
enumFrom      =  forall a. (Ord a, Bounded a, Enum a) => a -> [a]
boundedEnumFrom
  fromEnum :: Word1 -> Int
fromEnum  =  Word1 -> Int
unWord1;  enumFromThen :: Word1 -> Word1 -> [Word1]
enumFromThen  =  forall a. (Ord a, Bounded a, Enum a) => a -> a -> [a]
boundedEnumFromThen

instance Enum Word2 where
  toEnum :: Int -> Word2
toEnum    =  Int -> Word2
word2;    enumFrom :: Word2 -> [Word2]
enumFrom      =  forall a. (Ord a, Bounded a, Enum a) => a -> [a]
boundedEnumFrom
  fromEnum :: Word2 -> Int
fromEnum  =  Word2 -> Int
unWord2;  enumFromThen :: Word2 -> Word2 -> [Word2]
enumFromThen  =  forall a. (Ord a, Bounded a, Enum a) => a -> a -> [a]
boundedEnumFromThen

instance Enum Word3 where
  toEnum :: Int -> Word3
toEnum    =  Int -> Word3
word3;    enumFrom :: Word3 -> [Word3]
enumFrom      =  forall a. (Ord a, Bounded a, Enum a) => a -> [a]
boundedEnumFrom
  fromEnum :: Word3 -> Int
fromEnum  =  Word3 -> Int
unWord3;  enumFromThen :: Word3 -> Word3 -> [Word3]
enumFromThen  =  forall a. (Ord a, Bounded a, Enum a) => a -> a -> [a]
boundedEnumFromThen

instance Enum Word4 where
  toEnum :: Int -> Word4
toEnum    =  Int -> Word4
word4;    enumFrom :: Word4 -> [Word4]
enumFrom      =  forall a. (Ord a, Bounded a, Enum a) => a -> [a]
boundedEnumFrom
  fromEnum :: Word4 -> Int
fromEnum  =  Word4 -> Int
unWord4;  enumFromThen :: Word4 -> Word4 -> [Word4]
enumFromThen  =  forall a. (Ord a, Bounded a, Enum a) => a -> a -> [a]
boundedEnumFromThen

instance Enum Nat where
  toEnum :: Int -> Nat
toEnum    =  Int -> Nat
nat;    enumFrom :: Nat -> [Nat]
enumFrom      =  forall a. (Ord a, Bounded a, Enum a) => a -> [a]
boundedEnumFrom
  fromEnum :: Nat -> Int
fromEnum  =  Nat -> Int
unNat;  enumFromThen :: Nat -> Nat -> [Nat]
enumFromThen  =  forall a. (Ord a, Bounded a, Enum a) => a -> a -> [a]
boundedEnumFromThen

instance Enum Nat1 where
  toEnum :: Int -> Nat1
toEnum    =  Int -> Nat1
nat1;    enumFrom :: Nat1 -> [Nat1]
enumFrom      =  forall a. (Ord a, Bounded a, Enum a) => a -> [a]
boundedEnumFrom
  fromEnum :: Nat1 -> Int
fromEnum  =  Nat1 -> Int
unNat1;  enumFromThen :: Nat1 -> Nat1 -> [Nat1]
enumFromThen  =  forall a. (Ord a, Bounded a, Enum a) => a -> a -> [a]
boundedEnumFromThen

instance Enum Nat2 where
  toEnum :: Int -> Nat2
toEnum    =  Int -> Nat2
nat2;    enumFrom :: Nat2 -> [Nat2]
enumFrom      =  forall a. (Ord a, Bounded a, Enum a) => a -> [a]
boundedEnumFrom
  fromEnum :: Nat2 -> Int
fromEnum  =  Nat2 -> Int
unNat2;  enumFromThen :: Nat2 -> Nat2 -> [Nat2]
enumFromThen  =  forall a. (Ord a, Bounded a, Enum a) => a -> a -> [a]
boundedEnumFromThen

instance Enum Nat3 where
  toEnum :: Int -> Nat3
toEnum    =  Int -> Nat3
nat3;    enumFrom :: Nat3 -> [Nat3]
enumFrom      =  forall a. (Ord a, Bounded a, Enum a) => a -> [a]
boundedEnumFrom
  fromEnum :: Nat3 -> Int
fromEnum  =  Nat3 -> Int
unNat3;  enumFromThen :: Nat3 -> Nat3 -> [Nat3]
enumFromThen  =  forall a. (Ord a, Bounded a, Enum a) => a -> a -> [a]
boundedEnumFromThen

instance Enum Nat4 where
  toEnum :: Int -> Nat4
toEnum    =  Int -> Nat4
nat4;    enumFrom :: Nat4 -> [Nat4]
enumFrom      =  forall a. (Ord a, Bounded a, Enum a) => a -> [a]
boundedEnumFrom
  fromEnum :: Nat4 -> Int
fromEnum  =  Nat4 -> Int
unNat4;  enumFromThen :: Nat4 -> Nat4 -> [Nat4]
enumFromThen  =  forall a. (Ord a, Bounded a, Enum a) => a -> a -> [a]
boundedEnumFromThen

instance Enum Nat5 where
  toEnum :: Int -> Nat5
toEnum    =  Int -> Nat5
nat5;    enumFrom :: Nat5 -> [Nat5]
enumFrom      =  forall a. (Ord a, Bounded a, Enum a) => a -> [a]
boundedEnumFrom
  fromEnum :: Nat5 -> Int
fromEnum  =  Nat5 -> Int
unNat5;  enumFromThen :: Nat5 -> Nat5 -> [Nat5]
enumFromThen  =  forall a. (Ord a, Bounded a, Enum a) => a -> a -> [a]
boundedEnumFromThen

instance Enum Nat6 where
  toEnum :: Int -> Nat6
toEnum    =  Int -> Nat6
nat6;    enumFrom :: Nat6 -> [Nat6]
enumFrom      =  forall a. (Ord a, Bounded a, Enum a) => a -> [a]
boundedEnumFrom
  fromEnum :: Nat6 -> Int
fromEnum  =  Nat6 -> Int
unNat6;  enumFromThen :: Nat6 -> Nat6 -> [Nat6]
enumFromThen  =  forall a. (Ord a, Bounded a, Enum a) => a -> a -> [a]
boundedEnumFromThen

instance Enum Nat7 where
  toEnum :: Int -> Nat7
toEnum    =  Int -> Nat7
nat7;    enumFrom :: Nat7 -> [Nat7]
enumFrom      =  forall a. (Ord a, Bounded a, Enum a) => a -> [a]
boundedEnumFrom
  fromEnum :: Nat7 -> Int
fromEnum  =  Nat7 -> Int
unNat7;  enumFromThen :: Nat7 -> Nat7 -> [Nat7]
enumFromThen  =  forall a. (Ord a, Bounded a, Enum a) => a -> a -> [a]
boundedEnumFromThen

instance Enum Natural where
  toEnum :: Int -> Natural
toEnum    =  Integer -> Natural
natural forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (Integral a, Num b) => a -> b
fromIntegral
  fromEnum :: Natural -> Int
fromEnum  =  forall a. Num a => Integer -> a
fromInteger forall b c a. (b -> c) -> (a -> b) -> a -> c
. Natural -> Integer
unNatural
  enumFrom :: Natural -> [Natural]
enumFrom     (Natural Integer
x)              =  forall a b. (a -> b) -> [a] -> [b]
map Integer -> Natural
Natural [Integer
x..]
  enumFromThen :: Natural -> Natural -> [Natural]
enumFromThen (Natural Integer
x) (Natural Integer
s)  =  forall a b. (a -> b) -> [a] -> [b]
map Integer -> Natural
Natural [Integer
x,Integer
s..]

instance Enum A where
  toEnum :: Int -> A
toEnum    =  Int -> A
mkA;  enumFrom :: A -> [A]
enumFrom      =  forall a. (Ord a, Bounded a, Enum a) => a -> [a]
boundedEnumFrom
  fromEnum :: A -> Int
fromEnum  =  A -> Int
unA;  enumFromThen :: A -> A -> [A]
enumFromThen  =  forall a. (Ord a, Bounded a, Enum a) => a -> a -> [a]
boundedEnumFromThen

instance Enum B where
  toEnum :: Int -> B
toEnum    =  Int -> B
mkB;  enumFrom :: B -> [B]
enumFrom      =  forall a. (Ord a, Bounded a, Enum a) => a -> [a]
boundedEnumFrom
  fromEnum :: B -> Int
fromEnum  =  B -> Int
unB;  enumFromThen :: B -> B -> [B]
enumFromThen  =  forall a. (Ord a, Bounded a, Enum a) => a -> a -> [a]
boundedEnumFromThen

instance Enum C where
  toEnum :: Int -> C
toEnum    =  Int -> C
mkC;  enumFrom :: C -> [C]
enumFrom      =  forall a. (Ord a, Bounded a, Enum a) => a -> [a]
boundedEnumFrom
  fromEnum :: C -> Int
fromEnum  =  C -> Int
unC;  enumFromThen :: C -> C -> [C]
enumFromThen  =  forall a. (Ord a, Bounded a, Enum a) => a -> a -> [a]
boundedEnumFromThen

instance Enum D where
  toEnum :: Int -> D
toEnum    =  Int -> D
mkD;  enumFrom :: D -> [D]
enumFrom      =  forall a. (Ord a, Bounded a, Enum a) => a -> [a]
boundedEnumFrom
  fromEnum :: D -> Int
fromEnum  =  D -> Int
unD;  enumFromThen :: D -> D -> [D]
enumFromThen  =  forall a. (Ord a, Bounded a, Enum a) => a -> a -> [a]
boundedEnumFromThen

instance Enum E where
  toEnum :: Int -> E
toEnum    =  Int -> E
mkE;  enumFrom :: E -> [E]
enumFrom      =  forall a. (Ord a, Bounded a, Enum a) => a -> [a]
boundedEnumFrom
  fromEnum :: E -> Int
fromEnum  =  E -> Int
unE;  enumFromThen :: E -> E -> [E]
enumFromThen  =  forall a. (Ord a, Bounded a, Enum a) => a -> a -> [a]
boundedEnumFromThen

instance Enum F where toEnum :: Int -> F
toEnum    =  Int -> F
mkF;  enumFrom :: F -> [F]
enumFrom      =  forall a. (Ord a, Bounded a, Enum a) => a -> [a]
boundedEnumFrom
                      fromEnum :: F -> Int
fromEnum  =  F -> Int
unF;  enumFromThen :: F -> F -> [F]
enumFromThen  =  forall a. (Ord a, Bounded a, Enum a) => a -> a -> [a]
boundedEnumFromThen

rng :: Enum a => (a,a) -> [a]
rng :: forall a. Enum a => (a, a) -> [a]
rng (a
m,a
n)  =  [a
m..a
n]

idx :: Integral a => (a,a) -> a -> Int
idx :: forall a. Integral a => (a, a) -> a -> Int
idx b :: (a, a)
b@(a
m,a
_) a
i  | forall a. Ord a => (a, a) -> a -> Bool
irng (a, a)
b a
i   =  forall a b. (Integral a, Num b) => a -> b
fromIntegral (a
i forall a. Num a => a -> a -> a
- a
m)
               | Bool
otherwise  =  forall a. HasCallStack => String -> a
error String
"Index out of range."

irng :: Ord a => (a,a) -> a -> Bool
irng :: forall a. Ord a => (a, a) -> a -> Bool
irng (a
m,a
n) a
i  =  a
m forall a. Ord a => a -> a -> Bool
<= a
i Bool -> Bool -> Bool
&& a
i forall a. Ord a => a -> a -> Bool
<= a
m

instance Ix Int1    where  range :: (Int1, Int1) -> [Int1]
range  =  forall a. Enum a => (a, a) -> [a]
rng;  index :: (Int1, Int1) -> Int1 -> Int
index  =  forall a. Integral a => (a, a) -> a -> Int
idx;  inRange :: (Int1, Int1) -> Int1 -> Bool
inRange  =  forall a. Ord a => (a, a) -> a -> Bool
irng
instance Ix Int2    where  range :: (Int2, Int2) -> [Int2]
range  =  forall a. Enum a => (a, a) -> [a]
rng;  index :: (Int2, Int2) -> Int2 -> Int
index  =  forall a. Integral a => (a, a) -> a -> Int
idx;  inRange :: (Int2, Int2) -> Int2 -> Bool
inRange  =  forall a. Ord a => (a, a) -> a -> Bool
irng
instance Ix Int3    where  range :: (Int3, Int3) -> [Int3]
range  =  forall a. Enum a => (a, a) -> [a]
rng;  index :: (Int3, Int3) -> Int3 -> Int
index  =  forall a. Integral a => (a, a) -> a -> Int
idx;  inRange :: (Int3, Int3) -> Int3 -> Bool
inRange  =  forall a. Ord a => (a, a) -> a -> Bool
irng
instance Ix Int4    where  range :: (Int4, Int4) -> [Int4]
range  =  forall a. Enum a => (a, a) -> [a]
rng;  index :: (Int4, Int4) -> Int4 -> Int
index  =  forall a. Integral a => (a, a) -> a -> Int
idx;  inRange :: (Int4, Int4) -> Int4 -> Bool
inRange  =  forall a. Ord a => (a, a) -> a -> Bool
irng
instance Ix Word1   where  range :: (Word1, Word1) -> [Word1]
range  =  forall a. Enum a => (a, a) -> [a]
rng;  index :: (Word1, Word1) -> Word1 -> Int
index  =  forall a. Integral a => (a, a) -> a -> Int
idx;  inRange :: (Word1, Word1) -> Word1 -> Bool
inRange  =  forall a. Ord a => (a, a) -> a -> Bool
irng
instance Ix Word2   where  range :: (Word2, Word2) -> [Word2]
range  =  forall a. Enum a => (a, a) -> [a]
rng;  index :: (Word2, Word2) -> Word2 -> Int
index  =  forall a. Integral a => (a, a) -> a -> Int
idx;  inRange :: (Word2, Word2) -> Word2 -> Bool
inRange  =  forall a. Ord a => (a, a) -> a -> Bool
irng
instance Ix Word3   where  range :: (Word3, Word3) -> [Word3]
range  =  forall a. Enum a => (a, a) -> [a]
rng;  index :: (Word3, Word3) -> Word3 -> Int
index  =  forall a. Integral a => (a, a) -> a -> Int
idx;  inRange :: (Word3, Word3) -> Word3 -> Bool
inRange  =  forall a. Ord a => (a, a) -> a -> Bool
irng
instance Ix Word4   where  range :: (Word4, Word4) -> [Word4]
range  =  forall a. Enum a => (a, a) -> [a]
rng;  index :: (Word4, Word4) -> Word4 -> Int
index  =  forall a. Integral a => (a, a) -> a -> Int
idx;  inRange :: (Word4, Word4) -> Word4 -> Bool
inRange  =  forall a. Ord a => (a, a) -> a -> Bool
irng
instance Ix Nat     where  range :: (Nat, Nat) -> [Nat]
range  =  forall a. Enum a => (a, a) -> [a]
rng;  index :: (Nat, Nat) -> Nat -> Int
index  =  forall a. Integral a => (a, a) -> a -> Int
idx;  inRange :: (Nat, Nat) -> Nat -> Bool
inRange  =  forall a. Ord a => (a, a) -> a -> Bool
irng
instance Ix Nat1    where  range :: (Nat1, Nat1) -> [Nat1]
range  =  forall a. Enum a => (a, a) -> [a]
rng;  index :: (Nat1, Nat1) -> Nat1 -> Int
index  =  forall a. Integral a => (a, a) -> a -> Int
idx;  inRange :: (Nat1, Nat1) -> Nat1 -> Bool
inRange  =  forall a. Ord a => (a, a) -> a -> Bool
irng
instance Ix Nat2    where  range :: (Nat2, Nat2) -> [Nat2]
range  =  forall a. Enum a => (a, a) -> [a]
rng;  index :: (Nat2, Nat2) -> Nat2 -> Int
index  =  forall a. Integral a => (a, a) -> a -> Int
idx;  inRange :: (Nat2, Nat2) -> Nat2 -> Bool
inRange  =  forall a. Ord a => (a, a) -> a -> Bool
irng
instance Ix Nat3    where  range :: (Nat3, Nat3) -> [Nat3]
range  =  forall a. Enum a => (a, a) -> [a]
rng;  index :: (Nat3, Nat3) -> Nat3 -> Int
index  =  forall a. Integral a => (a, a) -> a -> Int
idx;  inRange :: (Nat3, Nat3) -> Nat3 -> Bool
inRange  =  forall a. Ord a => (a, a) -> a -> Bool
irng
instance Ix Nat4    where  range :: (Nat4, Nat4) -> [Nat4]
range  =  forall a. Enum a => (a, a) -> [a]
rng;  index :: (Nat4, Nat4) -> Nat4 -> Int
index  =  forall a. Integral a => (a, a) -> a -> Int
idx;  inRange :: (Nat4, Nat4) -> Nat4 -> Bool
inRange  =  forall a. Ord a => (a, a) -> a -> Bool
irng
instance Ix Nat5    where  range :: (Nat5, Nat5) -> [Nat5]
range  =  forall a. Enum a => (a, a) -> [a]
rng;  index :: (Nat5, Nat5) -> Nat5 -> Int
index  =  forall a. Integral a => (a, a) -> a -> Int
idx;  inRange :: (Nat5, Nat5) -> Nat5 -> Bool
inRange  =  forall a. Ord a => (a, a) -> a -> Bool
irng
instance Ix Nat6    where  range :: (Nat6, Nat6) -> [Nat6]
range  =  forall a. Enum a => (a, a) -> [a]
rng;  index :: (Nat6, Nat6) -> Nat6 -> Int
index  =  forall a. Integral a => (a, a) -> a -> Int
idx;  inRange :: (Nat6, Nat6) -> Nat6 -> Bool
inRange  =  forall a. Ord a => (a, a) -> a -> Bool
irng
instance Ix Nat7    where  range :: (Nat7, Nat7) -> [Nat7]
range  =  forall a. Enum a => (a, a) -> [a]
rng;  index :: (Nat7, Nat7) -> Nat7 -> Int
index  =  forall a. Integral a => (a, a) -> a -> Int
idx;  inRange :: (Nat7, Nat7) -> Nat7 -> Bool
inRange  =  forall a. Ord a => (a, a) -> a -> Bool
irng
instance Ix Natural where  range :: (Natural, Natural) -> [Natural]
range  =  forall a. Enum a => (a, a) -> [a]
rng;  index :: (Natural, Natural) -> Natural -> Int
index  =  forall a. Integral a => (a, a) -> a -> Int
idx;  inRange :: (Natural, Natural) -> Natural -> Bool
inRange  =  forall a. Ord a => (a, a) -> a -> Bool
irng
instance Ix A       where  range :: (A, A) -> [A]
range  =  forall a. Enum a => (a, a) -> [a]
rng;  index :: (A, A) -> A -> Int
index  =  forall a. Integral a => (a, a) -> a -> Int
idx;  inRange :: (A, A) -> A -> Bool
inRange  =  forall a. Ord a => (a, a) -> a -> Bool
irng
instance Ix B       where  range :: (B, B) -> [B]
range  =  forall a. Enum a => (a, a) -> [a]
rng;  index :: (B, B) -> B -> Int
index  =  forall a. Integral a => (a, a) -> a -> Int
idx;  inRange :: (B, B) -> B -> Bool
inRange  =  forall a. Ord a => (a, a) -> a -> Bool
irng
instance Ix C       where  range :: (C, C) -> [C]
range  =  forall a. Enum a => (a, a) -> [a]
rng;  index :: (C, C) -> C -> Int
index  =  forall a. Integral a => (a, a) -> a -> Int
idx;  inRange :: (C, C) -> C -> Bool
inRange  =  forall a. Ord a => (a, a) -> a -> Bool
irng
instance Ix D       where  range :: (D, D) -> [D]
range  =  forall a. Enum a => (a, a) -> [a]
rng;  index :: (D, D) -> D -> Int
index  =  forall a. Integral a => (a, a) -> a -> Int
idx;  inRange :: (D, D) -> D -> Bool
inRange  =  forall a. Ord a => (a, a) -> a -> Bool
irng
instance Ix E       where  range :: (E, E) -> [E]
range  =  forall a. Enum a => (a, a) -> [a]
rng;  index :: (E, E) -> E -> Int
index  =  forall a. Integral a => (a, a) -> a -> Int
idx;  inRange :: (E, E) -> E -> Bool
inRange  =  forall a. Ord a => (a, a) -> a -> Bool
irng
instance Ix F       where  range :: (F, F) -> [F]
range  =  forall a. Enum a => (a, a) -> [a]
rng;  index :: (F, F) -> F -> Int
index  =  forall a. Integral a => (a, a) -> a -> Int
idx;  inRange :: (F, F) -> F -> Bool
inRange  =  forall a. Ord a => (a, a) -> a -> Bool
irng

instance Listable Int1 where  list :: [Int1]
list  =  [Int1
0,forall a. Bounded a => a
minBound]
instance Listable Int2 where  list :: [Int2]
list  =  forall a. (Ord a, Num a) => [a]
listIntegral
instance Listable Int3 where  list :: [Int3]
list  =  forall a. (Ord a, Num a) => [a]
listIntegral
instance Listable Int4 where  list :: [Int4]
list  =  forall a. (Ord a, Num a) => [a]
listIntegral
instance Listable Word1 where  list :: [Word1]
list  =  forall a. (Ord a, Num a) => [a]
listIntegral
instance Listable Word2 where  list :: [Word2]
list  =  forall a. (Ord a, Num a) => [a]
listIntegral
instance Listable Word3 where  list :: [Word3]
list  =  forall a. (Ord a, Num a) => [a]
listIntegral
instance Listable Word4 where  list :: [Word4]
list  =  forall a. (Ord a, Num a) => [a]
listIntegral
instance Listable Nat where  list :: [Nat]
list  =  forall a. (Ord a, Num a) => [a]
listIntegral
instance Listable Nat1 where  list :: [Nat1]
list  =  forall a. (Ord a, Num a) => [a]
listIntegral
instance Listable Nat2 where  list :: [Nat2]
list  =  forall a. (Ord a, Num a) => [a]
listIntegral
instance Listable Nat3 where  list :: [Nat3]
list  =  forall a. (Ord a, Num a) => [a]
listIntegral
instance Listable Nat4 where  list :: [Nat4]
list  =  forall a. (Ord a, Num a) => [a]
listIntegral
instance Listable Nat5 where  list :: [Nat5]
list  =  forall a. (Ord a, Num a) => [a]
listIntegral
instance Listable Nat6 where  list :: [Nat6]
list  =  forall a. (Ord a, Num a) => [a]
listIntegral
instance Listable Nat7 where  list :: [Nat7]
list  =  forall a. (Ord a, Num a) => [a]
listIntegral
instance Listable Natural where  list :: [Natural]
list  =  forall a. (Ord a, Num a) => [a]
listIntegral
instance Listable A where  list :: [A]
list  =  forall a. (Ord a, Num a) => [a]
listIntegral
instance Listable B where  list :: [B]
list  =  forall a. (Ord a, Num a) => [a]
listIntegral
instance Listable C where  list :: [C]
list  =  forall a. (Ord a, Num a) => [a]
listIntegral
instance Listable D where  list :: [D]
list  =  forall a. (Ord a, Num a) => [a]
listIntegral
instance Listable E where  list :: [E]
list  =  forall a. (Ord a, Num a) => [a]
listIntegral
instance Listable F where  list :: [F]
list  =  forall a. (Ord a, Num a) => [a]
listIntegral

-- | Deprecated.  Use 'Word1'.
type UInt1  =  Word1

-- | Deprecated.  Use 'Word2'.
type UInt2  =  Word2

-- | Deprecated.  Use 'Word3'.
type UInt3  =  Word3

-- | Deprecated.  Use 'Word4'.
type UInt4  =  Word4

-- | Lists without repeated elements.
--
-- > > take 6 $ list :: [NoDup Nat]
-- > [NoDup [],NoDup [0],NoDup [1],NoDup [0,1],NoDup [1,0],NoDup [2]]
--
-- Example, checking the property that @nub@ is an identity:
--
-- > import Data.List (nub)
-- > > check $ \xs -> nub xs == (xs :: [Int])
-- > *** Failed! Falsifiable (after 3 tests):
-- > [0,0]
-- > > check $ \(NoDup xs) -> nub xs == (xs :: [Int])
-- > +++ OK, passed 200 tests.
newtype NoDup a  =  NoDup [a]  deriving (Int -> NoDup a -> ShowS
forall a. Show a => Int -> NoDup a -> ShowS
forall a. Show a => [NoDup a] -> ShowS
forall a. Show a => NoDup a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NoDup a] -> ShowS
$cshowList :: forall a. Show a => [NoDup a] -> ShowS
show :: NoDup a -> String
$cshow :: forall a. Show a => NoDup a -> String
showsPrec :: Int -> NoDup a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> NoDup a -> ShowS
Show, ReadPrec [NoDup a]
ReadPrec (NoDup a)
ReadS [NoDup a]
forall a. Read a => ReadPrec [NoDup a]
forall a. Read a => ReadPrec (NoDup a)
forall a. Read a => Int -> ReadS (NoDup a)
forall a. Read a => ReadS [NoDup a]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NoDup a]
$creadListPrec :: forall a. Read a => ReadPrec [NoDup a]
readPrec :: ReadPrec (NoDup a)
$creadPrec :: forall a. Read a => ReadPrec (NoDup a)
readList :: ReadS [NoDup a]
$creadList :: forall a. Read a => ReadS [NoDup a]
readsPrec :: Int -> ReadS (NoDup a)
$creadsPrec :: forall a. Read a => Int -> ReadS (NoDup a)
Read, NoDup a -> NoDup a -> Bool
forall a. Eq a => NoDup a -> NoDup a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NoDup a -> NoDup a -> Bool
$c/= :: forall a. Eq a => NoDup a -> NoDup a -> Bool
== :: NoDup a -> NoDup a -> Bool
$c== :: forall a. Eq a => NoDup a -> NoDup a -> Bool
Eq, NoDup a -> NoDup a -> Bool
NoDup a -> NoDup a -> Ordering
NoDup a -> NoDup a -> NoDup a
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall {a}. Ord a => Eq (NoDup a)
forall a. Ord a => NoDup a -> NoDup a -> Bool
forall a. Ord a => NoDup a -> NoDup a -> Ordering
forall a. Ord a => NoDup a -> NoDup a -> NoDup a
min :: NoDup a -> NoDup a -> NoDup a
$cmin :: forall a. Ord a => NoDup a -> NoDup a -> NoDup a
max :: NoDup a -> NoDup a -> NoDup a
$cmax :: forall a. Ord a => NoDup a -> NoDup a -> NoDup a
>= :: NoDup a -> NoDup a -> Bool
$c>= :: forall a. Ord a => NoDup a -> NoDup a -> Bool
> :: NoDup a -> NoDup a -> Bool
$c> :: forall a. Ord a => NoDup a -> NoDup a -> Bool
<= :: NoDup a -> NoDup a -> Bool
$c<= :: forall a. Ord a => NoDup a -> NoDup a -> Bool
< :: NoDup a -> NoDup a -> Bool
$c< :: forall a. Ord a => NoDup a -> NoDup a -> Bool
compare :: NoDup a -> NoDup a -> Ordering
$ccompare :: forall a. Ord a => NoDup a -> NoDup a -> Ordering
Ord)

-- | Lists representing bags (multisets).
--   The 'Listable' 'tiers' enumeration will not have repeated bags.
--
-- > > take 6 (list :: [Bag Nat])
-- > [Bag [],Bag [0],Bag [0,0],Bag [1],Bag [0,0,0],Bag [0,1]]
--
-- See also: 'Test.LeanCheck.Tiers.bagsOf' and 'bagCons'.
newtype Bag a  =  Bag [a]  deriving (Int -> Bag a -> ShowS
forall a. Show a => Int -> Bag a -> ShowS
forall a. Show a => [Bag a] -> ShowS
forall a. Show a => Bag a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Bag a] -> ShowS
$cshowList :: forall a. Show a => [Bag a] -> ShowS
show :: Bag a -> String
$cshow :: forall a. Show a => Bag a -> String
showsPrec :: Int -> Bag a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> Bag a -> ShowS
Show, ReadPrec [Bag a]
ReadPrec (Bag a)
ReadS [Bag a]
forall a. Read a => ReadPrec [Bag a]
forall a. Read a => ReadPrec (Bag a)
forall a. Read a => Int -> ReadS (Bag a)
forall a. Read a => ReadS [Bag a]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Bag a]
$creadListPrec :: forall a. Read a => ReadPrec [Bag a]
readPrec :: ReadPrec (Bag a)
$creadPrec :: forall a. Read a => ReadPrec (Bag a)
readList :: ReadS [Bag a]
$creadList :: forall a. Read a => ReadS [Bag a]
readsPrec :: Int -> ReadS (Bag a)
$creadsPrec :: forall a. Read a => Int -> ReadS (Bag a)
Read, Bag a -> Bag a -> Bool
forall a. Eq a => Bag a -> Bag a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Bag a -> Bag a -> Bool
$c/= :: forall a. Eq a => Bag a -> Bag a -> Bool
== :: Bag a -> Bag a -> Bool
$c== :: forall a. Eq a => Bag a -> Bag a -> Bool
Eq, Bag a -> Bag a -> Bool
Bag a -> Bag a -> Ordering
Bag a -> Bag a -> Bag a
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall {a}. Ord a => Eq (Bag a)
forall a. Ord a => Bag a -> Bag a -> Bool
forall a. Ord a => Bag a -> Bag a -> Ordering
forall a. Ord a => Bag a -> Bag a -> Bag a
min :: Bag a -> Bag a -> Bag a
$cmin :: forall a. Ord a => Bag a -> Bag a -> Bag a
max :: Bag a -> Bag a -> Bag a
$cmax :: forall a. Ord a => Bag a -> Bag a -> Bag a
>= :: Bag a -> Bag a -> Bool
$c>= :: forall a. Ord a => Bag a -> Bag a -> Bool
> :: Bag a -> Bag a -> Bool
$c> :: forall a. Ord a => Bag a -> Bag a -> Bool
<= :: Bag a -> Bag a -> Bool
$c<= :: forall a. Ord a => Bag a -> Bag a -> Bool
< :: Bag a -> Bag a -> Bool
$c< :: forall a. Ord a => Bag a -> Bag a -> Bool
compare :: Bag a -> Bag a -> Ordering
$ccompare :: forall a. Ord a => Bag a -> Bag a -> Ordering
Ord)

-- | Lists representing sets.
--   The 'Listable' 'tiers' enumeration will not have repeated sets.
--
-- > > take 6 (list :: [Set Nat])
-- > [Set [],Set [0],Set [1],Set [0,1],Set [2],Set [0,2]]
newtype Set a  =  Set [a]  deriving (Int -> Set a -> ShowS
forall a. Show a => Int -> Set a -> ShowS
forall a. Show a => [Set a] -> ShowS
forall a. Show a => Set a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Set a] -> ShowS
$cshowList :: forall a. Show a => [Set a] -> ShowS
show :: Set a -> String
$cshow :: forall a. Show a => Set a -> String
showsPrec :: Int -> Set a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> Set a -> ShowS
Show, ReadPrec [Set a]
ReadPrec (Set a)
ReadS [Set a]
forall a. Read a => ReadPrec [Set a]
forall a. Read a => ReadPrec (Set a)
forall a. Read a => Int -> ReadS (Set a)
forall a. Read a => ReadS [Set a]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Set a]
$creadListPrec :: forall a. Read a => ReadPrec [Set a]
readPrec :: ReadPrec (Set a)
$creadPrec :: forall a. Read a => ReadPrec (Set a)
readList :: ReadS [Set a]
$creadList :: forall a. Read a => ReadS [Set a]
readsPrec :: Int -> ReadS (Set a)
$creadsPrec :: forall a. Read a => Int -> ReadS (Set a)
Read, Set a -> Set a -> Bool
forall a. Eq a => Set a -> Set a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Set a -> Set a -> Bool
$c/= :: forall a. Eq a => Set a -> Set a -> Bool
== :: Set a -> Set a -> Bool
$c== :: forall a. Eq a => Set a -> Set a -> Bool
Eq, Set a -> Set a -> Bool
Set a -> Set a -> Ordering
Set a -> Set a -> Set a
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall {a}. Ord a => Eq (Set a)
forall a. Ord a => Set a -> Set a -> Bool
forall a. Ord a => Set a -> Set a -> Ordering
forall a. Ord a => Set a -> Set a -> Set a
min :: Set a -> Set a -> Set a
$cmin :: forall a. Ord a => Set a -> Set a -> Set a
max :: Set a -> Set a -> Set a
$cmax :: forall a. Ord a => Set a -> Set a -> Set a
>= :: Set a -> Set a -> Bool
$c>= :: forall a. Ord a => Set a -> Set a -> Bool
> :: Set a -> Set a -> Bool
$c> :: forall a. Ord a => Set a -> Set a -> Bool
<= :: Set a -> Set a -> Bool
$c<= :: forall a. Ord a => Set a -> Set a -> Bool
< :: Set a -> Set a -> Bool
$c< :: forall a. Ord a => Set a -> Set a -> Bool
compare :: Set a -> Set a -> Ordering
$ccompare :: forall a. Ord a => Set a -> Set a -> Ordering
Ord)

-- | Lists of pairs representing maps.
--   The 'Listable' 'tiers' enumeration will not have repeated maps.
--
-- > > take 6 (list :: [Map Nat Nat])
-- > [Map [],Map [(0,0)],Map [(0,1)],Map [(1,0)],Map [(0,2)],Map [(1,1)]]
newtype Map a b  =  Map [(a,b)]  deriving (Int -> Map a b -> ShowS
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall a b. (Show a, Show b) => Int -> Map a b -> ShowS
forall a b. (Show a, Show b) => [Map a b] -> ShowS
forall a b. (Show a, Show b) => Map a b -> String
showList :: [Map a b] -> ShowS
$cshowList :: forall a b. (Show a, Show b) => [Map a b] -> ShowS
show :: Map a b -> String
$cshow :: forall a b. (Show a, Show b) => Map a b -> String
showsPrec :: Int -> Map a b -> ShowS
$cshowsPrec :: forall a b. (Show a, Show b) => Int -> Map a b -> ShowS
Show, ReadPrec [Map a b]
ReadPrec (Map a b)
ReadS [Map a b]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
forall a b. (Read a, Read b) => ReadPrec [Map a b]
forall a b. (Read a, Read b) => ReadPrec (Map a b)
forall a b. (Read a, Read b) => Int -> ReadS (Map a b)
forall a b. (Read a, Read b) => ReadS [Map a b]
readListPrec :: ReadPrec [Map a b]
$creadListPrec :: forall a b. (Read a, Read b) => ReadPrec [Map a b]
readPrec :: ReadPrec (Map a b)
$creadPrec :: forall a b. (Read a, Read b) => ReadPrec (Map a b)
readList :: ReadS [Map a b]
$creadList :: forall a b. (Read a, Read b) => ReadS [Map a b]
readsPrec :: Int -> ReadS (Map a b)
$creadsPrec :: forall a b. (Read a, Read b) => Int -> ReadS (Map a b)
Read, Map a b -> Map a b -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall a b. (Eq a, Eq b) => Map a b -> Map a b -> Bool
/= :: Map a b -> Map a b -> Bool
$c/= :: forall a b. (Eq a, Eq b) => Map a b -> Map a b -> Bool
== :: Map a b -> Map a b -> Bool
$c== :: forall a b. (Eq a, Eq b) => Map a b -> Map a b -> Bool
Eq, Map a b -> Map a b -> Bool
Map a b -> Map a b -> Ordering
Map a b -> Map a b -> Map a b
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall {a} {b}. (Ord a, Ord b) => Eq (Map a b)
forall a b. (Ord a, Ord b) => Map a b -> Map a b -> Bool
forall a b. (Ord a, Ord b) => Map a b -> Map a b -> Ordering
forall a b. (Ord a, Ord b) => Map a b -> Map a b -> Map a b
min :: Map a b -> Map a b -> Map a b
$cmin :: forall a b. (Ord a, Ord b) => Map a b -> Map a b -> Map a b
max :: Map a b -> Map a b -> Map a b
$cmax :: forall a b. (Ord a, Ord b) => Map a b -> Map a b -> Map a b
>= :: Map a b -> Map a b -> Bool
$c>= :: forall a b. (Ord a, Ord b) => Map a b -> Map a b -> Bool
> :: Map a b -> Map a b -> Bool
$c> :: forall a b. (Ord a, Ord b) => Map a b -> Map a b -> Bool
<= :: Map a b -> Map a b -> Bool
$c<= :: forall a b. (Ord a, Ord b) => Map a b -> Map a b -> Bool
< :: Map a b -> Map a b -> Bool
$c< :: forall a b. (Ord a, Ord b) => Map a b -> Map a b -> Bool
compare :: Map a b -> Map a b -> Ordering
$ccompare :: forall a b. (Ord a, Ord b) => Map a b -> Map a b -> Ordering
Ord)

instance Listable a => Listable (NoDup a) where  tiers :: [[NoDup a]]
tiers  =  forall a b. Listable a => ([a] -> b) -> [[b]]
noDupListCons forall a. [a] -> NoDup a
NoDup
instance Listable a => Listable (Bag a)   where  tiers :: [[Bag a]]
tiers  =  forall a b. Listable a => ([a] -> b) -> [[b]]
bagCons forall a. [a] -> Bag a
Bag
instance Listable a => Listable (Set a)   where  tiers :: [[Set a]]
tiers  =  forall a b. Listable a => ([a] -> b) -> [[b]]
setCons forall a. [a] -> Set a
Set
instance (Listable a, Listable b)
                    => Listable (Map a b) where  tiers :: [[Map a b]]
tiers  =  forall a b c. (Listable a, Listable b) => ([(a, b)] -> c) -> [[c]]
mapCons forall a b. [(a, b)] -> Map a b
Map

-- | 'X' type to be wrapped around integer types for an e-'X'-treme integer
--   enumeration.  See the 'Listable' instance for 'X'.  Use 'X' when
--   testing properties about overflows and the like:
--
-- > > check $ \x -> x + 1 > (x :: Int)
-- > +++ OK, passed 200 tests.
--
-- > > check $ \(X x) -> x + 1 > (x :: Int)
-- > +++ Failed! Falsifiable (after 4 tests):
-- > 9223372036854775807
newtype X a  =  X {forall a. X a -> a
unX :: a}  deriving (X a -> X a -> Bool
forall a. Eq a => X a -> X a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: X a -> X a -> Bool
$c/= :: forall a. Eq a => X a -> X a -> Bool
== :: X a -> X a -> Bool
$c== :: forall a. Eq a => X a -> X a -> Bool
Eq, X a -> X a -> Bool
X a -> X a -> Ordering
X a -> X a -> X a
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall {a}. Ord a => Eq (X a)
forall a. Ord a => X a -> X a -> Bool
forall a. Ord a => X a -> X a -> Ordering
forall a. Ord a => X a -> X a -> X a
min :: X a -> X a -> X a
$cmin :: forall a. Ord a => X a -> X a -> X a
max :: X a -> X a -> X a
$cmax :: forall a. Ord a => X a -> X a -> X a
>= :: X a -> X a -> Bool
$c>= :: forall a. Ord a => X a -> X a -> Bool
> :: X a -> X a -> Bool
$c> :: forall a. Ord a => X a -> X a -> Bool
<= :: X a -> X a -> Bool
$c<= :: forall a. Ord a => X a -> X a -> Bool
< :: X a -> X a -> Bool
$c< :: forall a. Ord a => X a -> X a -> Bool
compare :: X a -> X a -> Ordering
$ccompare :: forall a. Ord a => X a -> X a -> Ordering
Ord)
instance Show a => Show (X a) where  show :: X a -> String
show (X a
x)  =  forall a. Show a => a -> String
show a
x
instance (Integral a, Bounded a) => Listable (X a) where
  list :: [X a]
list  =  forall a b. (a -> b) -> [a] -> [b]
map forall a. a -> X a
X forall a. (Bounded a, Integral a) => [a]
listXIntegral
-- ^ Extremily large integers are intercalated with small integers.
--
--   > list :: [X Int]  =  map X
--   >   [ 0, 1, -1, maxBound,   minBound
--   >      , 2, -2, maxBound-1, minBound+1
--   >      , 3, -3, maxBound-2, minBound+2
--   >      , ... ]

-- FIXME: make this work for Int2 / Word2 types
--        by checking then using normal enumeration
listXIntegral :: (Bounded a, Integral a) => [a]
listXIntegral :: forall a. (Bounded a, Integral a) => [a]
listXIntegral  =  forall a. (Bounded a, Integral a) => a -> [a]
l forall a. HasCallStack => a
undefined
  where
  l :: (Bounded a, Integral a) => a -> [a]
  l :: forall a. (Bounded a, Integral a) => a -> [a]
l a
a | forall a. (Bounded a, Integral a) => a -> Integer
count a
a forall a. Ord a => a -> a -> Bool
<= Integer
4  =  forall a. (Ord a, Num a) => [a]
listIntegral
      | a
min forall a. Ord a => a -> a -> Bool
< a
0       =  forall a. (Bounded a, Integral a) => [a]
listXIntegralN
      | Bool
otherwise     =  forall a. (Bounded a, Integral a) => [a]
listXIntegralP
    where
    min :: a
min  =  forall a. Bounded a => a
minBound forall a. a -> a -> a
`asTypeOf` a
a
-- The type-hackery above is needed so that we don't need to activate
-- ScopedTypeVariables

listXIntegralN :: (Bounded a, Integral a) => [a]
listXIntegralN :: forall a. (Bounded a, Integral a) => [a]
listXIntegralN  =  a
0 forall a. a -> [a] -> [a]
: (forall a. Integral a => a -> a -> [a]
extremes a
1 forall a. Bounded a => a
maxBound) forall a. [a] -> [a] -> [a]
+| (forall a. Integral a => a -> a -> [a]
extremes (-a
1) forall a. Bounded a => a
minBound)
-- listXIntegralN :: Int4 =
--    0 : (([1,2,3,4] +| [7,6,5]) +| ([-1,-2,-3,-4] +| [-8,-7,-6,-5]))

listXIntegralP :: (Bounded a, Integral a) => [a]
listXIntegralP :: forall a. (Bounded a, Integral a) => [a]
listXIntegralP  =  a
0 forall a. a -> [a] -> [a]
: [a
1..a
midBound] forall a. [a] -> [a] -> [a]
++| [forall a. Bounded a => a
maxBound,(forall a. Bounded a => a
maxBoundforall a. Num a => a -> a -> a
-a
1)..(a
midBoundforall a. Num a => a -> a -> a
+a
1)]
  where
  midBound :: a
midBound  =  forall a. Bounded a => a
maxBound forall a. Integral a => a -> a -> a
`div` a
3 forall a. Num a => a -> a -> a
* a
2

-- how many of this type exist?
-- assumes 0 `elem` [minBound..maxBound]
count :: (Bounded a, Integral a) => a -> Integer
count :: forall a. (Bounded a, Integral a) => a -> Integer
count a
a  =  Integer
1 forall a. Num a => a -> a -> a
+ Integer
max forall a. Num a => a -> a -> a
+ forall a. Num a => a -> a
abs Integer
min
  where
  min :: Integer
min  =  forall a b. (Integral a, Num b) => a -> b
fromIntegral forall a b. (a -> b) -> a -> b
$ forall a. Bounded a => a
minBound forall a. a -> a -> a
`asTypeOf` a
a
  max :: Integer
max  =  forall a b. (Integral a, Num b) => a -> b
fromIntegral forall a b. (a -> b) -> a -> b
$ forall a. Bounded a => a
maxBound forall a. a -> a -> a
`asTypeOf` a
a

extremes :: (Integral a) => a -> a -> [a]
extremes :: forall a. Integral a => a -> a -> [a]
extremes a
x a
y
  | a
x forall a. Ord a => a -> a -> Bool
> a
y      =  [a
x,a
xforall a. Num a => a -> a -> a
-a
1..a
m] forall a. [a] -> [a] -> [a]
+| [a
y..a
mforall a. Num a => a -> a -> a
-a
1]
  | Bool
otherwise  =  [a
x..a
m] forall a. [a] -> [a] -> [a]
+| [a
y,a
yforall a. Num a => a -> a -> a
-a
1..a
mforall a. Num a => a -> a -> a
+a
1]
  where  m :: a
m  =  forall a. Integral a => a -> a -> a
mid a
x a
y

mid :: Integral a => a -> a -> a
mid :: forall a. Integral a => a -> a -> a
mid a
x a
y  =  a
x forall a. Integral a => a -> a -> a
`div` a
2
         forall a. Num a => a -> a -> a
+  a
y forall a. Integral a => a -> a -> a
`div` a
2
         forall a. Num a => a -> a -> a
+  if forall a. Integral a => a -> Bool
odd a
x Bool -> Bool -> Bool
&& forall a. Integral a => a -> Bool
odd a
y then a
1 else a
0

-- | Lazily interleaves two lists, switching between elements of the two.
--   This version uses the first list more frequently than the second.
--
-- > [x,y,z,w] +| [a,b] == [x,y, a, z,w, b]
(++|) :: [a] -> [a] -> [a]
[]        ++| :: forall a. [a] -> [a] -> [a]
++| [a]
ys      =  [a]
ys
[a]
xs        ++| []      =  [a]
xs
[a
x]       ++| [a]
ys      =  a
xforall a. a -> [a] -> [a]
:[a]
ys
(a
x:a
x':[a]
xs) ++| (a
y:[a]
ys)  =  a
xforall a. a -> [a] -> [a]
:a
x'forall a. a -> [a] -> [a]
:a
yforall a. a -> [a] -> [a]
:([a]
xs forall a. [a] -> [a] -> [a]
++| [a]
ys)
infixr 5 ++|

-- | Wrap around lists of integers for an enumeration containing e-'X'-treme
--   integer values.
--
-- > > check $ \xs -> all (>=0) xs ==> sum (take 1 xs :: [Int]) <= sum xs
-- > +++ OK, passed 200 tests.
--
-- > > check $ \(Xs xs) -> all (>=0) xs ==> sum (take 1 xs :: [Int]) <= sum xs
-- > *** Failed! Falsifiable (after 56 tests):
-- > [1,9223372036854775807]
newtype Xs a  =  Xs [a]  deriving (Xs a -> Xs a -> Bool
forall a. Eq a => Xs a -> Xs a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Xs a -> Xs a -> Bool
$c/= :: forall a. Eq a => Xs a -> Xs a -> Bool
== :: Xs a -> Xs a -> Bool
$c== :: forall a. Eq a => Xs a -> Xs a -> Bool
Eq, Xs a -> Xs a -> Bool
Xs a -> Xs a -> Ordering
Xs a -> Xs a -> Xs a
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall {a}. Ord a => Eq (Xs a)
forall a. Ord a => Xs a -> Xs a -> Bool
forall a. Ord a => Xs a -> Xs a -> Ordering
forall a. Ord a => Xs a -> Xs a -> Xs a
min :: Xs a -> Xs a -> Xs a
$cmin :: forall a. Ord a => Xs a -> Xs a -> Xs a
max :: Xs a -> Xs a -> Xs a
$cmax :: forall a. Ord a => Xs a -> Xs a -> Xs a
>= :: Xs a -> Xs a -> Bool
$c>= :: forall a. Ord a => Xs a -> Xs a -> Bool
> :: Xs a -> Xs a -> Bool
$c> :: forall a. Ord a => Xs a -> Xs a -> Bool
<= :: Xs a -> Xs a -> Bool
$c<= :: forall a. Ord a => Xs a -> Xs a -> Bool
< :: Xs a -> Xs a -> Bool
$c< :: forall a. Ord a => Xs a -> Xs a -> Bool
compare :: Xs a -> Xs a -> Ordering
$ccompare :: forall a. Ord a => Xs a -> Xs a -> Ordering
Ord, Int -> Xs a -> ShowS
forall a. Show a => Int -> Xs a -> ShowS
forall a. Show a => [Xs a] -> ShowS
forall a. Show a => Xs a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Xs a] -> ShowS
$cshowList :: forall a. Show a => [Xs a] -> ShowS
show :: Xs a -> String
$cshow :: forall a. Show a => Xs a -> String
showsPrec :: Int -> Xs a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> Xs a -> ShowS
Show, ReadPrec [Xs a]
ReadPrec (Xs a)
ReadS [Xs a]
forall a. Read a => ReadPrec [Xs a]
forall a. Read a => ReadPrec (Xs a)
forall a. Read a => Int -> ReadS (Xs a)
forall a. Read a => ReadS [Xs a]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Xs a]
$creadListPrec :: forall a. Read a => ReadPrec [Xs a]
readPrec :: ReadPrec (Xs a)
$creadPrec :: forall a. Read a => ReadPrec (Xs a)
readList :: ReadS [Xs a]
$creadList :: forall a. Read a => ReadS [Xs a]
readsPrec :: Int -> ReadS (Xs a)
$creadsPrec :: forall a. Read a => Int -> ReadS (Xs a)
Read)
instance (Integral a, Bounded a) => Listable (Xs a) where
  tiers :: [[Xs a]]
tiers  =  forall a b. Listable a => (a -> b) -> [[b]]
cons1 (forall a. [a] -> Xs a
Xs forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a -> b) -> [a] -> [b]
map forall a. X a -> a
unX)
-- ^ Lists with elements of the 'X' type.

-- | Space characters.
--
-- > list :: [Space]  =  " \t\n\r\f\v"
--
-- > > check $ \(Space c) -> isSpace c
-- > +++ OK, passed 6 tests (exhausted).
data Space  =  Space {Space -> Char
unSpace :: Char}

-- | Lowercase characters.
--
-- > list :: [Lower]  =  "abcdef..."
--
-- > > check $ \(Lower c) -> isLower c
-- > +++ OK, passed 26 tests (exhausted).
data Lower  =  Lower {Lower -> Char
unLower :: Char}

-- | Uppercase characters.
--
-- > list :: [Upper]  =  "ABCDEF..."
--
-- > > check $ \(Upper c) -> isUpper c
-- > +++ OK, passed 26 tests (exhausted).
data Upper  =  Upper {Upper -> Char
unUpper :: Char}

-- | Alphabetic characters.
--
-- > list :: [Alpha]  =  "aAbBcC..."
--
-- > > check $ \(Alpha c) -> isAlpha c
-- > +++ OK, passed 52 tests (exhausted).
--
-- Equivalent to 'Letter'.
data Alpha  =  Alpha {Alpha -> Char
unAlpha :: Char}

-- | Digits.
--
-- > list :: [Digit]  =  "0123456789"
--
-- > > check $ \(Digit c) -> isDigit c
-- > +++ OK, passed 10 tests (exhausted).
data Digit  =  Digit {Digit -> Char
unDigit :: Char}

-- | Alphanumeric characters.
--
-- > list :: [AlphaNum]  =  "0a1A2b3B4c..."
--
-- > > check $ \(AlphaNum c) -> isAlphaNum c
-- > +++ OK, passed 62 tests (exhausted).
data AlphaNum  =  AlphaNum {AlphaNum -> Char
unAlphaNum :: Char}

-- | Alphabetic characters.
--
-- > list :: [Letter]  =  "aAbBcC..."
--
-- > > check $ \(Letter c) -> isLetter c
-- > +++ OK, passed 52 tests (exhausted).
--
-- Equivalent to 'Alpha'.
data Letter    =  Letter   {Letter -> Char
unLetter   :: Char}

instance Show Space where  show :: Space -> String
show  =  forall a. Show a => a -> String
show forall b c a. (b -> c) -> (a -> b) -> a -> c
. Space -> Char
unSpace
instance Show Lower where  show :: Lower -> String
show  =  forall a. Show a => a -> String
show forall b c a. (b -> c) -> (a -> b) -> a -> c
. Lower -> Char
unLower
instance Show Upper where  show :: Upper -> String
show  =  forall a. Show a => a -> String
show forall b c a. (b -> c) -> (a -> b) -> a -> c
. Upper -> Char
unUpper
instance Show Alpha where  show :: Alpha -> String
show  =  forall a. Show a => a -> String
show forall b c a. (b -> c) -> (a -> b) -> a -> c
. Alpha -> Char
unAlpha
instance Show Digit where  show :: Digit -> String
show  =  forall a. Show a => a -> String
show forall b c a. (b -> c) -> (a -> b) -> a -> c
. Digit -> Char
unDigit
instance Show AlphaNum where  show :: AlphaNum -> String
show  =  forall a. Show a => a -> String
show forall b c a. (b -> c) -> (a -> b) -> a -> c
. AlphaNum -> Char
unAlphaNum
instance Show Letter   where  show :: Letter -> String
show  =  forall a. Show a => a -> String
show forall b c a. (b -> c) -> (a -> b) -> a -> c
. Letter -> Char
unLetter

instance Listable Space where
  list :: [Space]
list  =  forall a b. (a -> b) -> [a] -> [b]
map Char -> Space
Space [Char
' ', Char
'\t', Char
'\n', Char
'\r', Char
'\f', Char
'\v']

instance Listable Lower where
  list :: [Lower]
list  =  forall a b. (a -> b) -> [a] -> [b]
map Char -> Lower
Lower [Char
'a'..Char
'z']

instance Listable Upper where
  list :: [Upper]
list  =  forall a b. (a -> b) -> [a] -> [b]
map Char -> Upper
Upper [Char
'A'..Char
'Z']

instance Listable Alpha where
  list :: [Alpha]
list  =  forall a b. (a -> b) -> [a] -> [b]
map Char -> Alpha
Alpha forall a b. (a -> b) -> a -> b
$ [Char
'a'..Char
'z'] forall a. [a] -> [a] -> [a]
+| [Char
'A'..Char
'Z']

instance Listable Digit where
  list :: [Digit]
list  =  forall a b. (a -> b) -> [a] -> [b]
map Char -> Digit
Digit [Char
'0'..Char
'9']

instance Listable AlphaNum where
  list :: [AlphaNum]
list  =  forall a b. (a -> b) -> [a] -> [b]
map Char -> AlphaNum
AlphaNum forall a b. (a -> b) -> a -> b
$ [Char
'0'..Char
'9'] forall a. [a] -> [a] -> [a]
+| [Char
'a'..Char
'z'] forall a. [a] -> [a] -> [a]
+| [Char
'A'..Char
'Z']

instance Listable Letter where
  list :: [Letter]
list  =  forall a b. (a -> b) -> [a] -> [b]
map Char -> Letter
Letter forall a b. (a -> b) -> a -> b
$ [Char
'a'..Char
'z'] forall a. [a] -> [a] -> [a]
+| [Char
'A'..Char
'Z']

-- | Strings of spaces.
data Spaces  =  Spaces {Spaces -> String
unSpaces :: String}

-- | Strings of lowercase characters.
data Lowers  =  Lowers {Lowers -> String
unLowers :: String}

-- | Strings of uppercase characters
data Uppers  =  Uppers {Uppers -> String
unUppers :: String}

-- | Strings of alphabetic characters
data Alphas  =  Alphas {Alphas -> String
unAlphas :: String}

-- | Strings of digits.
data Digits  =  Digits {Digits -> String
unDigits :: String}

-- | Strings of alphanumeric characters
data AlphaNums  =  AlphaNums {AlphaNums -> String
unAlphaNums :: String}

-- | Strings of letters
data Letters    =  Letters   {Letters -> String
unLetters   :: String}

instance Show Spaces where  show :: Spaces -> String
show  =  forall a. Show a => a -> String
show forall b c a. (b -> c) -> (a -> b) -> a -> c
. Spaces -> String
unSpaces
instance Show Lowers where  show :: Lowers -> String
show  =  forall a. Show a => a -> String
show forall b c a. (b -> c) -> (a -> b) -> a -> c
. Lowers -> String
unLowers
instance Show Uppers where  show :: Uppers -> String
show  =  forall a. Show a => a -> String
show forall b c a. (b -> c) -> (a -> b) -> a -> c
. Uppers -> String
unUppers
instance Show Alphas where  show :: Alphas -> String
show  =  forall a. Show a => a -> String
show forall b c a. (b -> c) -> (a -> b) -> a -> c
. Alphas -> String
unAlphas
instance Show Digits where  show :: Digits -> String
show  =  forall a. Show a => a -> String
show forall b c a. (b -> c) -> (a -> b) -> a -> c
. Digits -> String
unDigits
instance Show AlphaNums where  show :: AlphaNums -> String
show  =  forall a. Show a => a -> String
show forall b c a. (b -> c) -> (a -> b) -> a -> c
. AlphaNums -> String
unAlphaNums
instance Show Letters   where  show :: Letters -> String
show  =  forall a. Show a => a -> String
show forall b c a. (b -> c) -> (a -> b) -> a -> c
. Letters -> String
unLetters

instance Listable Spaces where  tiers :: [[Spaces]]
tiers  =  forall a b. Listable a => (a -> b) -> [[b]]
cons1 (String -> Spaces
Spaces forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a -> b) -> [a] -> [b]
map Space -> Char
unSpace)
instance Listable Lowers where  tiers :: [[Lowers]]
tiers  =  forall a b. Listable a => (a -> b) -> [[b]]
cons1 (String -> Lowers
Lowers forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a -> b) -> [a] -> [b]
map Lower -> Char
unLower)
instance Listable Uppers where  tiers :: [[Uppers]]
tiers  =  forall a b. Listable a => (a -> b) -> [[b]]
cons1 (String -> Uppers
Uppers forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a -> b) -> [a] -> [b]
map Upper -> Char
unUpper)
instance Listable Alphas where  tiers :: [[Alphas]]
tiers  =  forall a b. Listable a => (a -> b) -> [[b]]
cons1 (String -> Alphas
Alphas forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a -> b) -> [a] -> [b]
map Alpha -> Char
unAlpha)
instance Listable Digits where  tiers :: [[Digits]]
tiers  =  forall a b. Listable a => (a -> b) -> [[b]]
cons1 (String -> Digits
Digits forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a -> b) -> [a] -> [b]
map Digit -> Char
unDigit)
instance Listable AlphaNums where  tiers :: [[AlphaNums]]
tiers  =  forall a b. Listable a => (a -> b) -> [[b]]
cons1 (String -> AlphaNums
AlphaNums forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a -> b) -> [a] -> [b]
map AlphaNum -> Char
unAlphaNum)
instance Listable Letters   where  tiers :: [[Letters]]
tiers  =  forall a b. Listable a => (a -> b) -> [[b]]
cons1 (String -> Letters
Letters   forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a -> b) -> [a] -> [b]
map Letter -> Char
unLetter)

#if __GLASGOW_HASKELL__ == 708
-- there's no need to derive these on GHC >= 7.10
-- as they are automatically derived
deriving instance Typeable Int1
deriving instance Typeable Int2
deriving instance Typeable Int3
deriving instance Typeable Int4
deriving instance Typeable Word1
deriving instance Typeable Word2
deriving instance Typeable Word3
deriving instance Typeable Word4
deriving instance Typeable Nat
deriving instance Typeable Nat1
deriving instance Typeable Nat2
deriving instance Typeable Nat3
deriving instance Typeable Nat4
deriving instance Typeable Nat5
deriving instance Typeable Nat6
deriving instance Typeable Nat7
deriving instance Typeable Natural
deriving instance Typeable X
deriving instance Typeable Xs
deriving instance Typeable NoDup
deriving instance Typeable Bag
deriving instance Typeable Set
deriving instance Typeable Map
deriving instance Typeable Space
deriving instance Typeable Lower
deriving instance Typeable Upper
deriving instance Typeable Alpha
deriving instance Typeable Digit
deriving instance Typeable AlphaNum
deriving instance Typeable Letter
deriving instance Typeable Spaces
deriving instance Typeable Lowers
deriving instance Typeable Uppers
deriving instance Typeable Alphas
deriving instance Typeable Digits
deriving instance Typeable AlphaNums
deriving instance Typeable Letters
deriving instance Typeable A
deriving instance Typeable B
deriving instance Typeable C
deriving instance Typeable D
deriving instance Typeable E
deriving instance Typeable F
#endif