{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveFoldable #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}

#if __GLASGOW_HASKELL__ >= 702
{-# LANGUAGE Trustworthy #-}
#endif

#if __GLASGOW_HASKELL__ >= 706
{-# LANGUAGE PolyKinds #-}
#endif

#if __GLASGOW_HASKELL__ >= 708 && __GLASGOW_HASKELL__ < 710
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE NullaryTypeClasses #-}
#endif

#if __GLASGOW_HASKELL__ >= 800
{-# LANGUAGE TypeInType #-}
#endif

{-# OPTIONS_GHC -fno-warn-deprecations #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
{-|
Exports orphan instances that mimic instances available in later versions of @base@.
To use them, simply @import Data.Orphans ()@.
-}
module Data.Orphans () where

#if __GLASGOW_HASKELL__ >= 701 && !(MIN_VERSION_base(4,12,0))
import           GHC.Generics as Generics
#endif

#if !(MIN_VERSION_base(4,6,0))
import           Control.Monad.Instances ()
#endif

#if !(MIN_VERSION_base(4,9,0))
import qualified Data.Monoid as Monoid
import           Text.ParserCombinators.ReadPrec as ReadPrec
import           Text.Read as Read
#endif

#if MIN_VERSION_base(4,9,0) && !(MIN_VERSION_base(4,11,0))
import qualified Control.Monad.Fail as Fail (MonadFail(..))
#endif

#if !(MIN_VERSION_base(4,10,0))
import           Data.Data as Data
#endif

#if !(MIN_VERSION_base(4,11,0))
import           Control.Monad.ST as Strict
#endif

#if !(MIN_VERSION_base(4,12,0))
import qualified Data.Foldable as F (Foldable(..))
import qualified Data.Traversable as T (Traversable(..))
#endif

#if __GLASGOW_HASKELL__ < 710
import           Control.Exception as Exception
import           Control.Monad.ST.Lazy as Lazy
import           GHC.Exts as Exts
import           GHC.IO.Exception as Exception
import           Text.ParserCombinators.ReadP as ReadP

# if defined(mingw32_HOST_OS)
import           GHC.ConsoleHandler as Console
# endif
#endif

#if !(MIN_VERSION_base(4,15,0))
import           Data.Orphans.Prelude
#endif

#include "HsBaseConfig.h"

-------------------------------------------------------------------------------

#if MIN_VERSION_base(4,4,0) && !(MIN_VERSION_base(4,7,0))
instance Show Fingerprint where
    show (Fingerprint w1 w2) = hex16 w1 ++ hex16 w2
      where
        -- Formats a 64 bit number as 16 digits hex.
        hex16 :: Word64 -> String
        hex16 i = let hex = showHex i ""
                   in replicate (16 - length hex) '0' ++ hex
#endif

#if !(MIN_VERSION_base(4,4,0))
instance HasResolution a => Read (Fixed a) where
    readsPrec _ = readsFixed

readsFixed :: (HasResolution a) => ReadS (Fixed a)
readsFixed = readsSigned
    where readsSigned ('-' : xs) = [ (negate x, rest)
                                   | (x, rest) <- readsUnsigned xs ]
          readsSigned xs = readsUnsigned xs
          readsUnsigned xs = case span isDigit xs of
                             ([], _) -> []
                             (is, xs') ->
                                 let i = fromInteger (read is)
                                 in case xs' of
                                    '.' : xs'' ->
                                        case span isDigit xs'' of
                                        ([], _) -> []
                                        (js, xs''') ->
                                            let j = fromInteger (read js)
                                                l = genericLength js :: Integer
                                            in [(i + (j / (10 ^ l)), xs''')]
                                    _ -> [(i, xs')]

deriving instance Typeable1 SampleVar

instance Applicative (Strict.ST s) where
    pure  = return
    (<*>) = ap

instance Applicative (Lazy.ST s) where
    pure  = return
    (<*>) = ap

instance Ord TyCon where
  compare x y = compare (tyConString x) (tyConString y)

-- http://hackage.haskell.org/package/base-4.3.0.0/docs/Data-Typeable.html#t:TypeRep
-- Notice that the `TypeRep` constructor is not exported
-- and no pure accessor to its `Key` field is provided.
instance Ord TypeRep where
  compare x y =
    compare (typeRepTyCon x) (typeRepTyCon x) `mappend`
    compare (typeRepArgs x) (typeRepArgs y)
#endif

-- These instances are only valid if Bits isn't a subclass of Num (as Bool is
-- not a Num instance), which is only true as of base-4.6.0.0 and later.
#if MIN_VERSION_base(4,6,0) && !(MIN_VERSION_base(4,7,0))
instance Bits Bool where
    (.&.) = (&&)

    (.|.) = (||)

    xor = (/=)

    complement = not

    shift x 0 = x
    shift _ _ = False

    rotate x _ = x

    bit 0 = True
    bit _ = False

    testBit x 0 = x
    testBit _ _ = False

    bitSize _ = 1

    isSigned _ = False

    popCount False = 0
    popCount True  = 1
#endif

#if !(MIN_VERSION_base(4,6,0))
# if defined(HTYPE_DEV_T)
#  if MIN_VERSION_base(4,5,0)
deriving instance Bits CDev
deriving instance Bounded CDev
deriving instance Integral CDev
#  else
type HDev = HTYPE_DEV_T

instance Bits CDev where
    (.&.)         = unsafeCoerce ((.&.)         :: HDev -> HDev -> HDev)
    (.|.)         = unsafeCoerce ((.|.)         :: HDev -> HDev -> HDev)
    xor           = unsafeCoerce (xor           :: HDev -> HDev -> HDev)
    shift         = unsafeCoerce (shift         :: HDev -> Int  -> HDev)
    rotate        = unsafeCoerce (rotate        :: HDev -> Int  -> HDev)
    setBit        = unsafeCoerce (setBit        :: HDev -> Int  -> HDev)
    clearBit      = unsafeCoerce (clearBit      :: HDev -> Int  -> HDev)
    complementBit = unsafeCoerce (complementBit :: HDev -> Int  -> HDev)
    testBit       = unsafeCoerce (testBit       :: HDev -> Int  -> Bool)
    complement    = unsafeCoerce (complement    :: HDev -> HDev)
    bit           = unsafeCoerce (bit           :: Int  -> HDev)
    bitSize       = unsafeCoerce (bitSize       :: HDev -> Int)
    isSigned      = unsafeCoerce (isSigned      :: HDev -> Bool)

instance Bounded CDev where
    minBound = unsafeCoerce (minBound :: HDev)
    maxBound = unsafeCoerce (maxBound :: HDev)

instance Integral CDev where
    quot      = unsafeCoerce (quot      :: HDev -> HDev -> HDev)
    rem       = unsafeCoerce (rem       :: HDev -> HDev -> HDev)
    div       = unsafeCoerce (div       :: HDev -> HDev -> HDev)
    mod       = unsafeCoerce (mod       :: HDev -> HDev -> HDev)
    quotRem   = unsafeCoerce (quotRem   :: HDev -> HDev -> (HDev, HDev))
    divMod    = unsafeCoerce (divMod    :: HDev -> HDev -> (HDev, HDev))
    toInteger = unsafeCoerce (toInteger :: HDev -> Integer)
#  endif
# endif

instance Applicative ReadP where
    pure  = return
    (<*>) = ap

instance Alternative ReadP where
    empty = mzero
    (<|>) = mplus

instance Applicative ReadPrec where
    pure  = return
    (<*>) = ap

instance Alternative ReadPrec where
    empty = mzero
    (<|>) = mplus

instance Functor Exception.Handler where
     fmap f (Exception.Handler h) = Exception.Handler (fmap f . h)

instance
# if MIN_VERSION_base(4,4,0)
  Arrow a
# else
  ArrowApply a
# endif
  => Functor (ArrowMonad a) where
    fmap f (ArrowMonad m) = ArrowMonad $ m >>> arr f

instance
# if MIN_VERSION_base(4,4,0)
  Arrow a
# else
  ArrowApply a
# endif
  => Applicative (ArrowMonad a) where
   pure x = ArrowMonad (arr (const x))
   ArrowMonad f <*> ArrowMonad x = ArrowMonad (f &&& x >>> arr (uncurry id))

instance
# if MIN_VERSION_base(4,4,0)
  ArrowPlus a
# else
  (ArrowApply a, ArrowPlus a)
# endif
  => Alternative (ArrowMonad a) where
   empty = ArrowMonad zeroArrow
   ArrowMonad x <|> ArrowMonad y = ArrowMonad (x <+> y)

instance (ArrowApply a, ArrowPlus a) => MonadPlus (ArrowMonad a) where
   mzero = ArrowMonad zeroArrow
   ArrowMonad x `mplus` ArrowMonad y = ArrowMonad (x <+> y)
#endif

#if !(MIN_VERSION_base(4,7,0))
deriving instance F.Foldable (Const m)
deriving instance F.Foldable (Either a)
deriving instance T.Traversable (Const m)
deriving instance T.Traversable (Either a)

instance F.Foldable ((,) a) where
    foldMap f (_, y) = f y

    foldr f z (_, y) = f y z

instance T.Traversable ((,) a) where
    traverse f (x, y) = (,) x <$> f y

deriving instance Monoid a => Monoid (Const a b)
deriving instance Read a => Read (Down a)
deriving instance Show a => Show (Down a)
deriving instance Eq ErrorCall
deriving instance Ord ErrorCall
deriving instance Num a => Num (Sum a)
deriving instance Num a => Num (Product a)
deriving instance Data Version
-- GHC Trac #8218
deriving instance Monad m => Monad (WrappedMonad m)
deriving instance Eq a => Eq (ZipList a)
deriving instance Ord a => Ord (ZipList a)
deriving instance Read a => Read (ZipList a)
deriving instance Show a => Show (ZipList a)
deriving instance Functor ArgOrder
deriving instance Functor OptDescr
deriving instance Functor ArgDescr
#endif

#if __GLASGOW_HASKELL__ >= 701 && !(MIN_VERSION_base(4,7,0))
deriving instance Eq (U1 p)
deriving instance Ord (U1 p)
deriving instance Read (U1 p)
deriving instance Show (U1 p)

deriving instance Eq p => Eq (Par1 p)
deriving instance Ord p => Ord (Par1 p)
deriving instance Read p => Read (Par1 p)
deriving instance Show p => Show (Par1 p)

deriving instance Eq (f p) => Eq (Rec1 f p)
deriving instance Ord (f p) => Ord (Rec1 f p)
deriving instance Read (f p) => Read (Rec1 f p)
deriving instance Show (f p) => Show (Rec1 f p)

deriving instance Eq c => Eq (K1 i c p)
deriving instance Ord c => Ord (K1 i c p)
deriving instance Read c => Read (K1 i c p)
deriving instance Show c => Show (K1 i c p)

deriving instance Eq (f p) => Eq (M1 i c f p)
deriving instance Ord (f p) => Ord (M1 i c f p)
deriving instance Read (f p) => Read (M1 i c f p)
deriving instance Show (f p) => Show (M1 i c f p)

deriving instance (Eq (f p), Eq (g p)) => Eq ((f :+: g) p)
deriving instance (Ord (f p), Ord (g p)) => Ord ((f :+: g) p)
deriving instance (Read (f p), Read (g p)) => Read ((f :+: g) p)
deriving instance (Show (f p), Show (g p)) => Show ((f :+: g) p)

deriving instance (Eq (f p), Eq (g p)) => Eq ((f :*: g) p)
deriving instance (Ord (f p), Ord (g p)) => Ord ((f :*: g) p)
-- Due to a GHC bug (https://ghc.haskell.org/trac/ghc/ticket/9830), the derived
-- Read and Show instances for infix data constructors will use the wrong
-- precedence (prior to GHC 7.10).
-- We'll manually derive Read :*: and Show :*: instances to avoid this.
instance (Read (f p), Read (g p)) => Read ((f :*: g) p) where
    readPrec = parens . ReadPrec.prec 6 $ do
        fp <- ReadPrec.step readPrec
        Symbol ":*:" <- lexP
        gp <- ReadPrec.step readPrec
        return $ fp :*: gp
    readListPrec = readListPrecDefault
instance (Show (f p), Show (g p)) => Show ((f :*: g) p) where
     showsPrec p (l :*: r) = showParen (p > sixPrec) $
            showsPrec (sixPrec + 1) l
         . showString " :*: "
         . showsPrec (sixPrec + 1) r
       where sixPrec = 6

deriving instance Eq (f (g p)) => Eq ((f :.: g) p)
deriving instance Ord (f (g p)) => Ord ((f :.: g) p)
deriving instance Read (f (g p)) => Read ((f :.: g) p)
deriving instance Show (f (g p)) => Show ((f :.: g) p)
#endif

#if MIN_VERSION_base(4,7,0) && !(MIN_VERSION_base(4,8,0))
-- | Construct tag-less 'Version'
--
-- /Since: 4.8.0.0/
makeVersion :: [Int] -> Version
makeVersion b = Version b []

-- | /Since: 4.8.0.0/
instance IsList Version where
  type (Item Version) = Int
  fromList = makeVersion
  toList = versionBranch
#endif

#if !(MIN_VERSION_base(4,8,0))
deriving instance Eq a => Eq (Const a b)
deriving instance Ord a => Ord (Const a b)

instance Read a => Read (Const a b) where
    readsPrec d = readParen (d > 10)
        $ \r -> [(Const x,t) | ("Const", s) <- lex r, (x, t) <- readsPrec 11 s]

instance Show a => Show (Const a b) where
    showsPrec d (Const x) = showParen (d > 10) $
                            showString "Const " . showsPrec 11 x

deriving instance Functor First
deriving instance Applicative First
deriving instance Monad First
deriving instance Functor Last
deriving instance Applicative Last
deriving instance Monad Last

-- In base-4.3 and earlier, pattern matching on a Complex value invokes a
-- RealFloat constraint due to the use of the DatatypeContexts extension.
# if MIN_VERSION_base(4,4,0)
instance Storable a
# else
instance (Storable a, RealFloat a)
# endif
  => Storable (Complex a) where
    sizeOf a       = 2 * sizeOf (realPart a)
    alignment a    = alignment (realPart a)
    peek p           = do
                        q <- return $ castPtr p
                        r <- peek q
                        i <- peekElemOff q 1
                        return (r :+ i)
    poke p (r :+ i)  = do
                        q <-return $  (castPtr p)
                        poke q r
                        pokeElemOff q 1 i

instance (Storable a, Integral a) => Storable (Ratio a) where
    sizeOf _    = 2 * sizeOf (undefined :: a)
    alignment _ = alignment (undefined :: a )
    peek p           = do
                        q <- return $ castPtr p
                        r <- peek q
                        i <- peekElemOff q 1
                        return (r % i)
    poke p (r :% i)  = do
                        q <-return $  (castPtr p)
                        poke q r
                        pokeElemOff q 1 i
#endif

#if !(MIN_VERSION_base(4,9,0))
instance Storable () where
  sizeOf _ = 0
  alignment _ = 1
  peek _ = return ()
  poke _ _ = return ()

deriving instance Bits a       => Bits (Const a b)
deriving instance Bounded a    => Bounded (Const a b)
deriving instance Enum a       => Enum (Const a b)
deriving instance Floating a   => Floating (Const a b)
deriving instance Fractional a => Fractional (Const a b)
deriving instance Integral a   => Integral (Const a b)
deriving instance IsString a   => IsString (Const a b)
deriving instance Ix a         => Ix (Const a b)
deriving instance Num a        => Num (Const a b)
deriving instance Real a       => Real (Const a b)
deriving instance RealFloat a  => RealFloat (Const a b)
deriving instance RealFrac a   => RealFrac (Const a b)
deriving instance Storable a   => Storable (Const a b)

deriving instance           Data All
deriving instance           Data Monoid.Any
deriving instance Data a => Data (Dual a)
deriving instance Data a => Data (First a)
deriving instance Data a => Data (Last a)
deriving instance Data a => Data (Product a)
deriving instance Data a => Data (Sum a)

instance F.Foldable Dual where
    foldMap            = coerce

    foldl              = coerce
    foldl1 _           = getDual
    foldr f z (Dual x) = f x z
    foldr1 _           = getDual
# if MIN_VERSION_base(4,6,0)
    foldl'             = coerce
    foldr'             = F.foldr
# endif
# if MIN_VERSION_base(4,8,0)
    elem               = (. getDual) #. (==)
    length _           = 1
    maximum            = getDual
    minimum            = getDual
    null _             = False
    product            = getDual
    sum                = getDual
    toList (Dual x)    = [x]
# endif

instance F.Foldable Sum where
    foldMap            = coerce

    foldl              = coerce
    foldl1 _           = getSum
    foldr f z (Sum x)  = f x z
    foldr1 _           = getSum
# if MIN_VERSION_base(4,6,0)
    foldl'                = coerce
    foldr'                = F.foldr
# endif
# if MIN_VERSION_base(4,8,0)
    elem               = (. getSum) #. (==)
    length _           = 1
    maximum            = getSum
    minimum            = getSum
    null _             = False
    product            = getSum
    sum                = getSum
    toList (Sum x)     = [x]
# endif

instance F.Foldable Product where
    foldMap               = coerce

    foldl                 = coerce
    foldl1 _              = getProduct
    foldr f z (Product x) = f x z
    foldr1 _              = getProduct
# if MIN_VERSION_base(4,6,0)
    foldl'                = coerce
    foldr'                = F.foldr
# endif
# if MIN_VERSION_base(4,8,0)
    elem                  = (. getProduct) #. (==)
    length _              = 1
    maximum               = getProduct
    minimum               = getProduct
    null _                = False
    product               = getProduct
    sum                   = getProduct
    toList (Product x)    = [x]
# endif

# if MIN_VERSION_base(4,8,0)
(#.)   :: Coercible b c => (b -> c) -> (a -> b) -> (a -> c)
(#.) _f = coerce
# endif

# if !(MIN_VERSION_base(4,7,0))
coerce ::                  a -> b
coerce = unsafeCoerce
# endif

instance Functor Dual where
    fmap     = coerce

instance Applicative Dual where
    pure     = Dual
    (<*>)    = coerce

instance Monad Dual where
    return   = Dual
    m >>= k  = k (getDual m)

instance Functor Sum where
    fmap     = coerce

instance Applicative Sum where
    pure     = Sum
    (<*>)    = coerce

instance Monad Sum where
    return   = Sum
    m >>= k  = k (getSum m)

instance Functor Product where
    fmap     = coerce

instance Applicative Product where
    pure     = Product
    (<*>)    = coerce

instance Monad Product where
    return   = Product
    m >>= k  = k (getProduct m)

instance F.Foldable First where
    foldMap f = F.foldMap f . getFirst

instance F.Foldable Last where
    foldMap f = F.foldMap f . getLast

instance Monoid a => Monoid (IO a) where
    mempty = pure mempty
    mappend = liftA2 mappend

-- see: #10190 https://git.haskell.org/ghc.git/commitdiff/9db005a444722e31aca1956b058e069bcf3cacbd
instance Monoid a => Monad ((,) a) where
    return x = (mempty, x)
    (u, a) >>= k = case k a of (v, b) -> (u `mappend` v, b)

instance MonadFix Dual where
    mfix f   = Dual (fix (getDual . f))

instance MonadFix Sum where
    mfix f   = Sum (fix (getSum . f))

instance MonadFix Product where
    mfix f   = Product (fix (getProduct . f))

instance MonadFix First where
    mfix f   = First (mfix (getFirst . f))

instance MonadFix Last where
    mfix f   = Last (mfix (getLast . f))

instance T.Traversable Dual where
    traverse f (Dual x) = Dual <$> f x

instance T.Traversable Sum where
    traverse f (Sum x) = Sum <$> f x

instance T.Traversable Product where
    traverse f (Product x) = Product <$> f x

instance T.Traversable First where
    traverse f (First x) = First <$> T.traverse f x

instance T.Traversable Last where
    traverse f (Last x) = Last <$> T.traverse f x

deriving instance F.Foldable    ZipList
deriving instance T.Traversable ZipList

# if MIN_VERSION_base(4,4,0)
deriving instance Functor     Complex
deriving instance F.Foldable    Complex
deriving instance T.Traversable Complex

instance Applicative Complex where
  pure a = a :+ a
  f :+ g <*> a :+ b = f a :+ g b

instance Monad Complex where
  return a = a :+ a
  a :+ b >>= f = realPart (f a) :+ imagPart (f b)

instance MonadZip Dual where
    -- Cannot use coerce, it's unsafe
    mzipWith = liftM2

instance MonadZip Sum where
    mzipWith = liftM2

instance MonadZip Product where
    mzipWith = liftM2

instance MonadZip Maybe where
    mzipWith = liftM2

instance MonadZip First where
    mzipWith = liftM2

instance MonadZip Last where
    mzipWith = liftM2
# endif

# if MIN_VERSION_base(4,7,0)
instance Alternative Proxy where
    empty = Proxy
    {-# INLINE empty #-}
    _ <|> _ = Proxy
    {-# INLINE (<|>) #-}

instance MonadPlus Proxy where
#  if !(MIN_VERSION_base(4,8,0))
    mzero = Proxy
    {-# INLINE mzero #-}
    mplus _ _ = Proxy
    {-# INLINE mplus #-}
#  endif

instance MonadZip Proxy where
    mzipWith _ _ _ = Proxy
    {-# INLINE mzipWith #-}

deriving instance FiniteBits a => FiniteBits (Const a b)
# endif

# if MIN_VERSION_base(4,8,0)
deriving instance (Data (f a), Typeable f, Typeable a)
    => Data (Alt (f :: * -> *) (a :: *))

instance MonadFix f => MonadFix (Alt f) where
    mfix f   = Alt (mfix (getAlt . f))

instance MonadZip f => MonadZip (Alt f) where
    mzipWith f (Alt ma) (Alt mb) = Alt (mzipWith f ma mb)

deriving instance Bits a       => Bits (Identity a)
deriving instance Bounded a    => Bounded (Identity a)
deriving instance Enum a       => Enum (Identity a)
deriving instance FiniteBits a => FiniteBits (Identity a)
deriving instance Floating a   => Floating (Identity a)
deriving instance Fractional a => Fractional (Identity a)
deriving instance Integral a   => Integral (Identity a)
deriving instance IsString a   => IsString (Identity a)
deriving instance Ix a         => Ix (Identity a)
deriving instance Monoid a     => Monoid (Identity a)
deriving instance Num a        => Num (Identity a)
deriving instance Real a       => Real (Identity a)
deriving instance RealFloat a  => RealFloat (Identity a)
deriving instance RealFrac a   => RealFrac (Identity a)
deriving instance Storable a   => Storable (Identity a)
# endif

# if __GLASGOW_HASKELL__ >= 701
deriving instance Data p => Data (V1 p)
deriving instance Data p => Data (U1 p)
deriving instance Data p => Data (Par1 p)
deriving instance (Typeable i, Data p, Data c) => Data (K1 i c p)
deriving instance Data Generics.Fixity
deriving instance Data Associativity

deriving instance                                 F.Foldable V1
deriving instance                                 F.Foldable Par1
deriving instance F.Foldable f                 => F.Foldable (Rec1 f)
deriving instance                                 F.Foldable (K1 i c)
deriving instance F.Foldable f                 => F.Foldable (M1 i c f)
deriving instance (F.Foldable f, F.Foldable g) => F.Foldable (f :+: g)
deriving instance (F.Foldable f, F.Foldable g) => F.Foldable (f :*: g)
deriving instance (F.Foldable f, F.Foldable g) => F.Foldable (f :.: g)

deriving instance                           Functor V1
deriving instance                           Functor Par1
deriving instance Functor f              => Functor (Rec1 f)
deriving instance                           Functor (K1 i c)
deriving instance Functor f              => Functor (M1 i c f)
deriving instance (Functor f, Functor g) => Functor (f :+: g)
deriving instance (Functor f, Functor g) => Functor (f :*: g)
deriving instance (Functor f, Functor g) => Functor (f :.: g)

instance MonadFix Par1 where
    mfix f = Par1 (fix (unPar1 . f))

instance MonadFix f => MonadFix (Rec1 f) where
    mfix f = Rec1 (mfix (unRec1 . f))

instance MonadFix f => MonadFix (M1 i c f) where
    mfix f = M1 (mfix (unM1. f))

instance (MonadFix f, MonadFix g) => MonadFix (f :*: g) where
    mfix f = (mfix (fstP . f)) :*: (mfix (sndP . f))
      where
        fstP (a :*: _) = a
        sndP (_ :*: b) = b

instance MonadZip U1 where
    mzipWith _ _ _ = U1

instance MonadZip Par1 where
    mzipWith = liftM2

instance MonadZip f => MonadZip (Rec1 f) where
    mzipWith f (Rec1 fa) (Rec1 fb) = Rec1 (mzipWith f fa fb)

instance MonadZip f => MonadZip (M1 i c f) where
    mzipWith f (M1 fa) (M1 fb) = M1 (mzipWith f fa fb)

instance (MonadZip f, MonadZip g) => MonadZip (f :*: g) where
    mzipWith f (x1 :*: y1) (x2 :*: y2) = mzipWith f x1 x2 :*: mzipWith f y1 y2

deriving instance                                       T.Traversable V1
deriving instance                                       T.Traversable Par1
deriving instance T.Traversable f                    => T.Traversable (Rec1 f)
deriving instance                                       T.Traversable (K1 i c)
deriving instance T.Traversable f                    => T.Traversable (M1 i c f)
deriving instance (T.Traversable f, T.Traversable g) => T.Traversable (f :+: g)
deriving instance (T.Traversable f, T.Traversable g) => T.Traversable (f :*: g)
deriving instance (T.Traversable f, T.Traversable g) => T.Traversable (f :.: g)

deriving instance Bounded Associativity
deriving instance Enum    Associativity
deriving instance Ix      Associativity

deriving instance Eq   (V1 p)
deriving instance Ord  (V1 p)
-- Implement Read instance manually to get around an old GHC bug
-- (Trac #7931)
instance Read (V1 p) where
    readPrec     = parens ReadPrec.pfail
    readList     = readListDefault
    readListPrec = readListPrecDefault
deriving instance Show (V1 p)

instance Functor U1 where
  fmap _ _ = U1

instance Applicative U1 where
  pure _ = U1
  _ <*> _ = U1

instance Alternative U1 where
  empty = U1
  _ <|> _ = U1

instance Monad U1 where
#  if !(MIN_VERSION_base(4,8,0))
  return _ = U1
#  endif
  _ >>= _ = U1

instance MonadPlus U1 where
#  if !(MIN_VERSION_base(4,8,0))
  mzero = U1
  mplus _ _ = U1
#  endif

instance F.Foldable U1 where
    foldMap _ _ = mempty
    {-# INLINE foldMap #-}
    fold _ = mempty
    {-# INLINE fold #-}
    foldr _ z _ = z
    {-# INLINE foldr #-}
    foldl _ z _ = z
    {-# INLINE foldl #-}
    foldl1 _ _ = error "foldl1: U1"
    foldr1 _ _ = error "foldr1: U1"
#  if MIN_VERSION_base(4,8,0)
    length _   = 0
    null _     = True
    elem _ _   = False
    sum _      = 0
    product _  = 1
#  endif

instance T.Traversable U1 where
    traverse _ _ = pure U1
    {-# INLINE traverse #-}
    sequenceA _ = pure U1
    {-# INLINE sequenceA #-}
    mapM _ _ = return U1
    {-# INLINE mapM #-}
    sequence _ = return U1
    {-# INLINE sequence #-}

instance Applicative Par1 where
  pure a = Par1 a
  Par1 f <*> Par1 x = Par1 (f x)

instance Monad Par1 where
#  if !(MIN_VERSION_base(4,8,0))
  return a = Par1 a
#  endif
  Par1 x >>= f = f x

instance Applicative f => Applicative (Rec1 f) where
  pure a = Rec1 (pure a)
  Rec1 f <*> Rec1 x = Rec1 (f <*> x)

instance Alternative f => Alternative (Rec1 f) where
  empty = Rec1 empty
  Rec1 l <|> Rec1 r = Rec1 (l <|> r)

instance Monad f => Monad (Rec1 f) where
#  if !(MIN_VERSION_base(4,8,0))
  return a = Rec1 (return a)
#  endif
  Rec1 x >>= f = Rec1 (x >>= \a -> unRec1 (f a))

instance MonadPlus f => MonadPlus (Rec1 f) where
#  if !(MIN_VERSION_base(4,8,0))
  mzero = Rec1 mzero
  mplus (Rec1 a) (Rec1 b) = Rec1 (mplus a b)
#  endif

instance Applicative f => Applicative (M1 i c f) where
  pure a = M1 (pure a)
  M1 f <*> M1 x = M1 (f <*> x)

instance Alternative f => Alternative (M1 i c f) where
  empty = M1 empty
  M1 l <|> M1 r = M1 (l <|> r)

instance Monad f => Monad (M1 i c f) where
#  if !(MIN_VERSION_base(4,8,0))
  return a = M1 (return a)
#  endif
  M1 x >>= f = M1 (x >>= \a -> unM1 (f a))

instance MonadPlus f => MonadPlus (M1 i c f) where
#  if !(MIN_VERSION_base(4,8,0))
  mzero = M1 mzero
  mplus (M1 a) (M1 b) = M1 (mplus a b)
#  endif

instance (Applicative f, Applicative g) => Applicative (f :*: g) where
  pure a = pure a :*: pure a
  (f :*: g) <*> (x :*: y) = (f <*> x) :*: (g <*> y)

instance (Alternative f, Alternative g) => Alternative (f :*: g) where
  empty = empty :*: empty
  (x1 :*: y1) <|> (x2 :*: y2) = (x1 <|> x2) :*: (y1 <|> y2)

instance (Monad f, Monad g) => Monad (f :*: g) where
#  if !(MIN_VERSION_base(4,8,0))
  return a = return a :*: return a
#  endif
  (m :*: n) >>= f = (m >>= \a -> fstP (f a)) :*: (n >>= \a -> sndP (f a))
    where
      fstP (a :*: _) = a
      sndP (_ :*: b) = b

instance (MonadPlus f, MonadPlus g) => MonadPlus (f :*: g) where
#  if !(MIN_VERSION_base(4,8,0))
  mzero = mzero :*: mzero
  (x1 :*: y1) `mplus` (x2 :*: y2) =  (x1 `mplus` x2) :*: (y1 `mplus` y2)
#  endif

instance (Applicative f, Applicative g) => Applicative (f :.: g) where
  pure x = Comp1 (pure (pure x))
  Comp1 f <*> Comp1 x = Comp1 (fmap (<*>) f <*> x)

instance (Alternative f, Applicative g) => Alternative (f :.: g) where
  empty = Comp1 empty
  Comp1 x <|> Comp1 y = Comp1 (x <|> y)

deriving instance (Data (f p), Typeable1 f, Data p) => Data (Rec1 f p)
deriving instance (Data p, Data (f p), Typeable c, Typeable i, Typeable1 f)
  => Data (M1 i c f p)
deriving instance (Typeable1 f, Typeable1 g, Data p, Data (f p), Data (g p))
  => Data ((f :+: g) p)
deriving instance (Typeable1 f, Typeable1 g, Data p, Data (f p), Data (g p))
  => Data ((f :*: g) p)
deriving instance (Typeable1 f, Typeable1 g, Data p, Data (f (g p)))
  => Data ((f :.: g) p)

#  if MIN_VERSION_base(4,8,0)
instance Bifunctor (K1 i) where
    bimap f _ (K1 c) = K1 (f c)
#  endif
# endif
#endif

#if !(MIN_VERSION_base(4,10,0))
# if MIN_VERSION_base(4,9,0)
deriving instance (Typeable k, Data a, Typeable (b :: k)) => Data (Const a b)
# else
deriving instance (Data a, Data b) => Data (Const a b)
# endif

# if MIN_VERSION_base(4,9,0)
instance Eq1 NonEmpty where
  liftEq eq (a :| as) (b :| bs) = eq a b && liftEq eq as bs

instance Ord1 NonEmpty where
  liftCompare cmp (a :| as) (b :| bs) = cmp a b <> liftCompare cmp as bs

instance Read1 NonEmpty where
  liftReadsPrec rdP rdL p s = readParen (p > 5) (\s' -> do
    (a, s'') <- rdP 6 s'
    (":|", s''') <- lex s''
    (as, s'''') <- rdL s'''
    return (a :| as, s'''')) s

instance Show1 NonEmpty where
  liftShowsPrec shwP shwL p (a :| as) = showParen (p > 5) $
    shwP 6 a . showString " :| " . shwL as

instance Semigroup a => Semigroup (IO a) where
    (<>) = liftA2 (<>)

#  if !defined(mingw32_HOST_OS) && !defined(ghcjs_HOST_OS)
instance Semigroup Event where
    (<>) = mappend
    stimes = stimesMonoid

instance Semigroup Lifetime where
    (<>) = mappend
    stimes = stimesMonoid
#  endif
# endif
#endif

#if !(MIN_VERSION_base(4,11,0))
instance Alternative ZipList where
  empty = ZipList []
  ZipList xs <|> ZipList ys = ZipList (xs ++ drop (length xs) ys)

deriving instance Monoid a => Monoid (Down a)
deriving instance Num a => Num (Down a)

instance Functor Down where
    fmap = coerce

instance Applicative Down where
    pure = Down
    (<*>) = coerce

instance Monad Down where
    return = Down
    Down a >>= k = k a

instance Monoid a => Monoid (Strict.ST s a) where
    mempty = pure mempty
    mappend = liftA2 mappend

# if MIN_VERSION_base(4,9,0)
instance Fail.MonadFail (Strict.ST s) where
    fail s = errorWithoutStackTrace s

deriving instance Semigroup a => Semigroup (Down a)

instance Semigroup a => Semigroup (Strict.ST s a) where
    (<>) = liftA2 (<>)
# endif

# if MIN_VERSION_base(4,10,0)
deriving instance Data IntPtr
deriving instance Data WordPtr
# else
-- The constructors for IntPtr and WordPtr aren't exposed on older versions
-- of base, so we're forced to hand-roll the Data instances here
instance Data IntPtr where
  gfoldl k z iptr = z intPtr `k` unIntPtr iptr
  gunfold k z _ = k (z intPtr)
  toConstr !_ = cIntPtr
  dataTypeOf _ = tIntPtr

intPtr :: Int -> IntPtr
intPtr = unsafeCoerce

unIntPtr :: IntPtr -> Int
unIntPtr = unsafeCoerce

tIntPtr :: DataType
tIntPtr = mkDataType "IntPtr" [cIntPtr]

cIntPtr :: Constr
cIntPtr = mkConstr tIntPtr "IntPtr" [] Data.Prefix

instance Data WordPtr where
  gfoldl k z wptr = z wordPtr `k` unWordPtr wptr
  gunfold k z _ = k (z wordPtr)
  toConstr !_ = cWordPtr
  dataTypeOf _ = tWordPtr

wordPtr :: Word -> WordPtr
wordPtr = unsafeCoerce

unWordPtr :: WordPtr -> Word
unWordPtr = unsafeCoerce

tWordPtr :: DataType
tWordPtr = mkDataType "WordPtr" [cWordPtr]

cWordPtr :: Constr
cWordPtr = mkConstr tWordPtr "WordPtr" [] Data.Prefix
# endif
#endif

#if !(MIN_VERSION_base(4,12,0))
instance MonadFix Down where
    mfix f = Down (fix (getDown . f))
      where getDown (Down x) = x
deriving instance Data a => Data (Down a)
deriving instance F.Foldable Down
deriving instance T.Traversable Down
# if MIN_VERSION_base(4,4,0)
instance MonadZip Down where
    mzipWith = liftM2
# endif
# if MIN_VERSION_base(4,9,0)
instance Eq1 Down where
    liftEq eq (Down x) (Down y) = eq x y
instance Ord1 Down where
    liftCompare comp (Down x) (Down y) = comp x y
instance Read1 Down where
    liftReadsPrec rp _ = readsData $
         readsUnaryWith rp "Down" Down
instance Show1 Down where
    liftShowsPrec sp _ d (Down x) = showsUnaryWith sp "Down" d x
# endif

# if __GLASGOW_HASKELL__ >= 701
instance Monoid c => Applicative (K1 i c) where
  pure _ = K1 mempty
  (<*>) = coerce (mappend :: c -> c -> c)
#  if MIN_VERSION_base(4,10,0)
  liftA2 = \_ -> coerce (mappend :: c -> c -> c)
#  endif

instance Monoid (U1 p) where
  mempty = U1
#  if !(MIN_VERSION_base(4,11,0))
  _ `mappend` _ = U1
#  endif
deriving instance Monoid p => Monoid (Par1 p)
deriving instance Monoid (f p) => Monoid (Rec1 f p)
deriving instance Monoid c => Monoid (K1 i c p)
deriving instance Monoid (f p) => Monoid (M1 i c f p)
instance (Monoid (f p), Monoid (g p)) => Monoid ((f :*: g) p) where
  mempty = mempty :*: mempty
#  if !(MIN_VERSION_base(4,11,0))
  (x1 :*: y1) `mappend` (x2 :*: y2) = (x1 `mappend` x2) :*: (y1 `mappend` y2)
#  endif
deriving instance Monoid (f (g p)) => Monoid ((f :.: g) p)

#  if MIN_VERSION_base(4,9,0)
instance Semigroup (V1 p) where
  v <> _ = v
instance Semigroup (U1 p) where
  _ <> _ = U1
deriving instance Semigroup p => Semigroup (Par1 p)
deriving instance Semigroup (f p) => Semigroup (Rec1 f p)
deriving instance Semigroup c => Semigroup (K1 i c p)
deriving instance Semigroup (f p) => Semigroup (M1 i c f p)
instance (Semigroup (f p), Semigroup (g p)) => Semigroup ((f :*: g) p) where
  (x1 :*: y1) <> (x2 :*: y2) = (x1 <> x2) :*: (y1 <> y2)
deriving instance Semigroup (f (g p)) => Semigroup ((f :.: g) p)
#  endif
# endif

# if MIN_VERSION_base(4,8,0)
deriving instance Foldable f => Foldable (Alt f)
deriving instance Traversable f => Traversable (Alt f)
# endif
#endif

#if !(MIN_VERSION_base(4,14,0))
instance Functor ((,,) a b) where
    fmap f (a, b, c) = (a, b, f c)

instance (Monoid a, Monoid b) => Applicative ((,,) a b) where
    pure x = (mempty, mempty, x)
    (a, b, f) <*> (a', b', x) = (a `mappend` a', b `mappend` b', f x)

instance (Monoid a, Monoid b) => Monad ((,,) a b) where
    (u, v, a) >>= k =
      case k a of
        (u', v', b) ->
          (u `mappend` u', v `mappend` v', b)
# if !(MIN_VERSION_base(4,8,0))
    return x = (mempty, mempty, x)
# endif

instance Functor ((,,,) a b c) where
    fmap f (a, b, c, d) = (a, b, c, f d)

instance (Monoid a, Monoid b, Monoid c) => Applicative ((,,,) a b c) where
    pure x = (mempty, mempty, mempty, x)
    (a, b, c, f) <*> (a', b', c', x) =
      (a `mappend` a', b `mappend` b', c `mappend` c', f x)

instance (Monoid a, Monoid b, Monoid c) => Monad ((,,,) a b c) where
    (u, v, w, a) >>= k =
      case k a of
        (u', v', w', b) ->
          (u `mappend` u', v `mappend` v', w `mappend` w', b)
# if !(MIN_VERSION_base(4,8,0))
    return x = (mempty, mempty, mempty, x)
# endif

deriving instance Functor m => Functor (Kleisli m a)

instance Applicative m => Applicative (Kleisli m a) where
  pure = Kleisli . const . pure
  {-# INLINE pure #-}
  Kleisli f <*> Kleisli g = Kleisli $ \x -> f x <*> g x
  {-# INLINE (<*>) #-}
  Kleisli f *> Kleisli g = Kleisli $ \x -> f x *> g x
  {-# INLINE (*>) #-}
  Kleisli f <* Kleisli g = Kleisli $ \x -> f x <* g x
  {-# INLINE (<*) #-}

instance Alternative m => Alternative (Kleisli m a) where
  empty = Kleisli $ const empty
  {-# INLINE empty #-}
  Kleisli f <|> Kleisli g = Kleisli $ \x -> f x <|> g x
  {-# INLINE (<|>) #-}

instance Monad m => Monad (Kleisli m a) where
  Kleisli f >>= k = Kleisli $ \x -> f x >>= \a -> runKleisli (k a) x
  {-# INLINE (>>=) #-}
# if !(MIN_VERSION_base(4,8,0))
  return = Kleisli . const . return
  {-# INLINE return #-}
# endif

instance MonadPlus m => MonadPlus (Kleisli m a) where
  mzero = Kleisli $ const mzero
  {-# INLINE mzero #-}
  Kleisli f `mplus` Kleisli g = Kleisli $ \x -> f x `mplus` g x
  {-# INLINE mplus #-}

deriving instance Bits       a => Bits       (Down a)
deriving instance Bounded    a => Bounded    (Down a)
deriving instance Enum       a => Enum       (Down a)
deriving instance Floating   a => Floating   (Down a)
deriving instance Fractional a => Fractional (Down a)
deriving instance Integral   a => Integral   (Down a)
deriving instance Ix         a => Ix         (Down a)
deriving instance Real       a => Real       (Down a)
deriving instance RealFrac   a => RealFrac   (Down a)
deriving instance RealFloat  a => RealFloat  (Down a)
deriving instance Storable   a => Storable   (Down a)
# if MIN_VERSION_base(4,7,0)
deriving instance FiniteBits a => FiniteBits (Down a)
# endif

deriving instance (Typeable2 a, Typeable b, Typeable c, Data (a b c))
                         => Data (WrappedArrow a b c)
deriving instance (Typeable1 m, Typeable a, Data (m a))
                         => Data (WrappedMonad m a)
deriving instance Data a => Data (ZipList a)

# if MIN_VERSION_base(4,7,0)
instance IsList (ZipList a) where
  type Item (ZipList a) = a
  fromList = ZipList
  toList = getZipList
# endif

# if MIN_VERSION_base(4,9,0)
instance (TestEquality f) => TestEquality (Compose f g) where
  testEquality (Compose x) (Compose y) =
    case testEquality x y of -- :: Maybe (g x :~: g y)
      Just Refl -> Just Refl -- :: Maybe (x :~: y)
      Nothing   -> Nothing
# endif
#endif

#if !(MIN_VERSION_base(4,15,0))
instance  (Ix a1, Ix a2, Ix a3, Ix a4, Ix a5, Ix a6) =>
      Ix (a1,a2,a3,a4,a5,a6)  where
    range :: ((a1, a2, a3, a4, a5, a6), (a1, a2, a3, a4, a5, a6))
-> [(a1, a2, a3, a4, a5, a6)]
range ((a1
l1,a2
l2,a3
l3,a4
l4,a5
l5,a6
l6),(a1
u1,a2
u2,a3
u3,a4
u4,a5
u5,a6
u6)) =
      [(a1
i1,a2
i2,a3
i3,a4
i4,a5
i5,a6
i6) | a1
i1 <- (a1, a1) -> [a1]
forall a. Ix a => (a, a) -> [a]
range (a1
l1,a1
u1),
                             a2
i2 <- (a2, a2) -> [a2]
forall a. Ix a => (a, a) -> [a]
range (a2
l2,a2
u2),
                             a3
i3 <- (a3, a3) -> [a3]
forall a. Ix a => (a, a) -> [a]
range (a3
l3,a3
u3),
                             a4
i4 <- (a4, a4) -> [a4]
forall a. Ix a => (a, a) -> [a]
range (a4
l4,a4
u4),
                             a5
i5 <- (a5, a5) -> [a5]
forall a. Ix a => (a, a) -> [a]
range (a5
l5,a5
u5),
                             a6
i6 <- (a6, a6) -> [a6]
forall a. Ix a => (a, a) -> [a]
range (a6
l6,a6
u6)]

    unsafeIndex :: ((a1, a2, a3, a4, a5, a6), (a1, a2, a3, a4, a5, a6))
-> (a1, a2, a3, a4, a5, a6) -> Int
unsafeIndex ((a1
l1,a2
l2,a3
l3,a4
l4,a5
l5,a6
l6),(a1
u1,a2
u2,a3
u3,a4
u4,a5
u5,a6
u6)) (a1
i1,a2
i2,a3
i3,a4
i4,a5
i5,a6
i6) =
      (a6, a6) -> a6 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a6
l6,a6
u6) a6
i6 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a6, a6) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a6
l6,a6
u6) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a5, a5) -> a5 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a5
l5,a5
u5) a5
i5 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a5, a5) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a5
l5,a5
u5) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a4, a4) -> a4 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a4
l4,a4
u4) a4
i4 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a4, a4) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a4
l4,a4
u4) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a3, a3) -> a3 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a3
l3,a3
u3) a3
i3 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a3, a3) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a3
l3,a3
u3) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a2, a2) -> a2 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a2
l2,a2
u2) a2
i2 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a2, a2) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a2
l2,a2
u2) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a1, a1) -> a1 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a1
l1,a1
u1) a1
i1)))))

    inRange :: ((a1, a2, a3, a4, a5, a6), (a1, a2, a3, a4, a5, a6))
-> (a1, a2, a3, a4, a5, a6) -> Bool
inRange ((a1
l1,a2
l2,a3
l3,a4
l4,a5
l5,a6
l6),(a1
u1,a2
u2,a3
u3,a4
u4,a5
u5,a6
u6)) (a1
i1,a2
i2,a3
i3,a4
i4,a5
i5,a6
i6) =
      (a1, a1) -> a1 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a1
l1,a1
u1) a1
i1 Bool -> Bool -> Bool
&& (a2, a2) -> a2 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a2
l2,a2
u2) a2
i2 Bool -> Bool -> Bool
&&
      (a3, a3) -> a3 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a3
l3,a3
u3) a3
i3 Bool -> Bool -> Bool
&& (a4, a4) -> a4 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a4
l4,a4
u4) a4
i4 Bool -> Bool -> Bool
&&
      (a5, a5) -> a5 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a5
l5,a5
u5) a5
i5 Bool -> Bool -> Bool
&& (a6, a6) -> a6 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a6
l6,a6
u6) a6
i6

    -- Default method for index

instance  (Ix a1, Ix a2, Ix a3, Ix a4, Ix a5, Ix a6, Ix a7) =>
      Ix (a1,a2,a3,a4,a5,a6,a7)  where
    range :: ((a1, a2, a3, a4, a5, a6, a7), (a1, a2, a3, a4, a5, a6, a7))
-> [(a1, a2, a3, a4, a5, a6, a7)]
range ((a1
l1,a2
l2,a3
l3,a4
l4,a5
l5,a6
l6,a7
l7),(a1
u1,a2
u2,a3
u3,a4
u4,a5
u5,a6
u6,a7
u7)) =
      [(a1
i1,a2
i2,a3
i3,a4
i4,a5
i5,a6
i6,a7
i7) | a1
i1 <- (a1, a1) -> [a1]
forall a. Ix a => (a, a) -> [a]
range (a1
l1,a1
u1),
                                a2
i2 <- (a2, a2) -> [a2]
forall a. Ix a => (a, a) -> [a]
range (a2
l2,a2
u2),
                                a3
i3 <- (a3, a3) -> [a3]
forall a. Ix a => (a, a) -> [a]
range (a3
l3,a3
u3),
                                a4
i4 <- (a4, a4) -> [a4]
forall a. Ix a => (a, a) -> [a]
range (a4
l4,a4
u4),
                                a5
i5 <- (a5, a5) -> [a5]
forall a. Ix a => (a, a) -> [a]
range (a5
l5,a5
u5),
                                a6
i6 <- (a6, a6) -> [a6]
forall a. Ix a => (a, a) -> [a]
range (a6
l6,a6
u6),
                                a7
i7 <- (a7, a7) -> [a7]
forall a. Ix a => (a, a) -> [a]
range (a7
l7,a7
u7)]

    unsafeIndex :: ((a1, a2, a3, a4, a5, a6, a7), (a1, a2, a3, a4, a5, a6, a7))
-> (a1, a2, a3, a4, a5, a6, a7) -> Int
unsafeIndex ((a1
l1,a2
l2,a3
l3,a4
l4,a5
l5,a6
l6,a7
l7),(a1
u1,a2
u2,a3
u3,a4
u4,a5
u5,a6
u6,a7
u7))
        (a1
i1,a2
i2,a3
i3,a4
i4,a5
i5,a6
i6,a7
i7) =
      (a7, a7) -> a7 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a7
l7,a7
u7) a7
i7 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a7, a7) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a7
l7,a7
u7) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a6, a6) -> a6 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a6
l6,a6
u6) a6
i6 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a6, a6) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a6
l6,a6
u6) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a5, a5) -> a5 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a5
l5,a5
u5) a5
i5 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a5, a5) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a5
l5,a5
u5) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a4, a4) -> a4 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a4
l4,a4
u4) a4
i4 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a4, a4) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a4
l4,a4
u4) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a3, a3) -> a3 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a3
l3,a3
u3) a3
i3 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a3, a3) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a3
l3,a3
u3) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a2, a2) -> a2 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a2
l2,a2
u2) a2
i2 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a2, a2) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a2
l2,a2
u2) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a1, a1) -> a1 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a1
l1,a1
u1) a1
i1))))))

    inRange :: ((a1, a2, a3, a4, a5, a6, a7), (a1, a2, a3, a4, a5, a6, a7))
-> (a1, a2, a3, a4, a5, a6, a7) -> Bool
inRange ((a1
l1,a2
l2,a3
l3,a4
l4,a5
l5,a6
l6,a7
l7),(a1
u1,a2
u2,a3
u3,a4
u4,a5
u5,a6
u6,a7
u7))
        (a1
i1,a2
i2,a3
i3,a4
i4,a5
i5,a6
i6,a7
i7) =
      (a1, a1) -> a1 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a1
l1,a1
u1) a1
i1 Bool -> Bool -> Bool
&& (a2, a2) -> a2 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a2
l2,a2
u2) a2
i2 Bool -> Bool -> Bool
&&
      (a3, a3) -> a3 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a3
l3,a3
u3) a3
i3 Bool -> Bool -> Bool
&& (a4, a4) -> a4 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a4
l4,a4
u4) a4
i4 Bool -> Bool -> Bool
&&
      (a5, a5) -> a5 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a5
l5,a5
u5) a5
i5 Bool -> Bool -> Bool
&& (a6, a6) -> a6 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a6
l6,a6
u6) a6
i6 Bool -> Bool -> Bool
&&
      (a7, a7) -> a7 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a7
l7,a7
u7) a7
i7

    -- Default method for index

instance  (Ix a1, Ix a2, Ix a3, Ix a4, Ix a5, Ix a6, Ix a7, Ix a8) =>
      Ix (a1,a2,a3,a4,a5,a6,a7,a8)  where
    range :: ((a1, a2, a3, a4, a5, a6, a7, a8),
 (a1, a2, a3, a4, a5, a6, a7, a8))
-> [(a1, a2, a3, a4, a5, a6, a7, a8)]
range ((a1
l1,a2
l2,a3
l3,a4
l4,a5
l5,a6
l6,a7
l7,a8
l8),(a1
u1,a2
u2,a3
u3,a4
u4,a5
u5,a6
u6,a7
u7,a8
u8)) =
      [(a1
i1,a2
i2,a3
i3,a4
i4,a5
i5,a6
i6,a7
i7,a8
i8) | a1
i1 <- (a1, a1) -> [a1]
forall a. Ix a => (a, a) -> [a]
range (a1
l1,a1
u1),
                                   a2
i2 <- (a2, a2) -> [a2]
forall a. Ix a => (a, a) -> [a]
range (a2
l2,a2
u2),
                                   a3
i3 <- (a3, a3) -> [a3]
forall a. Ix a => (a, a) -> [a]
range (a3
l3,a3
u3),
                                   a4
i4 <- (a4, a4) -> [a4]
forall a. Ix a => (a, a) -> [a]
range (a4
l4,a4
u4),
                                   a5
i5 <- (a5, a5) -> [a5]
forall a. Ix a => (a, a) -> [a]
range (a5
l5,a5
u5),
                                   a6
i6 <- (a6, a6) -> [a6]
forall a. Ix a => (a, a) -> [a]
range (a6
l6,a6
u6),
                                   a7
i7 <- (a7, a7) -> [a7]
forall a. Ix a => (a, a) -> [a]
range (a7
l7,a7
u7),
                                   a8
i8 <- (a8, a8) -> [a8]
forall a. Ix a => (a, a) -> [a]
range (a8
l8,a8
u8)]

    unsafeIndex :: ((a1, a2, a3, a4, a5, a6, a7, a8),
 (a1, a2, a3, a4, a5, a6, a7, a8))
-> (a1, a2, a3, a4, a5, a6, a7, a8) -> Int
unsafeIndex ((a1
l1,a2
l2,a3
l3,a4
l4,a5
l5,a6
l6,a7
l7,a8
l8),(a1
u1,a2
u2,a3
u3,a4
u4,a5
u5,a6
u6,a7
u7,a8
u8))
        (a1
i1,a2
i2,a3
i3,a4
i4,a5
i5,a6
i6,a7
i7,a8
i8) =
      (a8, a8) -> a8 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a8
l8,a8
u8) a8
i8 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a8, a8) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a8
l8,a8
u8) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a7, a7) -> a7 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a7
l7,a7
u7) a7
i7 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a7, a7) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a7
l7,a7
u7) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a6, a6) -> a6 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a6
l6,a6
u6) a6
i6 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a6, a6) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a6
l6,a6
u6) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a5, a5) -> a5 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a5
l5,a5
u5) a5
i5 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a5, a5) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a5
l5,a5
u5) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a4, a4) -> a4 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a4
l4,a4
u4) a4
i4 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a4, a4) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a4
l4,a4
u4) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a3, a3) -> a3 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a3
l3,a3
u3) a3
i3 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a3, a3) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a3
l3,a3
u3) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a2, a2) -> a2 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a2
l2,a2
u2) a2
i2 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a2, a2) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a2
l2,a2
u2) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a1, a1) -> a1 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a1
l1,a1
u1) a1
i1)))))))

    inRange :: ((a1, a2, a3, a4, a5, a6, a7, a8),
 (a1, a2, a3, a4, a5, a6, a7, a8))
-> (a1, a2, a3, a4, a5, a6, a7, a8) -> Bool
inRange ((a1
l1,a2
l2,a3
l3,a4
l4,a5
l5,a6
l6,a7
l7,a8
l8),(a1
u1,a2
u2,a3
u3,a4
u4,a5
u5,a6
u6,a7
u7,a8
u8))
        (a1
i1,a2
i2,a3
i3,a4
i4,a5
i5,a6
i6,a7
i7,a8
i8) =
      (a1, a1) -> a1 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a1
l1,a1
u1) a1
i1 Bool -> Bool -> Bool
&& (a2, a2) -> a2 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a2
l2,a2
u2) a2
i2 Bool -> Bool -> Bool
&&
      (a3, a3) -> a3 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a3
l3,a3
u3) a3
i3 Bool -> Bool -> Bool
&& (a4, a4) -> a4 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a4
l4,a4
u4) a4
i4 Bool -> Bool -> Bool
&&
      (a5, a5) -> a5 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a5
l5,a5
u5) a5
i5 Bool -> Bool -> Bool
&& (a6, a6) -> a6 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a6
l6,a6
u6) a6
i6 Bool -> Bool -> Bool
&&
      (a7, a7) -> a7 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a7
l7,a7
u7) a7
i7 Bool -> Bool -> Bool
&& (a8, a8) -> a8 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a8
l8,a8
u8) a8
i8

    -- Default method for index

instance  (Ix a1, Ix a2, Ix a3, Ix a4, Ix a5, Ix a6, Ix a7, Ix a8, Ix a9) =>
      Ix (a1,a2,a3,a4,a5,a6,a7,a8,a9)  where
    range :: ((a1, a2, a3, a4, a5, a6, a7, a8, a9),
 (a1, a2, a3, a4, a5, a6, a7, a8, a9))
-> [(a1, a2, a3, a4, a5, a6, a7, a8, a9)]
range ((a1
l1,a2
l2,a3
l3,a4
l4,a5
l5,a6
l6,a7
l7,a8
l8,a9
l9),(a1
u1,a2
u2,a3
u3,a4
u4,a5
u5,a6
u6,a7
u7,a8
u8,a9
u9)) =
      [(a1
i1,a2
i2,a3
i3,a4
i4,a5
i5,a6
i6,a7
i7,a8
i8,a9
i9) | a1
i1 <- (a1, a1) -> [a1]
forall a. Ix a => (a, a) -> [a]
range (a1
l1,a1
u1),
                                      a2
i2 <- (a2, a2) -> [a2]
forall a. Ix a => (a, a) -> [a]
range (a2
l2,a2
u2),
                                      a3
i3 <- (a3, a3) -> [a3]
forall a. Ix a => (a, a) -> [a]
range (a3
l3,a3
u3),
                                      a4
i4 <- (a4, a4) -> [a4]
forall a. Ix a => (a, a) -> [a]
range (a4
l4,a4
u4),
                                      a5
i5 <- (a5, a5) -> [a5]
forall a. Ix a => (a, a) -> [a]
range (a5
l5,a5
u5),
                                      a6
i6 <- (a6, a6) -> [a6]
forall a. Ix a => (a, a) -> [a]
range (a6
l6,a6
u6),
                                      a7
i7 <- (a7, a7) -> [a7]
forall a. Ix a => (a, a) -> [a]
range (a7
l7,a7
u7),
                                      a8
i8 <- (a8, a8) -> [a8]
forall a. Ix a => (a, a) -> [a]
range (a8
l8,a8
u8),
                                      a9
i9 <- (a9, a9) -> [a9]
forall a. Ix a => (a, a) -> [a]
range (a9
l9,a9
u9)]

    unsafeIndex :: ((a1, a2, a3, a4, a5, a6, a7, a8, a9),
 (a1, a2, a3, a4, a5, a6, a7, a8, a9))
-> (a1, a2, a3, a4, a5, a6, a7, a8, a9) -> Int
unsafeIndex ((a1
l1,a2
l2,a3
l3,a4
l4,a5
l5,a6
l6,a7
l7,a8
l8,a9
l9),(a1
u1,a2
u2,a3
u3,a4
u4,a5
u5,a6
u6,a7
u7,a8
u8,a9
u9))
        (a1
i1,a2
i2,a3
i3,a4
i4,a5
i5,a6
i6,a7
i7,a8
i8,a9
i9) =
      (a9, a9) -> a9 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a9
l9,a9
u9) a9
i9 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a9, a9) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a9
l9,a9
u9) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a8, a8) -> a8 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a8
l8,a8
u8) a8
i8 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a8, a8) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a8
l8,a8
u8) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a7, a7) -> a7 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a7
l7,a7
u7) a7
i7 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a7, a7) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a7
l7,a7
u7) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a6, a6) -> a6 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a6
l6,a6
u6) a6
i6 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a6, a6) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a6
l6,a6
u6) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a5, a5) -> a5 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a5
l5,a5
u5) a5
i5 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a5, a5) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a5
l5,a5
u5) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a4, a4) -> a4 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a4
l4,a4
u4) a4
i4 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a4, a4) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a4
l4,a4
u4) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a3, a3) -> a3 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a3
l3,a3
u3) a3
i3 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a3, a3) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a3
l3,a3
u3) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a2, a2) -> a2 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a2
l2,a2
u2) a2
i2 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a2, a2) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a2
l2,a2
u2) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a1, a1) -> a1 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a1
l1,a1
u1) a1
i1))))))))

    inRange :: ((a1, a2, a3, a4, a5, a6, a7, a8, a9),
 (a1, a2, a3, a4, a5, a6, a7, a8, a9))
-> (a1, a2, a3, a4, a5, a6, a7, a8, a9) -> Bool
inRange ((a1
l1,a2
l2,a3
l3,a4
l4,a5
l5,a6
l6,a7
l7,a8
l8,a9
l9),(a1
u1,a2
u2,a3
u3,a4
u4,a5
u5,a6
u6,a7
u7,a8
u8,a9
u9))
        (a1
i1,a2
i2,a3
i3,a4
i4,a5
i5,a6
i6,a7
i7,a8
i8,a9
i9) =
      (a1, a1) -> a1 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a1
l1,a1
u1) a1
i1 Bool -> Bool -> Bool
&& (a2, a2) -> a2 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a2
l2,a2
u2) a2
i2 Bool -> Bool -> Bool
&&
      (a3, a3) -> a3 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a3
l3,a3
u3) a3
i3 Bool -> Bool -> Bool
&& (a4, a4) -> a4 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a4
l4,a4
u4) a4
i4 Bool -> Bool -> Bool
&&
      (a5, a5) -> a5 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a5
l5,a5
u5) a5
i5 Bool -> Bool -> Bool
&& (a6, a6) -> a6 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a6
l6,a6
u6) a6
i6 Bool -> Bool -> Bool
&&
      (a7, a7) -> a7 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a7
l7,a7
u7) a7
i7 Bool -> Bool -> Bool
&& (a8, a8) -> a8 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a8
l8,a8
u8) a8
i8 Bool -> Bool -> Bool
&&
      (a9, a9) -> a9 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a9
l9,a9
u9) a9
i9

    -- Default method for index

instance  (Ix a1, Ix a2, Ix a3, Ix a4, Ix a5, Ix a6, Ix a7, Ix a8, Ix a9,
           Ix aA) =>
      Ix (a1,a2,a3,a4,a5,a6,a7,a8,a9,aA)  where
    range :: ((a1, a2, a3, a4, a5, a6, a7, a8, a9, aA),
 (a1, a2, a3, a4, a5, a6, a7, a8, a9, aA))
-> [(a1, a2, a3, a4, a5, a6, a7, a8, a9, aA)]
range ((a1
l1,a2
l2,a3
l3,a4
l4,a5
l5,a6
l6,a7
l7,a8
l8,a9
l9,aA
lA),(a1
u1,a2
u2,a3
u3,a4
u4,a5
u5,a6
u6,a7
u7,a8
u8,a9
u9,aA
uA)) =
      [(a1
i1,a2
i2,a3
i3,a4
i4,a5
i5,a6
i6,a7
i7,a8
i8,a9
i9,aA
iA) | a1
i1 <- (a1, a1) -> [a1]
forall a. Ix a => (a, a) -> [a]
range (a1
l1,a1
u1),
                                         a2
i2 <- (a2, a2) -> [a2]
forall a. Ix a => (a, a) -> [a]
range (a2
l2,a2
u2),
                                         a3
i3 <- (a3, a3) -> [a3]
forall a. Ix a => (a, a) -> [a]
range (a3
l3,a3
u3),
                                         a4
i4 <- (a4, a4) -> [a4]
forall a. Ix a => (a, a) -> [a]
range (a4
l4,a4
u4),
                                         a5
i5 <- (a5, a5) -> [a5]
forall a. Ix a => (a, a) -> [a]
range (a5
l5,a5
u5),
                                         a6
i6 <- (a6, a6) -> [a6]
forall a. Ix a => (a, a) -> [a]
range (a6
l6,a6
u6),
                                         a7
i7 <- (a7, a7) -> [a7]
forall a. Ix a => (a, a) -> [a]
range (a7
l7,a7
u7),
                                         a8
i8 <- (a8, a8) -> [a8]
forall a. Ix a => (a, a) -> [a]
range (a8
l8,a8
u8),
                                         a9
i9 <- (a9, a9) -> [a9]
forall a. Ix a => (a, a) -> [a]
range (a9
l9,a9
u9),
                                         aA
iA <- (aA, aA) -> [aA]
forall a. Ix a => (a, a) -> [a]
range (aA
lA,aA
uA)]

    unsafeIndex :: ((a1, a2, a3, a4, a5, a6, a7, a8, a9, aA),
 (a1, a2, a3, a4, a5, a6, a7, a8, a9, aA))
-> (a1, a2, a3, a4, a5, a6, a7, a8, a9, aA) -> Int
unsafeIndex ((a1
l1,a2
l2,a3
l3,a4
l4,a5
l5,a6
l6,a7
l7,a8
l8,a9
l9,aA
lA),
                 (a1
u1,a2
u2,a3
u3,a4
u4,a5
u5,a6
u6,a7
u7,a8
u8,a9
u9,aA
uA))
        (a1
i1,a2
i2,a3
i3,a4
i4,a5
i5,a6
i6,a7
i7,a8
i8,a9
i9,aA
iA) =
      (aA, aA) -> aA -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (aA
lA,aA
uA) aA
iA Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (aA, aA) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (aA
lA,aA
uA) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a9, a9) -> a9 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a9
l9,a9
u9) a9
i9 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a9, a9) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a9
l9,a9
u9) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a8, a8) -> a8 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a8
l8,a8
u8) a8
i8 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a8, a8) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a8
l8,a8
u8) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a7, a7) -> a7 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a7
l7,a7
u7) a7
i7 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a7, a7) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a7
l7,a7
u7) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a6, a6) -> a6 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a6
l6,a6
u6) a6
i6 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a6, a6) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a6
l6,a6
u6) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a5, a5) -> a5 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a5
l5,a5
u5) a5
i5 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a5, a5) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a5
l5,a5
u5) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a4, a4) -> a4 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a4
l4,a4
u4) a4
i4 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a4, a4) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a4
l4,a4
u4) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a3, a3) -> a3 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a3
l3,a3
u3) a3
i3 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a3, a3) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a3
l3,a3
u3) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a2, a2) -> a2 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a2
l2,a2
u2) a2
i2 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a2, a2) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a2
l2,a2
u2) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a1, a1) -> a1 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a1
l1,a1
u1) a1
i1)))))))))

    inRange :: ((a1, a2, a3, a4, a5, a6, a7, a8, a9, aA),
 (a1, a2, a3, a4, a5, a6, a7, a8, a9, aA))
-> (a1, a2, a3, a4, a5, a6, a7, a8, a9, aA) -> Bool
inRange ((a1
l1,a2
l2,a3
l3,a4
l4,a5
l5,a6
l6,a7
l7,a8
l8,a9
l9,aA
lA),(a1
u1,a2
u2,a3
u3,a4
u4,a5
u5,a6
u6,a7
u7,a8
u8,a9
u9,aA
uA))
        (a1
i1,a2
i2,a3
i3,a4
i4,a5
i5,a6
i6,a7
i7,a8
i8,a9
i9,aA
iA) =
      (a1, a1) -> a1 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a1
l1,a1
u1) a1
i1 Bool -> Bool -> Bool
&& (a2, a2) -> a2 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a2
l2,a2
u2) a2
i2 Bool -> Bool -> Bool
&&
      (a3, a3) -> a3 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a3
l3,a3
u3) a3
i3 Bool -> Bool -> Bool
&& (a4, a4) -> a4 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a4
l4,a4
u4) a4
i4 Bool -> Bool -> Bool
&&
      (a5, a5) -> a5 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a5
l5,a5
u5) a5
i5 Bool -> Bool -> Bool
&& (a6, a6) -> a6 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a6
l6,a6
u6) a6
i6 Bool -> Bool -> Bool
&&
      (a7, a7) -> a7 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a7
l7,a7
u7) a7
i7 Bool -> Bool -> Bool
&& (a8, a8) -> a8 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a8
l8,a8
u8) a8
i8 Bool -> Bool -> Bool
&&
      (a9, a9) -> a9 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a9
l9,a9
u9) a9
i9 Bool -> Bool -> Bool
&& (aA, aA) -> aA -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (aA
lA,aA
uA) aA
iA

    -- Default method for index

instance  (Ix a1, Ix a2, Ix a3, Ix a4, Ix a5, Ix a6, Ix a7, Ix a8, Ix a9,
           Ix aA, Ix aB) =>
      Ix (a1,a2,a3,a4,a5,a6,a7,a8,a9,aA,aB)  where
    range :: ((a1, a2, a3, a4, a5, a6, a7, a8, a9, aA, aB),
 (a1, a2, a3, a4, a5, a6, a7, a8, a9, aA, aB))
-> [(a1, a2, a3, a4, a5, a6, a7, a8, a9, aA, aB)]
range ((a1
l1,a2
l2,a3
l3,a4
l4,a5
l5,a6
l6,a7
l7,a8
l8,a9
l9,aA
lA,aB
lB),
           (a1
u1,a2
u2,a3
u3,a4
u4,a5
u5,a6
u6,a7
u7,a8
u8,a9
u9,aA
uA,aB
uB)) =
      [(a1
i1,a2
i2,a3
i3,a4
i4,a5
i5,a6
i6,a7
i7,a8
i8,a9
i9,aA
iA,aB
iB) | a1
i1 <- (a1, a1) -> [a1]
forall a. Ix a => (a, a) -> [a]
range (a1
l1,a1
u1),
                                            a2
i2 <- (a2, a2) -> [a2]
forall a. Ix a => (a, a) -> [a]
range (a2
l2,a2
u2),
                                            a3
i3 <- (a3, a3) -> [a3]
forall a. Ix a => (a, a) -> [a]
range (a3
l3,a3
u3),
                                            a4
i4 <- (a4, a4) -> [a4]
forall a. Ix a => (a, a) -> [a]
range (a4
l4,a4
u4),
                                            a5
i5 <- (a5, a5) -> [a5]
forall a. Ix a => (a, a) -> [a]
range (a5
l5,a5
u5),
                                            a6
i6 <- (a6, a6) -> [a6]
forall a. Ix a => (a, a) -> [a]
range (a6
l6,a6
u6),
                                            a7
i7 <- (a7, a7) -> [a7]
forall a. Ix a => (a, a) -> [a]
range (a7
l7,a7
u7),
                                            a8
i8 <- (a8, a8) -> [a8]
forall a. Ix a => (a, a) -> [a]
range (a8
l8,a8
u8),
                                            a9
i9 <- (a9, a9) -> [a9]
forall a. Ix a => (a, a) -> [a]
range (a9
l9,a9
u9),
                                            aA
iA <- (aA, aA) -> [aA]
forall a. Ix a => (a, a) -> [a]
range (aA
lA,aA
uA),
                                            aB
iB <- (aB, aB) -> [aB]
forall a. Ix a => (a, a) -> [a]
range (aB
lB,aB
uB)]

    unsafeIndex :: ((a1, a2, a3, a4, a5, a6, a7, a8, a9, aA, aB),
 (a1, a2, a3, a4, a5, a6, a7, a8, a9, aA, aB))
-> (a1, a2, a3, a4, a5, a6, a7, a8, a9, aA, aB) -> Int
unsafeIndex ((a1
l1,a2
l2,a3
l3,a4
l4,a5
l5,a6
l6,a7
l7,a8
l8,a9
l9,aA
lA,aB
lB),
                 (a1
u1,a2
u2,a3
u3,a4
u4,a5
u5,a6
u6,a7
u7,a8
u8,a9
u9,aA
uA,aB
uB))
        (a1
i1,a2
i2,a3
i3,a4
i4,a5
i5,a6
i6,a7
i7,a8
i8,a9
i9,aA
iA,aB
iB) =
      (aB, aB) -> aB -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (aB
lB,aB
uB) aB
iB Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (aB, aB) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (aB
lB,aB
uB) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (aA, aA) -> aA -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (aA
lA,aA
uA) aA
iA Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (aA, aA) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (aA
lA,aA
uA) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a9, a9) -> a9 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a9
l9,a9
u9) a9
i9 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a9, a9) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a9
l9,a9
u9) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a8, a8) -> a8 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a8
l8,a8
u8) a8
i8 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a8, a8) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a8
l8,a8
u8) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a7, a7) -> a7 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a7
l7,a7
u7) a7
i7 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a7, a7) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a7
l7,a7
u7) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a6, a6) -> a6 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a6
l6,a6
u6) a6
i6 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a6, a6) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a6
l6,a6
u6) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a5, a5) -> a5 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a5
l5,a5
u5) a5
i5 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a5, a5) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a5
l5,a5
u5) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a4, a4) -> a4 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a4
l4,a4
u4) a4
i4 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a4, a4) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a4
l4,a4
u4) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a3, a3) -> a3 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a3
l3,a3
u3) a3
i3 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a3, a3) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a3
l3,a3
u3) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a2, a2) -> a2 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a2
l2,a2
u2) a2
i2 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a2, a2) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a2
l2,a2
u2) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a1, a1) -> a1 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a1
l1,a1
u1) a1
i1))))))))))

    inRange :: ((a1, a2, a3, a4, a5, a6, a7, a8, a9, aA, aB),
 (a1, a2, a3, a4, a5, a6, a7, a8, a9, aA, aB))
-> (a1, a2, a3, a4, a5, a6, a7, a8, a9, aA, aB) -> Bool
inRange ((a1
l1,a2
l2,a3
l3,a4
l4,a5
l5,a6
l6,a7
l7,a8
l8,a9
l9,aA
lA,aB
lB),
             (a1
u1,a2
u2,a3
u3,a4
u4,a5
u5,a6
u6,a7
u7,a8
u8,a9
u9,aA
uA,aB
uB))
        (a1
i1,a2
i2,a3
i3,a4
i4,a5
i5,a6
i6,a7
i7,a8
i8,a9
i9,aA
iA,aB
iB) =
      (a1, a1) -> a1 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a1
l1,a1
u1) a1
i1 Bool -> Bool -> Bool
&& (a2, a2) -> a2 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a2
l2,a2
u2) a2
i2 Bool -> Bool -> Bool
&&
      (a3, a3) -> a3 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a3
l3,a3
u3) a3
i3 Bool -> Bool -> Bool
&& (a4, a4) -> a4 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a4
l4,a4
u4) a4
i4 Bool -> Bool -> Bool
&&
      (a5, a5) -> a5 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a5
l5,a5
u5) a5
i5 Bool -> Bool -> Bool
&& (a6, a6) -> a6 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a6
l6,a6
u6) a6
i6 Bool -> Bool -> Bool
&&
      (a7, a7) -> a7 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a7
l7,a7
u7) a7
i7 Bool -> Bool -> Bool
&& (a8, a8) -> a8 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a8
l8,a8
u8) a8
i8 Bool -> Bool -> Bool
&&
      (a9, a9) -> a9 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a9
l9,a9
u9) a9
i9 Bool -> Bool -> Bool
&& (aA, aA) -> aA -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (aA
lA,aA
uA) aA
iA Bool -> Bool -> Bool
&&
      (aB, aB) -> aB -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (aB
lB,aB
uB) aB
iB

    -- Default method for index

instance  (Ix a1, Ix a2, Ix a3, Ix a4, Ix a5, Ix a6, Ix a7, Ix a8, Ix a9,
           Ix aA, Ix aB, Ix aC) =>
      Ix (a1,a2,a3,a4,a5,a6,a7,a8,a9,aA,aB,aC)  where
    range :: ((a1, a2, a3, a4, a5, a6, a7, a8, a9, aA, aB, aC),
 (a1, a2, a3, a4, a5, a6, a7, a8, a9, aA, aB, aC))
-> [(a1, a2, a3, a4, a5, a6, a7, a8, a9, aA, aB, aC)]
range ((a1
l1,a2
l2,a3
l3,a4
l4,a5
l5,a6
l6,a7
l7,a8
l8,a9
l9,aA
lA,aB
lB,aC
lC),
           (a1
u1,a2
u2,a3
u3,a4
u4,a5
u5,a6
u6,a7
u7,a8
u8,a9
u9,aA
uA,aB
uB,aC
uC)) =
      [(a1
i1,a2
i2,a3
i3,a4
i4,a5
i5,a6
i6,a7
i7,a8
i8,a9
i9,aA
iA,aB
iB,aC
iC) | a1
i1 <- (a1, a1) -> [a1]
forall a. Ix a => (a, a) -> [a]
range (a1
l1,a1
u1),
                                               a2
i2 <- (a2, a2) -> [a2]
forall a. Ix a => (a, a) -> [a]
range (a2
l2,a2
u2),
                                               a3
i3 <- (a3, a3) -> [a3]
forall a. Ix a => (a, a) -> [a]
range (a3
l3,a3
u3),
                                               a4
i4 <- (a4, a4) -> [a4]
forall a. Ix a => (a, a) -> [a]
range (a4
l4,a4
u4),
                                               a5
i5 <- (a5, a5) -> [a5]
forall a. Ix a => (a, a) -> [a]
range (a5
l5,a5
u5),
                                               a6
i6 <- (a6, a6) -> [a6]
forall a. Ix a => (a, a) -> [a]
range (a6
l6,a6
u6),
                                               a7
i7 <- (a7, a7) -> [a7]
forall a. Ix a => (a, a) -> [a]
range (a7
l7,a7
u7),
                                               a8
i8 <- (a8, a8) -> [a8]
forall a. Ix a => (a, a) -> [a]
range (a8
l8,a8
u8),
                                               a9
i9 <- (a9, a9) -> [a9]
forall a. Ix a => (a, a) -> [a]
range (a9
l9,a9
u9),
                                               aA
iA <- (aA, aA) -> [aA]
forall a. Ix a => (a, a) -> [a]
range (aA
lA,aA
uA),
                                               aB
iB <- (aB, aB) -> [aB]
forall a. Ix a => (a, a) -> [a]
range (aB
lB,aB
uB),
                                               aC
iC <- (aC, aC) -> [aC]
forall a. Ix a => (a, a) -> [a]
range (aC
lC,aC
uC)]

    unsafeIndex :: ((a1, a2, a3, a4, a5, a6, a7, a8, a9, aA, aB, aC),
 (a1, a2, a3, a4, a5, a6, a7, a8, a9, aA, aB, aC))
-> (a1, a2, a3, a4, a5, a6, a7, a8, a9, aA, aB, aC) -> Int
unsafeIndex ((a1
l1,a2
l2,a3
l3,a4
l4,a5
l5,a6
l6,a7
l7,a8
l8,a9
l9,aA
lA,aB
lB,aC
lC),
                 (a1
u1,a2
u2,a3
u3,a4
u4,a5
u5,a6
u6,a7
u7,a8
u8,a9
u9,aA
uA,aB
uB,aC
uC))
        (a1
i1,a2
i2,a3
i3,a4
i4,a5
i5,a6
i6,a7
i7,a8
i8,a9
i9,aA
iA,aB
iB,aC
iC) =
      (aC, aC) -> aC -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (aC
lC,aC
uC) aC
iC Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (aC, aC) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (aC
lC,aC
uC) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (aB, aB) -> aB -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (aB
lB,aB
uB) aB
iB Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (aB, aB) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (aB
lB,aB
uB) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (aA, aA) -> aA -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (aA
lA,aA
uA) aA
iA Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (aA, aA) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (aA
lA,aA
uA) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a9, a9) -> a9 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a9
l9,a9
u9) a9
i9 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a9, a9) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a9
l9,a9
u9) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a8, a8) -> a8 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a8
l8,a8
u8) a8
i8 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a8, a8) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a8
l8,a8
u8) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a7, a7) -> a7 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a7
l7,a7
u7) a7
i7 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a7, a7) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a7
l7,a7
u7) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a6, a6) -> a6 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a6
l6,a6
u6) a6
i6 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a6, a6) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a6
l6,a6
u6) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a5, a5) -> a5 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a5
l5,a5
u5) a5
i5 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a5, a5) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a5
l5,a5
u5) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a4, a4) -> a4 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a4
l4,a4
u4) a4
i4 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a4, a4) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a4
l4,a4
u4) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a3, a3) -> a3 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a3
l3,a3
u3) a3
i3 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a3, a3) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a3
l3,a3
u3) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a2, a2) -> a2 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a2
l2,a2
u2) a2
i2 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a2, a2) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a2
l2,a2
u2) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a1, a1) -> a1 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a1
l1,a1
u1) a1
i1)))))))))))

    inRange :: ((a1, a2, a3, a4, a5, a6, a7, a8, a9, aA, aB, aC),
 (a1, a2, a3, a4, a5, a6, a7, a8, a9, aA, aB, aC))
-> (a1, a2, a3, a4, a5, a6, a7, a8, a9, aA, aB, aC) -> Bool
inRange ((a1
l1,a2
l2,a3
l3,a4
l4,a5
l5,a6
l6,a7
l7,a8
l8,a9
l9,aA
lA,aB
lB,aC
lC),
             (a1
u1,a2
u2,a3
u3,a4
u4,a5
u5,a6
u6,a7
u7,a8
u8,a9
u9,aA
uA,aB
uB,aC
uC))
        (a1
i1,a2
i2,a3
i3,a4
i4,a5
i5,a6
i6,a7
i7,a8
i8,a9
i9,aA
iA,aB
iB,aC
iC) =
      (a1, a1) -> a1 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a1
l1,a1
u1) a1
i1 Bool -> Bool -> Bool
&& (a2, a2) -> a2 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a2
l2,a2
u2) a2
i2 Bool -> Bool -> Bool
&&
      (a3, a3) -> a3 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a3
l3,a3
u3) a3
i3 Bool -> Bool -> Bool
&& (a4, a4) -> a4 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a4
l4,a4
u4) a4
i4 Bool -> Bool -> Bool
&&
      (a5, a5) -> a5 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a5
l5,a5
u5) a5
i5 Bool -> Bool -> Bool
&& (a6, a6) -> a6 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a6
l6,a6
u6) a6
i6 Bool -> Bool -> Bool
&&
      (a7, a7) -> a7 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a7
l7,a7
u7) a7
i7 Bool -> Bool -> Bool
&& (a8, a8) -> a8 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a8
l8,a8
u8) a8
i8 Bool -> Bool -> Bool
&&
      (a9, a9) -> a9 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a9
l9,a9
u9) a9
i9 Bool -> Bool -> Bool
&& (aA, aA) -> aA -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (aA
lA,aA
uA) aA
iA Bool -> Bool -> Bool
&&
      (aB, aB) -> aB -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (aB
lB,aB
uB) aB
iB Bool -> Bool -> Bool
&& (aC, aC) -> aC -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (aC
lC,aC
uC) aC
iC

    -- Default method for index

instance  (Ix a1, Ix a2, Ix a3, Ix a4, Ix a5, Ix a6, Ix a7, Ix a8, Ix a9,
           Ix aA, Ix aB, Ix aC, Ix aD) =>
      Ix (a1,a2,a3,a4,a5,a6,a7,a8,a9,aA,aB,aC,aD)  where
    range :: ((a1, a2, a3, a4, a5, a6, a7, a8, a9, aA, aB, aC, aD),
 (a1, a2, a3, a4, a5, a6, a7, a8, a9, aA, aB, aC, aD))
-> [(a1, a2, a3, a4, a5, a6, a7, a8, a9, aA, aB, aC, aD)]
range ((a1
l1,a2
l2,a3
l3,a4
l4,a5
l5,a6
l6,a7
l7,a8
l8,a9
l9,aA
lA,aB
lB,aC
lC,aD
lD),
           (a1
u1,a2
u2,a3
u3,a4
u4,a5
u5,a6
u6,a7
u7,a8
u8,a9
u9,aA
uA,aB
uB,aC
uC,aD
uD)) =
      [(a1
i1,a2
i2,a3
i3,a4
i4,a5
i5,a6
i6,a7
i7,a8
i8,a9
i9,aA
iA,aB
iB,aC
iC,aD
iD) | a1
i1 <- (a1, a1) -> [a1]
forall a. Ix a => (a, a) -> [a]
range (a1
l1,a1
u1),
                                                  a2
i2 <- (a2, a2) -> [a2]
forall a. Ix a => (a, a) -> [a]
range (a2
l2,a2
u2),
                                                  a3
i3 <- (a3, a3) -> [a3]
forall a. Ix a => (a, a) -> [a]
range (a3
l3,a3
u3),
                                                  a4
i4 <- (a4, a4) -> [a4]
forall a. Ix a => (a, a) -> [a]
range (a4
l4,a4
u4),
                                                  a5
i5 <- (a5, a5) -> [a5]
forall a. Ix a => (a, a) -> [a]
range (a5
l5,a5
u5),
                                                  a6
i6 <- (a6, a6) -> [a6]
forall a. Ix a => (a, a) -> [a]
range (a6
l6,a6
u6),
                                                  a7
i7 <- (a7, a7) -> [a7]
forall a. Ix a => (a, a) -> [a]
range (a7
l7,a7
u7),
                                                  a8
i8 <- (a8, a8) -> [a8]
forall a. Ix a => (a, a) -> [a]
range (a8
l8,a8
u8),
                                                  a9
i9 <- (a9, a9) -> [a9]
forall a. Ix a => (a, a) -> [a]
range (a9
l9,a9
u9),
                                                  aA
iA <- (aA, aA) -> [aA]
forall a. Ix a => (a, a) -> [a]
range (aA
lA,aA
uA),
                                                  aB
iB <- (aB, aB) -> [aB]
forall a. Ix a => (a, a) -> [a]
range (aB
lB,aB
uB),
                                                  aC
iC <- (aC, aC) -> [aC]
forall a. Ix a => (a, a) -> [a]
range (aC
lC,aC
uC),
                                                  aD
iD <- (aD, aD) -> [aD]
forall a. Ix a => (a, a) -> [a]
range (aD
lD,aD
uD)]

    unsafeIndex :: ((a1, a2, a3, a4, a5, a6, a7, a8, a9, aA, aB, aC, aD),
 (a1, a2, a3, a4, a5, a6, a7, a8, a9, aA, aB, aC, aD))
-> (a1, a2, a3, a4, a5, a6, a7, a8, a9, aA, aB, aC, aD) -> Int
unsafeIndex ((a1
l1,a2
l2,a3
l3,a4
l4,a5
l5,a6
l6,a7
l7,a8
l8,a9
l9,aA
lA,aB
lB,aC
lC,aD
lD),
                 (a1
u1,a2
u2,a3
u3,a4
u4,a5
u5,a6
u6,a7
u7,a8
u8,a9
u9,aA
uA,aB
uB,aC
uC,aD
uD))
        (a1
i1,a2
i2,a3
i3,a4
i4,a5
i5,a6
i6,a7
i7,a8
i8,a9
i9,aA
iA,aB
iB,aC
iC,aD
iD) =
      (aD, aD) -> aD -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (aD
lD,aD
uD) aD
iD Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (aD, aD) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (aD
lD,aD
uD) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (aC, aC) -> aC -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (aC
lC,aC
uC) aC
iC Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (aC, aC) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (aC
lC,aC
uC) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (aB, aB) -> aB -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (aB
lB,aB
uB) aB
iB Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (aB, aB) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (aB
lB,aB
uB) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (aA, aA) -> aA -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (aA
lA,aA
uA) aA
iA Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (aA, aA) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (aA
lA,aA
uA) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a9, a9) -> a9 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a9
l9,a9
u9) a9
i9 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a9, a9) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a9
l9,a9
u9) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a8, a8) -> a8 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a8
l8,a8
u8) a8
i8 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a8, a8) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a8
l8,a8
u8) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a7, a7) -> a7 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a7
l7,a7
u7) a7
i7 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a7, a7) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a7
l7,a7
u7) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a6, a6) -> a6 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a6
l6,a6
u6) a6
i6 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a6, a6) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a6
l6,a6
u6) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a5, a5) -> a5 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a5
l5,a5
u5) a5
i5 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a5, a5) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a5
l5,a5
u5) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a4, a4) -> a4 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a4
l4,a4
u4) a4
i4 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a4, a4) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a4
l4,a4
u4) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a3, a3) -> a3 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a3
l3,a3
u3) a3
i3 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a3, a3) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a3
l3,a3
u3) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a2, a2) -> a2 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a2
l2,a2
u2) a2
i2 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a2, a2) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a2
l2,a2
u2) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a1, a1) -> a1 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a1
l1,a1
u1) a1
i1))))))))))))

    inRange :: ((a1, a2, a3, a4, a5, a6, a7, a8, a9, aA, aB, aC, aD),
 (a1, a2, a3, a4, a5, a6, a7, a8, a9, aA, aB, aC, aD))
-> (a1, a2, a3, a4, a5, a6, a7, a8, a9, aA, aB, aC, aD) -> Bool
inRange ((a1
l1,a2
l2,a3
l3,a4
l4,a5
l5,a6
l6,a7
l7,a8
l8,a9
l9,aA
lA,aB
lB,aC
lC,aD
lD),
             (a1
u1,a2
u2,a3
u3,a4
u4,a5
u5,a6
u6,a7
u7,a8
u8,a9
u9,aA
uA,aB
uB,aC
uC,aD
uD))
        (a1
i1,a2
i2,a3
i3,a4
i4,a5
i5,a6
i6,a7
i7,a8
i8,a9
i9,aA
iA,aB
iB,aC
iC,aD
iD) =
      (a1, a1) -> a1 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a1
l1,a1
u1) a1
i1 Bool -> Bool -> Bool
&& (a2, a2) -> a2 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a2
l2,a2
u2) a2
i2 Bool -> Bool -> Bool
&&
      (a3, a3) -> a3 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a3
l3,a3
u3) a3
i3 Bool -> Bool -> Bool
&& (a4, a4) -> a4 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a4
l4,a4
u4) a4
i4 Bool -> Bool -> Bool
&&
      (a5, a5) -> a5 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a5
l5,a5
u5) a5
i5 Bool -> Bool -> Bool
&& (a6, a6) -> a6 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a6
l6,a6
u6) a6
i6 Bool -> Bool -> Bool
&&
      (a7, a7) -> a7 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a7
l7,a7
u7) a7
i7 Bool -> Bool -> Bool
&& (a8, a8) -> a8 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a8
l8,a8
u8) a8
i8 Bool -> Bool -> Bool
&&
      (a9, a9) -> a9 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a9
l9,a9
u9) a9
i9 Bool -> Bool -> Bool
&& (aA, aA) -> aA -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (aA
lA,aA
uA) aA
iA Bool -> Bool -> Bool
&&
      (aB, aB) -> aB -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (aB
lB,aB
uB) aB
iB Bool -> Bool -> Bool
&& (aC, aC) -> aC -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (aC
lC,aC
uC) aC
iC Bool -> Bool -> Bool
&&
      (aD, aD) -> aD -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (aD
lD,aD
uD) aD
iD

    -- Default method for index

instance  (Ix a1, Ix a2, Ix a3, Ix a4, Ix a5, Ix a6, Ix a7, Ix a8, Ix a9,
           Ix aA, Ix aB, Ix aC, Ix aD, Ix aE) =>
      Ix (a1,a2,a3,a4,a5,a6,a7,a8,a9,aA,aB,aC,aD,aE)  where
    range :: ((a1, a2, a3, a4, a5, a6, a7, a8, a9, aA, aB, aC, aD, aE),
 (a1, a2, a3, a4, a5, a6, a7, a8, a9, aA, aB, aC, aD, aE))
-> [(a1, a2, a3, a4, a5, a6, a7, a8, a9, aA, aB, aC, aD, aE)]
range ((a1
l1,a2
l2,a3
l3,a4
l4,a5
l5,a6
l6,a7
l7,a8
l8,a9
l9,aA
lA,aB
lB,aC
lC,aD
lD,aE
lE),
           (a1
u1,a2
u2,a3
u3,a4
u4,a5
u5,a6
u6,a7
u7,a8
u8,a9
u9,aA
uA,aB
uB,aC
uC,aD
uD,aE
uE)) =
      [(a1
i1,a2
i2,a3
i3,a4
i4,a5
i5,a6
i6,a7
i7,a8
i8,a9
i9,aA
iA,aB
iB,aC
iC,aD
iD,aE
iE) | a1
i1 <- (a1, a1) -> [a1]
forall a. Ix a => (a, a) -> [a]
range (a1
l1,a1
u1),
                                                     a2
i2 <- (a2, a2) -> [a2]
forall a. Ix a => (a, a) -> [a]
range (a2
l2,a2
u2),
                                                     a3
i3 <- (a3, a3) -> [a3]
forall a. Ix a => (a, a) -> [a]
range (a3
l3,a3
u3),
                                                     a4
i4 <- (a4, a4) -> [a4]
forall a. Ix a => (a, a) -> [a]
range (a4
l4,a4
u4),
                                                     a5
i5 <- (a5, a5) -> [a5]
forall a. Ix a => (a, a) -> [a]
range (a5
l5,a5
u5),
                                                     a6
i6 <- (a6, a6) -> [a6]
forall a. Ix a => (a, a) -> [a]
range (a6
l6,a6
u6),
                                                     a7
i7 <- (a7, a7) -> [a7]
forall a. Ix a => (a, a) -> [a]
range (a7
l7,a7
u7),
                                                     a8
i8 <- (a8, a8) -> [a8]
forall a. Ix a => (a, a) -> [a]
range (a8
l8,a8
u8),
                                                     a9
i9 <- (a9, a9) -> [a9]
forall a. Ix a => (a, a) -> [a]
range (a9
l9,a9
u9),
                                                     aA
iA <- (aA, aA) -> [aA]
forall a. Ix a => (a, a) -> [a]
range (aA
lA,aA
uA),
                                                     aB
iB <- (aB, aB) -> [aB]
forall a. Ix a => (a, a) -> [a]
range (aB
lB,aB
uB),
                                                     aC
iC <- (aC, aC) -> [aC]
forall a. Ix a => (a, a) -> [a]
range (aC
lC,aC
uC),
                                                     aD
iD <- (aD, aD) -> [aD]
forall a. Ix a => (a, a) -> [a]
range (aD
lD,aD
uD),
                                                     aE
iE <- (aE, aE) -> [aE]
forall a. Ix a => (a, a) -> [a]
range (aE
lE,aE
uE)]

    unsafeIndex :: ((a1, a2, a3, a4, a5, a6, a7, a8, a9, aA, aB, aC, aD, aE),
 (a1, a2, a3, a4, a5, a6, a7, a8, a9, aA, aB, aC, aD, aE))
-> (a1, a2, a3, a4, a5, a6, a7, a8, a9, aA, aB, aC, aD, aE) -> Int
unsafeIndex ((a1
l1,a2
l2,a3
l3,a4
l4,a5
l5,a6
l6,a7
l7,a8
l8,a9
l9,aA
lA,aB
lB,aC
lC,aD
lD,aE
lE),
                 (a1
u1,a2
u2,a3
u3,a4
u4,a5
u5,a6
u6,a7
u7,a8
u8,a9
u9,aA
uA,aB
uB,aC
uC,aD
uD,aE
uE))
        (a1
i1,a2
i2,a3
i3,a4
i4,a5
i5,a6
i6,a7
i7,a8
i8,a9
i9,aA
iA,aB
iB,aC
iC,aD
iD,aE
iE) =
      (aE, aE) -> aE -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (aE
lE,aE
uE) aE
iE Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (aE, aE) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (aE
lE,aE
uE) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (aD, aD) -> aD -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (aD
lD,aD
uD) aD
iD Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (aD, aD) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (aD
lD,aD
uD) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (aC, aC) -> aC -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (aC
lC,aC
uC) aC
iC Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (aC, aC) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (aC
lC,aC
uC) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (aB, aB) -> aB -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (aB
lB,aB
uB) aB
iB Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (aB, aB) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (aB
lB,aB
uB) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (aA, aA) -> aA -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (aA
lA,aA
uA) aA
iA Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (aA, aA) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (aA
lA,aA
uA) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a9, a9) -> a9 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a9
l9,a9
u9) a9
i9 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a9, a9) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a9
l9,a9
u9) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a8, a8) -> a8 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a8
l8,a8
u8) a8
i8 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a8, a8) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a8
l8,a8
u8) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a7, a7) -> a7 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a7
l7,a7
u7) a7
i7 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a7, a7) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a7
l7,a7
u7) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a6, a6) -> a6 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a6
l6,a6
u6) a6
i6 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a6, a6) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a6
l6,a6
u6) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a5, a5) -> a5 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a5
l5,a5
u5) a5
i5 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a5, a5) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a5
l5,a5
u5) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a4, a4) -> a4 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a4
l4,a4
u4) a4
i4 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a4, a4) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a4
l4,a4
u4) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a3, a3) -> a3 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a3
l3,a3
u3) a3
i3 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a3, a3) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a3
l3,a3
u3) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a2, a2) -> a2 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a2
l2,a2
u2) a2
i2 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a2, a2) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a2
l2,a2
u2) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a1, a1) -> a1 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a1
l1,a1
u1) a1
i1)))))))))))))

    inRange :: ((a1, a2, a3, a4, a5, a6, a7, a8, a9, aA, aB, aC, aD, aE),
 (a1, a2, a3, a4, a5, a6, a7, a8, a9, aA, aB, aC, aD, aE))
-> (a1, a2, a3, a4, a5, a6, a7, a8, a9, aA, aB, aC, aD, aE) -> Bool
inRange ((a1
l1,a2
l2,a3
l3,a4
l4,a5
l5,a6
l6,a7
l7,a8
l8,a9
l9,aA
lA,aB
lB,aC
lC,aD
lD,aE
lE),
             (a1
u1,a2
u2,a3
u3,a4
u4,a5
u5,a6
u6,a7
u7,a8
u8,a9
u9,aA
uA,aB
uB,aC
uC,aD
uD,aE
uE))
        (a1
i1,a2
i2,a3
i3,a4
i4,a5
i5,a6
i6,a7
i7,a8
i8,a9
i9,aA
iA,aB
iB,aC
iC,aD
iD,aE
iE) =
      (a1, a1) -> a1 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a1
l1,a1
u1) a1
i1 Bool -> Bool -> Bool
&& (a2, a2) -> a2 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a2
l2,a2
u2) a2
i2 Bool -> Bool -> Bool
&&
      (a3, a3) -> a3 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a3
l3,a3
u3) a3
i3 Bool -> Bool -> Bool
&& (a4, a4) -> a4 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a4
l4,a4
u4) a4
i4 Bool -> Bool -> Bool
&&
      (a5, a5) -> a5 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a5
l5,a5
u5) a5
i5 Bool -> Bool -> Bool
&& (a6, a6) -> a6 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a6
l6,a6
u6) a6
i6 Bool -> Bool -> Bool
&&
      (a7, a7) -> a7 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a7
l7,a7
u7) a7
i7 Bool -> Bool -> Bool
&& (a8, a8) -> a8 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a8
l8,a8
u8) a8
i8 Bool -> Bool -> Bool
&&
      (a9, a9) -> a9 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a9
l9,a9
u9) a9
i9 Bool -> Bool -> Bool
&& (aA, aA) -> aA -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (aA
lA,aA
uA) aA
iA Bool -> Bool -> Bool
&&
      (aB, aB) -> aB -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (aB
lB,aB
uB) aB
iB Bool -> Bool -> Bool
&& (aC, aC) -> aC -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (aC
lC,aC
uC) aC
iC Bool -> Bool -> Bool
&&
      (aD, aD) -> aD -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (aD
lD,aD
uD) aD
iD Bool -> Bool -> Bool
&& (aE, aE) -> aE -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (aE
lE,aE
uE) aE
iE

    -- Default method for index

instance  (Ix a1, Ix a2, Ix a3, Ix a4, Ix a5, Ix a6, Ix a7, Ix a8, Ix a9,
           Ix aA, Ix aB, Ix aC, Ix aD, Ix aE, Ix aF) =>
      Ix (a1,a2,a3,a4,a5,a6,a7,a8,a9,aA,aB,aC,aD,aE,aF)  where
    range :: ((a1, a2, a3, a4, a5, a6, a7, a8, a9, aA, aB, aC, aD, aE, aF),
 (a1, a2, a3, a4, a5, a6, a7, a8, a9, aA, aB, aC, aD, aE, aF))
-> [(a1, a2, a3, a4, a5, a6, a7, a8, a9, aA, aB, aC, aD, aE, aF)]
range ((a1
l1,a2
l2,a3
l3,a4
l4,a5
l5,a6
l6,a7
l7,a8
l8,a9
l9,aA
lA,aB
lB,aC
lC,aD
lD,aE
lE,aF
lF),
           (a1
u1,a2
u2,a3
u3,a4
u4,a5
u5,a6
u6,a7
u7,a8
u8,a9
u9,aA
uA,aB
uB,aC
uC,aD
uD,aE
uE,aF
uF)) =
      [(a1
i1,a2
i2,a3
i3,a4
i4,a5
i5,a6
i6,a7
i7,a8
i8,a9
i9,aA
iA,aB
iB,aC
iC,aD
iD,aE
iE,aF
iF) | a1
i1 <- (a1, a1) -> [a1]
forall a. Ix a => (a, a) -> [a]
range (a1
l1,a1
u1),
                                                        a2
i2 <- (a2, a2) -> [a2]
forall a. Ix a => (a, a) -> [a]
range (a2
l2,a2
u2),
                                                        a3
i3 <- (a3, a3) -> [a3]
forall a. Ix a => (a, a) -> [a]
range (a3
l3,a3
u3),
                                                        a4
i4 <- (a4, a4) -> [a4]
forall a. Ix a => (a, a) -> [a]
range (a4
l4,a4
u4),
                                                        a5
i5 <- (a5, a5) -> [a5]
forall a. Ix a => (a, a) -> [a]
range (a5
l5,a5
u5),
                                                        a6
i6 <- (a6, a6) -> [a6]
forall a. Ix a => (a, a) -> [a]
range (a6
l6,a6
u6),
                                                        a7
i7 <- (a7, a7) -> [a7]
forall a. Ix a => (a, a) -> [a]
range (a7
l7,a7
u7),
                                                        a8
i8 <- (a8, a8) -> [a8]
forall a. Ix a => (a, a) -> [a]
range (a8
l8,a8
u8),
                                                        a9
i9 <- (a9, a9) -> [a9]
forall a. Ix a => (a, a) -> [a]
range (a9
l9,a9
u9),
                                                        aA
iA <- (aA, aA) -> [aA]
forall a. Ix a => (a, a) -> [a]
range (aA
lA,aA
uA),
                                                        aB
iB <- (aB, aB) -> [aB]
forall a. Ix a => (a, a) -> [a]
range (aB
lB,aB
uB),
                                                        aC
iC <- (aC, aC) -> [aC]
forall a. Ix a => (a, a) -> [a]
range (aC
lC,aC
uC),
                                                        aD
iD <- (aD, aD) -> [aD]
forall a. Ix a => (a, a) -> [a]
range (aD
lD,aD
uD),
                                                        aE
iE <- (aE, aE) -> [aE]
forall a. Ix a => (a, a) -> [a]
range (aE
lE,aE
uE),
                                                        aF
iF <- (aF, aF) -> [aF]
forall a. Ix a => (a, a) -> [a]
range (aF
lF,aF
uF)]

    unsafeIndex :: ((a1, a2, a3, a4, a5, a6, a7, a8, a9, aA, aB, aC, aD, aE, aF),
 (a1, a2, a3, a4, a5, a6, a7, a8, a9, aA, aB, aC, aD, aE, aF))
-> (a1, a2, a3, a4, a5, a6, a7, a8, a9, aA, aB, aC, aD, aE, aF)
-> Int
unsafeIndex ((a1
l1,a2
l2,a3
l3,a4
l4,a5
l5,a6
l6,a7
l7,a8
l8,a9
l9,aA
lA,aB
lB,aC
lC,aD
lD,aE
lE,aF
lF),
                 (a1
u1,a2
u2,a3
u3,a4
u4,a5
u5,a6
u6,a7
u7,a8
u8,a9
u9,aA
uA,aB
uB,aC
uC,aD
uD,aE
uE,aF
uF))
        (a1
i1,a2
i2,a3
i3,a4
i4,a5
i5,a6
i6,a7
i7,a8
i8,a9
i9,aA
iA,aB
iB,aC
iC,aD
iD,aE
iE,aF
iF) =
      (aF, aF) -> aF -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (aF
lF,aF
uF) aF
iF Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (aF, aF) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (aF
lF,aF
uF) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (aE, aE) -> aE -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (aE
lE,aE
uE) aE
iE Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (aE, aE) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (aE
lE,aE
uE) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (aD, aD) -> aD -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (aD
lD,aD
uD) aD
iD Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (aD, aD) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (aD
lD,aD
uD) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (aC, aC) -> aC -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (aC
lC,aC
uC) aC
iC Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (aC, aC) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (aC
lC,aC
uC) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (aB, aB) -> aB -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (aB
lB,aB
uB) aB
iB Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (aB, aB) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (aB
lB,aB
uB) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (aA, aA) -> aA -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (aA
lA,aA
uA) aA
iA Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (aA, aA) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (aA
lA,aA
uA) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a9, a9) -> a9 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a9
l9,a9
u9) a9
i9 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a9, a9) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a9
l9,a9
u9) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a8, a8) -> a8 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a8
l8,a8
u8) a8
i8 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a8, a8) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a8
l8,a8
u8) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a7, a7) -> a7 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a7
l7,a7
u7) a7
i7 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a7, a7) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a7
l7,a7
u7) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a6, a6) -> a6 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a6
l6,a6
u6) a6
i6 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a6, a6) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a6
l6,a6
u6) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a5, a5) -> a5 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a5
l5,a5
u5) a5
i5 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a5, a5) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a5
l5,a5
u5) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a4, a4) -> a4 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a4
l4,a4
u4) a4
i4 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a4, a4) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a4
l4,a4
u4) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a3, a3) -> a3 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a3
l3,a3
u3) a3
i3 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a3, a3) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a3
l3,a3
u3) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a2, a2) -> a2 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a2
l2,a2
u2) a2
i2 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a2, a2) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a2
l2,a2
u2) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
      (a1, a1) -> a1 -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a1
l1,a1
u1) a1
i1))))))))))))))

    inRange :: ((a1, a2, a3, a4, a5, a6, a7, a8, a9, aA, aB, aC, aD, aE, aF),
 (a1, a2, a3, a4, a5, a6, a7, a8, a9, aA, aB, aC, aD, aE, aF))
-> (a1, a2, a3, a4, a5, a6, a7, a8, a9, aA, aB, aC, aD, aE, aF)
-> Bool
inRange ((a1
l1,a2
l2,a3
l3,a4
l4,a5
l5,a6
l6,a7
l7,a8
l8,a9
l9,aA
lA,aB
lB,aC
lC,aD
lD,aE
lE,aF
lF),
             (a1
u1,a2
u2,a3
u3,a4
u4,a5
u5,a6
u6,a7
u7,a8
u8,a9
u9,aA
uA,aB
uB,aC
uC,aD
uD,aE
uE,aF
uF))
        (a1
i1,a2
i2,a3
i3,a4
i4,a5
i5,a6
i6,a7
i7,a8
i8,a9
i9,aA
iA,aB
iB,aC
iC,aD
iD,aE
iE,aF
iF) =
      (a1, a1) -> a1 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a1
l1,a1
u1) a1
i1 Bool -> Bool -> Bool
&& (a2, a2) -> a2 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a2
l2,a2
u2) a2
i2 Bool -> Bool -> Bool
&&
      (a3, a3) -> a3 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a3
l3,a3
u3) a3
i3 Bool -> Bool -> Bool
&& (a4, a4) -> a4 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a4
l4,a4
u4) a4
i4 Bool -> Bool -> Bool
&&
      (a5, a5) -> a5 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a5
l5,a5
u5) a5
i5 Bool -> Bool -> Bool
&& (a6, a6) -> a6 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a6
l6,a6
u6) a6
i6 Bool -> Bool -> Bool
&&
      (a7, a7) -> a7 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a7
l7,a7
u7) a7
i7 Bool -> Bool -> Bool
&& (a8, a8) -> a8 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a8
l8,a8
u8) a8
i8 Bool -> Bool -> Bool
&&
      (a9, a9) -> a9 -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a9
l9,a9
u9) a9
i9 Bool -> Bool -> Bool
&& (aA, aA) -> aA -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (aA
lA,aA
uA) aA
iA Bool -> Bool -> Bool
&&
      (aB, aB) -> aB -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (aB
lB,aB
uB) aB
iB Bool -> Bool -> Bool
&& (aC, aC) -> aC -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (aC
lC,aC
uC) aC
iC Bool -> Bool -> Bool
&&
      (aD, aD) -> aD -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (aD
lD,aD
uD) aD
iD Bool -> Bool -> Bool
&& (aE, aE) -> aE -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (aE
lE,aE
uE) aE
iE Bool -> Bool -> Bool
&&
      (aF, aF) -> aF -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (aF
lF,aF
uF) aF
iF

    -- Default method for index

# if MIN_VERSION_base(4,4,0)
instance MonadZip Complex where
  mzipWith :: (a -> b -> c) -> Complex a -> Complex b -> Complex c
mzipWith = (a -> b -> c) -> Complex a -> Complex b -> Complex c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2

instance MonadFix Complex where
  mfix :: (a -> Complex a) -> Complex a
mfix a -> Complex a
f = (let a
a :+ a
_ = a -> Complex a
f a
a in a
a) a -> a -> Complex a
forall a. a -> a -> Complex a
:+ (let a
_ :+ a
a = a -> Complex a
f a
a in a
a)
# endif
#endif

#if __GLASGOW_HASKELL__ < 710
deriving instance Typeable  All
deriving instance Typeable  AnnotationWrapper
deriving instance Typeable  Monoid.Any
deriving instance Typeable1 ArgDescr
deriving instance Typeable1 ArgOrder
deriving instance Typeable  BlockReason
deriving instance Typeable1 Buffer
deriving instance Typeable3 BufferCodec
deriving instance Typeable1 BufferList
deriving instance Typeable  BufferMode
deriving instance Typeable  BufferState
deriving instance Typeable  CFile
deriving instance Typeable  CFpos
deriving instance Typeable  CJmpBuf
deriving instance Typeable2 Const
deriving instance Typeable  Constr
deriving instance Typeable  ConstrRep
deriving instance Typeable  DataRep
deriving instance Typeable  DataType
deriving instance Typeable1 Down
deriving instance Typeable1 Dual
deriving instance Typeable1 Endo
deriving instance Typeable  Errno
deriving instance Typeable1 First
deriving instance Typeable  Data.Fixity
deriving instance Typeable  GeneralCategory
deriving instance Typeable  HandlePosn
deriving instance Typeable1 Exception.Handler
deriving instance Typeable  HandleType
deriving instance Typeable  IODeviceType
deriving instance Typeable  IOErrorType
deriving instance Typeable  IOMode
deriving instance Typeable1 Last
deriving instance Typeable  Lexeme
deriving instance Typeable  Newline
deriving instance Typeable  NewlineMode
deriving instance Typeable  Opaque
deriving instance Typeable1 OptDescr
deriving instance Typeable  Pool
deriving instance Typeable1 Product
deriving instance Typeable1 ReadP
deriving instance Typeable1 ReadPrec
deriving instance Typeable  SeekMode
deriving instance Typeable2 Lazy.ST
deriving instance Typeable2 STret
deriving instance Typeable1 Sum
deriving instance Typeable  TextEncoding
deriving instance Typeable  ThreadStatus
deriving instance Typeable1 ZipList

# if defined(mingw32_HOST_OS)
deriving instance Typeable  CodePageArrays
deriving instance Typeable2 CompactArray
deriving instance Typeable1 ConvArray
deriving instance Typeable  Console.Handler
# endif

# if MIN_VERSION_base(4,3,0)
deriving instance Typeable  MaskingState
# endif

# if MIN_VERSION_base(4,4,0)
deriving instance Typeable  CodingFailureMode
deriving instance Typeable  CodingProgress
deriving instance Typeable  Fingerprint

#  if !defined(mingw32_HOST_OS) && !defined(__GHCJS__)
deriving instance Typeable  Event
deriving instance Typeable  EventManager
deriving instance Typeable  FdKey
deriving instance Typeable  TimeoutKey
#  endif
# endif

# if __GLASGOW_HASKELL__ >= 701
deriving instance Typeable  Arity
deriving instance Typeable  Associativity
deriving instance Typeable  C
deriving instance Typeable  D
deriving instance Typeable  Generics.Fixity
deriving instance Typeable3 K1
deriving instance Typeable  NoSelector
deriving instance Typeable  P
deriving instance Typeable1 Par1
deriving instance Typeable  R
deriving instance Typeable  S
deriving instance Typeable1 U1
deriving instance Typeable1 V1

#  if __GLASGOW_HASKELL__ >= 708
-- Data types which use poly-kinded Typeable...