    {-# LANGUAGE BangPatterns #-}
    {-# LANGUAGE CPP #-}
    {-# LANGUAGE DataKinds #-}
    {-# LANGUAGE DeriveDataTypeable #-}
    {-# LANGUAGE DeriveFoldable #-}
    {-# LANGUAGE DeriveFunctor #-}
    {-# LANGUAGE DeriveTraversable #-}
    {-# LANGUAGE FlexibleContexts #-}
    {-# LANGUAGE FlexibleInstances #-}
    {-# LANGUAGE GeneralizedNewtypeDeriving #-}
    {-# LANGUAGE KindSignatures #-}
    {-# LANGUAGE PolyKinds #-}
    {-# LANGUAGE ScopedTypeVariables #-}
    {-# LANGUAGE StandaloneDeriving #-}
    {-# LANGUAGE Trustworthy #-}
    {-# LANGUAGE TypeFamilies #-}
    {-# LANGUAGE TypeOperators #-}
    {-# LANGUAGE UndecidableInstances #-}

    #if __GLASGOW_HASKELL__ < 806
    {-# LANGUAGE TypeInType #-}
    #endif

    {-# OPTIONS_GHC -Wno-deprecations #-}
    {-# OPTIONS_GHC -Wno-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 !(MIN_VERSION_base(4,11,0))
    import qualified Control.Monad.Fail as Fail (MonadFail(..))
    #endif

    #if !(MIN_VERSION_base(4,16,0))
    import qualified Data.Functor.Product as Functor
    #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,11,0) && !(MIN_VERSION_base(4,21,0))
    import           GHC.Read (readField)
    #endif

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

    #if MIN_VERSION_base(4,15,0) && !(MIN_VERSION_base(4,16,0))
    import           GHC.Tuple (Solo(..))
    #endif

    #if !(MIN_VERSION_base(4,21,0))
    import           Data.Orphans.Prelude
    import           GHC.Generics as Generics hiding (prec)
    #endif

    #include "HsBaseConfig.h"

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

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

    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

    #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

    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 (<>)

    # 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
    instance MonadZip Down where
        mzipWith = liftM2
    instance Eq1 Down where
        liftEq eq (Down x) (Down y) = eq x y
    instance Ord1 Down where
        liftCompare comp (Down x) (Down y) = case comp x y of
            LT -> GT
            EQ -> EQ
            GT -> LT
    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

    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)

    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)

    deriving instance Foldable f => Foldable (Alt f)
    deriving instance Traversable f => Traversable (Alt f)
    #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)

    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)

    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 (>>=) #-}

    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 #-}

    -- | Swaps @'minBound'@ and @'maxBound'@ of the underlying type.
    instance Bounded a => Bounded (Down a) where
        minBound = Down maxBound
        maxBound = Down minBound

    deriving instance Bits       a => Bits       (Down a)
    deriving instance Floating   a => Floating   (Down a)
    deriving instance Fractional a => Fractional (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)
    deriving instance FiniteBits a => FiniteBits (Down a)

    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)

    instance IsList (ZipList a) where
      type Item (ZipList a) = a
      fromList = ZipList
      toList = getZipList

    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

    #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 ((l1,l2,l3,l4,l5,l6),(u1,u2,u3,u4,u5,u6)) =
          [(i1,i2,i3,i4,i5,i6) | i1 <- range (l1,u1),
                                 i2 <- range (l2,u2),
                                 i3 <- range (l3,u3),
                                 i4 <- range (l4,u4),
                                 i5 <- range (l5,u5),
                                 i6 <- range (l6,u6)]

        unsafeIndex ((l1,l2,l3,l4,l5,l6),(u1,u2,u3,u4,u5,u6)) (i1,i2,i3,i4,i5,i6) =
          unsafeIndex (l6,u6) i6 + unsafeRangeSize (l6,u6) * (
          unsafeIndex (l5,u5) i5 + unsafeRangeSize (l5,u5) * (
          unsafeIndex (l4,u4) i4 + unsafeRangeSize (l4,u4) * (
          unsafeIndex (l3,u3) i3 + unsafeRangeSize (l3,u3) * (
          unsafeIndex (l2,u2) i2 + unsafeRangeSize (l2,u2) * (
          unsafeIndex (l1,u1) i1)))))

        inRange ((l1,l2,l3,l4,l5,l6),(u1,u2,u3,u4,u5,u6)) (i1,i2,i3,i4,i5,i6) =
          inRange (l1,u1) i1 && inRange (l2,u2) i2 &&
          inRange (l3,u3) i3 && inRange (l4,u4) i4 &&
          inRange (l5,u5) i5 && inRange (l6,u6) 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 ((l1,l2,l3,l4,l5,l6,l7),(u1,u2,u3,u4,u5,u6,u7)) =
          [(i1,i2,i3,i4,i5,i6,i7) | i1 <- range (l1,u1),
                                    i2 <- range (l2,u2),
                                    i3 <- range (l3,u3),
                                    i4 <- range (l4,u4),
                                    i5 <- range (l5,u5),
                                    i6 <- range (l6,u6),
                                    i7 <- range (l7,u7)]

        unsafeIndex ((l1,l2,l3,l4,l5,l6,l7),(u1,u2,u3,u4,u5,u6,u7))
            (i1,i2,i3,i4,i5,i6,i7) =
          unsafeIndex (l7,u7) i7 + unsafeRangeSize (l7,u7) * (
          unsafeIndex (l6,u6) i6 + unsafeRangeSize (l6,u6) * (
          unsafeIndex (l5,u5) i5 + unsafeRangeSize (l5,u5) * (
          unsafeIndex (l4,u4) i4 + unsafeRangeSize (l4,u4) * (
          unsafeIndex (l3,u3) i3 + unsafeRangeSize (l3,u3) * (
          unsafeIndex (l2,u2) i2 + unsafeRangeSize (l2,u2) * (
          unsafeIndex (l1,u1) i1))))))

        inRange ((l1,l2,l3,l4,l5,l6,l7),(u1,u2,u3,u4,u5,u6,u7))
            (i1,i2,i3,i4,i5,i6,i7) =
          inRange (l1,u1) i1 && inRange (l2,u2) i2 &&
          inRange (l3,u3) i3 && inRange (l4,u4) i4 &&
          inRange (l5,u5) i5 && inRange (l6,u6) i6 &&
          inRange (l7,u7) 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 ((l1,l2,l3,l4,l5,l6,l7,l8),(u1,u2,u3,u4,u5,u6,u7,u8)) =
          [(i1,i2,i3,i4,i5,i6,i7,i8) | i1 <- range (l1,u1),
                                       i2 <- range (l2,u2),
                                       i3 <- range (l3,u3),
                                       i4 <- range (l4,u4),
                                       i5 <- range (l5,u5),
                                       i6 <- range (l6,u6),
                                       i7 <- range (l7,u7),
                                       i8 <- range (l8,u8)]

        unsafeIndex ((l1,l2,l3,l4,l5,l6,l7,l8),(u1,u2,u3,u4,u5,u6,u7,u8))
            (i1,i2,i3,i4,i5,i6,i7,i8) =
          unsafeIndex (l8,u8) i8 + unsafeRangeSize (l8,u8) * (
          unsafeIndex (l7,u7) i7 + unsafeRangeSize (l7,u7) * (
          unsafeIndex (l6,u6) i6 + unsafeRangeSize (l6,u6) * (
          unsafeIndex (l5,u5) i5 + unsafeRangeSize (l5,u5) * (
          unsafeIndex (l4,u4) i4 + unsafeRangeSize (l4,u4) * (
          unsafeIndex (l3,u3) i3 + unsafeRangeSize (l3,u3) * (
          unsafeIndex (l2,u2) i2 + unsafeRangeSize (l2,u2) * (
          unsafeIndex (l1,u1) i1)))))))

        inRange ((l1,l2,l3,l4,l5,l6,l7,l8),(u1,u2,u3,u4,u5,u6,u7,u8))
            (i1,i2,i3,i4,i5,i6,i7,i8) =
          inRange (l1,u1) i1 && inRange (l2,u2) i2 &&
          inRange (l3,u3) i3 && inRange (l4,u4) i4 &&
          inRange (l5,u5) i5 && inRange (l6,u6) i6 &&
          inRange (l7,u7) i7 && inRange (l8,u8) 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 ((l1,l2,l3,l4,l5,l6,l7,l8,l9),(u1,u2,u3,u4,u5,u6,u7,u8,u9)) =
          [(i1,i2,i3,i4,i5,i6,i7,i8,i9) | i1 <- range (l1,u1),
                                          i2 <- range (l2,u2),
                                          i3 <- range (l3,u3),
                                          i4 <- range (l4,u4),
                                          i5 <- range (l5,u5),
                                          i6 <- range (l6,u6),
                                          i7 <- range (l7,u7),
                                          i8 <- range (l8,u8),
                                          i9 <- range (l9,u9)]

        unsafeIndex ((l1,l2,l3,l4,l5,l6,l7,l8,l9),(u1,u2,u3,u4,u5,u6,u7,u8,u9))
            (i1,i2,i3,i4,i5,i6,i7,i8,i9) =
          unsafeIndex (l9,u9) i9 + unsafeRangeSize (l9,u9) * (
          unsafeIndex (l8,u8) i8 + unsafeRangeSize (l8,u8) * (
          unsafeIndex (l7,u7) i7 + unsafeRangeSize (l7,u7) * (
          unsafeIndex (l6,u6) i6 + unsafeRangeSize (l6,u6) * (
          unsafeIndex (l5,u5) i5 + unsafeRangeSize (l5,u5) * (
          unsafeIndex (l4,u4) i4 + unsafeRangeSize (l4,u4) * (
          unsafeIndex (l3,u3) i3 + unsafeRangeSize (l3,u3) * (
          unsafeIndex (l2,u2) i2 + unsafeRangeSize (l2,u2) * (
          unsafeIndex (l1,u1) i1))))))))

        inRange ((l1,l2,l3,l4,l5,l6,l7,l8,l9),(u1,u2,u3,u4,u5,u6,u7,u8,u9))
            (i1,i2,i3,i4,i5,i6,i7,i8,i9) =
          inRange (l1,u1) i1 && inRange (l2,u2) i2 &&
          inRange (l3,u3) i3 && inRange (l4,u4) i4 &&
          inRange (l5,u5) i5 && inRange (l6,u6) i6 &&
          inRange (l7,u7) i7 && inRange (l8,u8) i8 &&
          inRange (l9,u9) 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 ((l1,l2,l3,l4,l5,l6,l7,l8,l9,lA),(u1,u2,u3,u4,u5,u6,u7,u8,u9,uA)) =
          [(i1,i2,i3,i4,i5,i6,i7,i8,i9,iA) | i1 <- range (l1,u1),
                                             i2 <- range (l2,u2),
                                             i3 <- range (l3,u3),
                                             i4 <- range (l4,u4),
                                             i5 <- range (l5,u5),
                                             i6 <- range (l6,u6),
                                             i7 <- range (l7,u7),
                                             i8 <- range (l8,u8),
                                             i9 <- range (l9,u9),
                                             iA <- range (lA,uA)]

        unsafeIndex ((l1,l2,l3,l4,l5,l6,l7,l8,l9,lA),
                     (u1,u2,u3,u4,u5,u6,u7,u8,u9,uA))
            (i1,i2,i3,i4,i5,i6,i7,i8,i9,iA) =
          unsafeIndex (lA,uA) iA + unsafeRangeSize (lA,uA) * (
          unsafeIndex (l9,u9) i9 + unsafeRangeSize (l9,u9) * (
          unsafeIndex (l8,u8) i8 + unsafeRangeSize (l8,u8) * (
          unsafeIndex (l7,u7) i7 + unsafeRangeSize (l7,u7) * (
          unsafeIndex (l6,u6) i6 + unsafeRangeSize (l6,u6) * (
          unsafeIndex (l5,u5) i5 + unsafeRangeSize (l5,u5) * (
          unsafeIndex (l4,u4) i4 + unsafeRangeSize (l4,u4) * (
          unsafeIndex (l3,u3) i3 + unsafeRangeSize (l3,u3) * (
          unsafeIndex (l2,u2) i2 + unsafeRangeSize (l2,u2) * (
          unsafeIndex (l1,u1) i1)))))))))

        inRange ((l1,l2,l3,l4,l5,l6,l7,l8,l9,lA),(u1,u2,u3,u4,u5,u6,u7,u8,u9,uA))
            (i1,i2,i3,i4,i5,i6,i7,i8,i9,iA) =
          inRange (l1,u1) i1 && inRange (l2,u2) i2 &&
          inRange (l3,u3) i3 && inRange (l4,u4) i4 &&
          inRange (l5,u5) i5 && inRange (l6,u6) i6 &&
          inRange (l7,u7) i7 && inRange (l8,u8) i8 &&
          inRange (l9,u9) i9 && inRange (lA,uA) 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 ((l1,l2,l3,l4,l5,l6,l7,l8,l9,lA,lB),
               (u1,u2,u3,u4,u5,u6,u7,u8,u9,uA,uB)) =
          [(i1,i2,i3,i4,i5,i6,i7,i8,i9,iA,iB) | i1 <- range (l1,u1),
                                                i2 <- range (l2,u2),
                                                i3 <- range (l3,u3),
                                                i4 <- range (l4,u4),
                                                i5 <- range (l5,u5),
                                                i6 <- range (l6,u6),
                                                i7 <- range (l7,u7),
                                                i8 <- range (l8,u8),
                                                i9 <- range (l9,u9),
                                                iA <- range (lA,uA),
                                                iB <- range (lB,uB)]

        unsafeIndex ((l1,l2,l3,l4,l5,l6,l7,l8,l9,lA,lB),
                     (u1,u2,u3,u4,u5,u6,u7,u8,u9,uA,uB))
            (i1,i2,i3,i4,i5,i6,i7,i8,i9,iA,iB) =
          unsafeIndex (lB,uB) iB + unsafeRangeSize (lB,uB) * (
          unsafeIndex (lA,uA) iA + unsafeRangeSize (lA,uA) * (
          unsafeIndex (l9,u9) i9 + unsafeRangeSize (l9,u9) * (
          unsafeIndex (l8,u8) i8 + unsafeRangeSize (l8,u8) * (
          unsafeIndex (l7,u7) i7 + unsafeRangeSize (l7,u7) * (
          unsafeIndex (l6,u6) i6 + unsafeRangeSize (l6,u6) * (
          unsafeIndex (l5,u5) i5 + unsafeRangeSize (l5,u5) * (
          unsafeIndex (l4,u4) i4 + unsafeRangeSize (l4,u4) * (
          unsafeIndex (l3,u3) i3 + unsafeRangeSize (l3,u3) * (
          unsafeIndex (l2,u2) i2 + unsafeRangeSize (l2,u2) * (
          unsafeIndex (l1,u1) i1))))))))))

        inRange ((l1,l2,l3,l4,l5,l6,l7,l8,l9,lA,lB),
                 (u1,u2,u3,u4,u5,u6,u7,u8,u9,uA,uB))
            (i1,i2,i3,i4,i5,i6,i7,i8,i9,iA,iB) =
          inRange (l1,u1) i1 && inRange (l2,u2) i2 &&
          inRange (l3,u3) i3 && inRange (l4,u4) i4 &&
          inRange (l5,u5) i5 && inRange (l6,u6) i6 &&
          inRange (l7,u7) i7 && inRange (l8,u8) i8 &&
          inRange (l9,u9) i9 && inRange (lA,uA) iA &&
          inRange (lB,uB) 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 ((l1,l2,l3,l4,l5,l6,l7,l8,l9,lA,lB,lC),
               (u1,u2,u3,u4,u5,u6,u7,u8,u9,uA,uB,uC)) =
          [(i1,i2,i3,i4,i5,i6,i7,i8,i9,iA,iB,iC) | i1 <- range (l1,u1),
                                                   i2 <- range (l2,u2),
                                                   i3 <- range (l3,u3),
                                                   i4 <- range (l4,u4),
                                                   i5 <- range (l5,u5),
                                                   i6 <- range (l6,u6),
                                                   i7 <- range (l7,u7),
                                                   i8 <- range (l8,u8),
                                                   i9 <- range (l9,u9),
                                                   iA <- range (lA,uA),
                                                   iB <- range (lB,uB),
                                                   iC <- range (lC,uC)]

        unsafeIndex ((l1,l2,l3,l4,l5,l6,l7,l8,l9,lA,lB,lC),
                     (u1,u2,u3,u4,u5,u6,u7,u8,u9,uA,uB,uC))
            (i1,i2,i3,i4,i5,i6,i7,i8,i9,iA,iB,iC) =
          unsafeIndex (lC,uC) iC + unsafeRangeSize (lC,uC) * (
          unsafeIndex (lB,uB) iB + unsafeRangeSize (lB,uB) * (
          unsafeIndex (lA,uA) iA + unsafeRangeSize (lA,uA) * (
          unsafeIndex (l9,u9) i9 + unsafeRangeSize (l9,u9) * (
          unsafeIndex (l8,u8) i8 + unsafeRangeSize (l8,u8) * (
          unsafeIndex (l7,u7) i7 + unsafeRangeSize (l7,u7) * (
          unsafeIndex (l6,u6) i6 + unsafeRangeSize (l6,u6) * (
          unsafeIndex (l5,u5) i5 + unsafeRangeSize (l5,u5) * (
          unsafeIndex (l4,u4) i4 + unsafeRangeSize (l4,u4) * (
          unsafeIndex (l3,u3) i3 + unsafeRangeSize (l3,u3) * (
          unsafeIndex (l2,u2) i2 + unsafeRangeSize (l2,u2) * (
          unsafeIndex (l1,u1) i1)))))))))))

        inRange ((l1,l2,l3,l4,l5,l6,l7,l8,l9,lA,lB,lC),
                 (u1,u2,u3,u4,u5,u6,u7,u8,u9,uA,uB,uC))
            (i1,i2,i3,i4,i5,i6,i7,i8,i9,iA,iB,iC) =
          inRange (l1,u1) i1 && inRange (l2,u2) i2 &&
          inRange (l3,u3) i3 && inRange (l4,u4) i4 &&
          inRange (l5,u5) i5 && inRange (l6,u6) i6 &&
          inRange (l7,u7) i7 && inRange (l8,u8) i8 &&
          inRange (l9,u9) i9 && inRange (lA,uA) iA &&
          inRange (lB,uB) iB && inRange (lC,uC) 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 ((l1,l2,l3,l4,l5,l6,l7,l8,l9,lA,lB,lC,lD),
               (u1,u2,u3,u4,u5,u6,u7,u8,u9,uA,uB,uC,uD)) =
          [(i1,i2,i3,i4,i5,i6,i7,i8,i9,iA,iB,iC,iD) | i1 <- range (l1,u1),
                                                      i2 <- range (l2,u2),
                                                      i3 <- range (l3,u3),
                                                      i4 <- range (l4,u4),
                                                      i5 <- range (l5,u5),
                                                      i6 <- range (l6,u6),
                                                      i7 <- range (l7,u7),
                                                      i8 <- range (l8,u8),
                                                      i9 <- range (l9,u9),
                                                      iA <- range (lA,uA),
                                                      iB <- range (lB,uB),
                                                      iC <- range (lC,uC),
                                                      iD <- range (lD,uD)]

        unsafeIndex ((l1,l2,l3,l4,l5,l6,l7,l8,l9,lA,lB,lC,lD),
                     (u1,u2,u3,u4,u5,u6,u7,u8,u9,uA,uB,uC,uD))
            (i1,i2,i3,i4,i5,i6,i7,i8,i9,iA,iB,iC,iD) =
          unsafeIndex (lD,uD) iD + unsafeRangeSize (lD,uD) * (
          unsafeIndex (lC,uC) iC + unsafeRangeSize (lC,uC) * (
          unsafeIndex (lB,uB) iB + unsafeRangeSize (lB,uB) * (
          unsafeIndex (lA,uA) iA + unsafeRangeSize (lA,uA) * (
          unsafeIndex (l9,u9) i9 + unsafeRangeSize (l9,u9) * (
          unsafeIndex (l8,u8) i8 + unsafeRangeSize (l8,u8) * (
          unsafeIndex (l7,u7) i7 + unsafeRangeSize (l7,u7) * (
          unsafeIndex (l6,u6) i6 + unsafeRangeSize (l6,u6) * (
          unsafeIndex (l5,u5) i5 + unsafeRangeSize (l5,u5) * (
          unsafeIndex (l4,u4) i4 + unsafeRangeSize (l4,u4) * (
          unsafeIndex (l3,u3) i3 + unsafeRangeSize (l3,u3) * (
          unsafeIndex (l2,u2) i2 + unsafeRangeSize (l2,u2) * (
          unsafeIndex (l1,u1) i1))))))))))))

        inRange ((l1,l2,l3,l4,l5,l6,l7,l8,l9,lA,lB,lC,lD),
                 (u1,u2,u3,u4,u5,u6,u7,u8,u9,uA,uB,uC,uD))
            (i1,i2,i3,i4,i5,i6,i7,i8,i9,iA,iB,iC,iD) =
          inRange (l1,u1) i1 && inRange (l2,u2) i2 &&
          inRange (l3,u3) i3 && inRange (l4,u4) i4 &&
          inRange (l5,u5) i5 && inRange (l6,u6) i6 &&
          inRange (l7,u7) i7 && inRange (l8,u8) i8 &&
          inRange (l9,u9) i9 && inRange (lA,uA) iA &&
          inRange (lB,uB) iB && inRange (lC,uC) iC &&
          inRange (lD,uD) 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 ((l1,l2,l3,l4,l5,l6,l7,l8,l9,lA,lB,lC,lD,lE),
               (u1,u2,u3,u4,u5,u6,u7,u8,u9,uA,uB,uC,uD,uE)) =
          [(i1,i2,i3,i4,i5,i6,i7,i8,i9,iA,iB,iC,iD,iE) | i1 <- range (l1,u1),
                                                         i2 <- range (l2,u2),
                                                         i3 <- range (l3,u3),
                                                         i4 <- range (l4,u4),
                                                         i5 <- range (l5,u5),
                                                         i6 <- range (l6,u6),
                                                         i7 <- range (l7,u7),
                                                         i8 <- range (l8,u8),
                                                         i9 <- range (l9,u9),
                                                         iA <- range (lA,uA),
                                                         iB <- range (lB,uB),
                                                         iC <- range (lC,uC),
                                                         iD <- range (lD,uD),
                                                         iE <- range (lE,uE)]

        unsafeIndex ((l1,l2,l3,l4,l5,l6,l7,l8,l9,lA,lB,lC,lD,lE),
                     (u1,u2,u3,u4,u5,u6,u7,u8,u9,uA,uB,uC,uD,uE))
            (i1,i2,i3,i4,i5,i6,i7,i8,i9,iA,iB,iC,iD,iE) =
          unsafeIndex (lE,uE) iE + unsafeRangeSize (lE,uE) * (
          unsafeIndex (lD,uD) iD + unsafeRangeSize (lD,uD) * (
          unsafeIndex (lC,uC) iC + unsafeRangeSize (lC,uC) * (
          unsafeIndex (lB,uB) iB + unsafeRangeSize (lB,uB) * (
          unsafeIndex (lA,uA) iA + unsafeRangeSize (lA,uA) * (
          unsafeIndex (l9,u9) i9 + unsafeRangeSize (l9,u9) * (
          unsafeIndex (l8,u8) i8 + unsafeRangeSize (l8,u8) * (
          unsafeIndex (l7,u7) i7 + unsafeRangeSize (l7,u7) * (
          unsafeIndex (l6,u6) i6 + unsafeRangeSize (l6,u6) * (
          unsafeIndex (l5,u5) i5 + unsafeRangeSize (l5,u5) * (
          unsafeIndex (l4,u4) i4 + unsafeRangeSize (l4,u4) * (
          unsafeIndex (l3,u3) i3 + unsafeRangeSize (l3,u3) * (
          unsafeIndex (l2,u2) i2 + unsafeRangeSize (l2,u2) * (
          unsafeIndex (l1,u1) i1)))))))))))))

        inRange ((l1,l2,l3,l4,l5,l6,l7,l8,l9,lA,lB,lC,lD,lE),
                 (u1,u2,u3,u4,u5,u6,u7,u8,u9,uA,uB,uC,uD,uE))
            (i1,i2,i3,i4,i5,i6,i7,i8,i9,iA,iB,iC,iD,iE) =
          inRange (l1,u1) i1 && inRange (l2,u2) i2 &&
          inRange (l3,u3) i3 && inRange (l4,u4) i4 &&
          inRange (l5,u5) i5 && inRange (l6,u6) i6 &&
          inRange (l7,u7) i7 && inRange (l8,u8) i8 &&
          inRange (l9,u9) i9 && inRange (lA,uA) iA &&
          inRange (lB,uB) iB && inRange (lC,uC) iC &&
          inRange (lD,uD) iD && inRange (lE,uE) 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 ((l1,l2,l3,l4,l5,l6,l7,l8,l9,lA,lB,lC,lD,lE,lF),
               (u1,u2,u3,u4,u5,u6,u7,u8,u9,uA,uB,uC,uD,uE,uF)) =
          [(i1,i2,i3,i4,i5,i6,i7,i8,i9,iA,iB,iC,iD,iE,iF) | i1 <- range (l1,u1),
                                                            i2 <- range (l2,u2),
                                                            i3 <- range (l3,u3),
                                                            i4 <- range (l4,u4),
                                                            i5 <- range (l5,u5),
                                                            i6 <- range (l6,u6),
                                                            i7 <- range (l7,u7),
                                                            i8 <- range (l8,u8),
                                                            i9 <- range (l9,u9),
                                                            iA <- range (lA,uA),
                                                            iB <- range (lB,uB),
                                                            iC <- range (lC,uC),
                                                            iD <- range (lD,uD),
                                                            iE <- range (lE,uE),
                                                            iF <- range (lF,uF)]

        unsafeIndex ((l1,l2,l3,l4,l5,l6,l7,l8,l9,lA,lB,lC,lD,lE,lF),
                     (u1,u2,u3,u4,u5,u6,u7,u8,u9,uA,uB,uC,uD,uE,uF))
            (i1,i2,i3,i4,i5,i6,i7,i8,i9,iA,iB,iC,iD,iE,iF) =
          unsafeIndex (lF,uF) iF + unsafeRangeSize (lF,uF) * (
          unsafeIndex (lE,uE) iE + unsafeRangeSize (lE,uE) * (
          unsafeIndex (lD,uD) iD + unsafeRangeSize (lD,uD) * (
          unsafeIndex (lC,uC) iC + unsafeRangeSize (lC,uC) * (
          unsafeIndex (lB,uB) iB + unsafeRangeSize (lB,uB) * (
          unsafeIndex (lA,uA) iA + unsafeRangeSize (lA,uA) * (
          unsafeIndex (l9,u9) i9 + unsafeRangeSize (l9,u9) * (
          unsafeIndex (l8,u8) i8 + unsafeRangeSize (l8,u8) * (
          unsafeIndex (l7,u7) i7 + unsafeRangeSize (l7,u7) * (
          unsafeIndex (l6,u6) i6 + unsafeRangeSize (l6,u6) * (
          unsafeIndex (l5,u5) i5 + unsafeRangeSize (l5,u5) * (
          unsafeIndex (l4,u4) i4 + unsafeRangeSize (l4,u4) * (
          unsafeIndex (l3,u3) i3 + unsafeRangeSize (l3,u3) * (
          unsafeIndex (l2,u2) i2 + unsafeRangeSize (l2,u2) * (
          unsafeIndex (l1,u1) i1))))))))))))))

        inRange ((l1,l2,l3,l4,l5,l6,l7,l8,l9,lA,lB,lC,lD,lE,lF),
                 (u1,u2,u3,u4,u5,u6,u7,u8,u9,uA,uB,uC,uD,uE,uF))
            (i1,i2,i3,i4,i5,i6,i7,i8,i9,iA,iB,iC,iD,iE,iF) =
          inRange (l1,u1) i1 && inRange (l2,u2) i2 &&
          inRange (l3,u3) i3 && inRange (l4,u4) i4 &&
          inRange (l5,u5) i5 && inRange (l6,u6) i6 &&
          inRange (l7,u7) i7 && inRange (l8,u8) i8 &&
          inRange (l9,u9) i9 && inRange (lA,uA) iA &&
          inRange (lB,uB) iB && inRange (lC,uC) iC &&
          inRange (lD,uD) iD && inRange (lE,uE) iE &&
          inRange (lF,uF) iF

        -- Default method for index

    instance MonadZip Complex where
      mzipWith = liftA2

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

    #if !(MIN_VERSION_base(4,16,0))
    instance Eq1 Complex where
        liftEq eq (x :+ y) (u :+ v) = eq x u && eq y v

    instance Read1 Complex where
    # if MIN_VERSION_base(4,10,0)
        liftReadPrec rp _  = parens $ prec complexPrec $ do
            x <- step rp
            expectP (Symbol ":+")
            y <- step rp
            return (x :+ y)
          where
            complexPrec = 6

        liftReadListPrec = liftReadListPrecDefault
        liftReadList     = liftReadListDefault
    # else
        liftReadsPrec rdP _ p s = readParen (p > complexPrec) (\s' -> do
          (x, s'')     <- rdP (complexPrec+1) s'
          (":+", s''') <- lex s''
          (y, s'''')   <- rdP (complexPrec+1) s'''
          return (x :+ y, s'''')) s
          where
            complexPrec = 6
    # endif

    instance Show1 Complex where
        liftShowsPrec sp _ d (x :+ y) = showParen (d > complexPrec) $
            sp (complexPrec+1) x . showString " :+ " . sp (complexPrec+1) y
          where
            complexPrec = 6

    instance Eq a => Eq2 ((,,) a) where
        liftEq2 e1 e2 (u1, x1, y1) (v1, x2, y2) =
            u1 == v1 &&
            e1 x1 x2 && e2 y1 y2

    instance Ord a => Ord2 ((,,) a) where
        liftCompare2 comp1 comp2 (u1, x1, y1) (v1, x2, y2) =
            compare u1 v1 `mappend`
            comp1 x1 x2 `mappend` comp2 y1 y2

    instance Read a => Read2 ((,,) a) where
    # if MIN_VERSION_base(4,10,0)
        liftReadPrec2 rp1 _ rp2 _ = parens $ paren $ do
            x1 <- readPrec
            expectP (Punc ",")
            y1 <- rp1
            expectP (Punc ",")
            y2 <- rp2
            return (x1,y1,y2)

        liftReadListPrec2 = liftReadListPrec2Default
        liftReadList2     = liftReadList2Default
    # else
        liftReadsPrec2 rp1 _ rp2 _ _ = readParen False $ \ r ->
            [((e1,e2,e3), y) | ("(",s) <- lex r,
                               (e1,t)  <- readsPrec 0 s,
                               (",",u) <- lex t,
                               (e2,v)  <- rp1 0 u,
                               (",",w) <- lex v,
                               (e3,x)  <- rp2 0 w,
                               (")",y) <- lex x]
    # endif

    instance Show a => Show2 ((,,) a) where
        liftShowsPrec2 sp1 _ sp2 _ _ (x1,y1,y2)
            = showChar '(' . showsPrec 0 x1
            . showChar ',' . sp1 0 y1
            . showChar ',' . sp2 0 y2
            . showChar ')'

    instance (Eq a, Eq b) => Eq1 ((,,) a b) where
        liftEq = liftEq2 (==)

    instance (Ord a, Ord b) => Ord1 ((,,) a b) where
        liftCompare = liftCompare2 compare

    instance (Read a, Read b) => Read1 ((,,) a b) where
    # if MIN_VERSION_base(4,10,0)
        liftReadPrec = liftReadPrec2 readPrec readListPrec

        liftReadListPrec = liftReadListPrecDefault
        liftReadList     = liftReadListDefault
    # else
        liftReadsPrec = liftReadsPrec2 readsPrec readList
    # endif

    instance (Show a, Show b) => Show1 ((,,) a b) where
        liftShowsPrec = liftShowsPrec2 showsPrec showList

    instance (Eq a, Eq b) => Eq2 ((,,,) a b) where
        liftEq2 e1 e2 (u1, u2, x1, y1) (v1, v2, x2, y2) =
            u1 == v1 &&
            u2 == v2 &&
            e1 x1 x2 && e2 y1 y2

    instance (Ord a, Ord b) => Ord2 ((,,,) a b) where
        liftCompare2 comp1 comp2 (u1, u2, x1, y1) (v1, v2, x2, y2) =
            compare u1 v1 `mappend`
            compare u2 v2 `mappend`
            comp1 x1 x2 `mappend` comp2 y1 y2

    instance (Read a, Read b) => Read2 ((,,,) a b) where
    # if MIN_VERSION_base(4,10,0)
        liftReadPrec2 rp1 _ rp2 _ = parens $ paren $ do
            x1 <- readPrec
            expectP (Punc ",")
            x2 <- readPrec
            expectP (Punc ",")
            y1 <- rp1
            expectP (Punc ",")
            y2 <- rp2
            return (x1,x2,y1,y2)

        liftReadListPrec2 = liftReadListPrec2Default
        liftReadList2     = liftReadList2Default
    # else
        liftReadsPrec2 rp1 _ rp2 _ _ = readParen False $ \ r ->
            [((e1,e2,e3,e4), s9) | ("(",s1) <- lex r,
                                   (e1,s2)  <- readsPrec 0 s1,
                                   (",",s3) <- lex s2,
                                   (e2,s4)  <- readsPrec 0 s3,
                                   (",",s5) <- lex s4,
                                   (e3,s6)  <- rp1 0 s5,
                                   (",",s7) <- lex s6,
                                   (e4,s8)  <- rp2 0 s7,
                                   (")",s9) <- lex s8]
    # endif

    instance (Show a, Show b) => Show2 ((,,,) a b) where
        liftShowsPrec2 sp1 _ sp2 _ _ (x1,x2,y1,y2)
            = showChar '(' . showsPrec 0 x1
            . showChar ',' . showsPrec 0 x2
            . showChar ',' . sp1 0 y1
            . showChar ',' . sp2 0 y2
            . showChar ')'

    instance (Eq a, Eq b, Eq c) => Eq1 ((,,,) a b c) where
        liftEq = liftEq2 (==)

    instance (Ord a, Ord b, Ord c) => Ord1 ((,,,) a b c) where
        liftCompare = liftCompare2 compare

    instance (Read a, Read b, Read c) => Read1 ((,,,) a b c) where
    # if MIN_VERSION_base(4,10,0)
        liftReadPrec = liftReadPrec2 readPrec readListPrec

        liftReadListPrec = liftReadListPrecDefault
        liftReadList     = liftReadListDefault
    # else
        liftReadsPrec = liftReadsPrec2 readsPrec readList
    # endif

    instance (Show a, Show b, Show c) => Show1 ((,,,) a b c) where
        liftShowsPrec = liftShowsPrec2 showsPrec showList

    deriving instance Semigroup (f (g a)) => Semigroup (Compose f g a)
    deriving instance Monoid    (f (g a)) => Monoid    (Compose f g a)

    instance (Semigroup (f a), Semigroup (g a)) => Semigroup (Functor.Product f g a) where
        Functor.Pair x1 y1 <> Functor.Pair x2 y2 = Functor.Pair (x1 <> x2) (y1 <> y2)

    instance (Monoid (f a), Monoid (g a)) => Monoid (Functor.Product f g a) where
        mempty = Functor.Pair mempty mempty
    # if !(MIN_VERSION_base(4,11,0))
        Functor.Pair x1 y1 `mappend` Functor.Pair x2 y2 = Functor.Pair (x1 `mappend` x2) (y1 `mappend` y2)
    # endif

    # if MIN_VERSION_base(4,15,0)
    instance Enum a => Enum (Solo a) where
        succ (Solo a) = Solo (succ a)
        pred (Solo a) = Solo (pred a)

        toEnum x = Solo (toEnum x)

        fromEnum (Solo x) = fromEnum x
        enumFrom (Solo x) = [Solo a | a <- enumFrom x]
        enumFromThen (Solo x) (Solo y) =
          [Solo a | a <- enumFromThen x y]
        enumFromTo (Solo x) (Solo y) =
          [Solo a | a <- enumFromTo x y]
        enumFromThenTo (Solo x) (Solo y) (Solo z) =
          [Solo a | a <- enumFromThenTo x y z]

    deriving instance Eq a => Eq (Solo a)
    deriving instance Ord a => Ord (Solo a)
    deriving instance Bounded a => Bounded (Solo a)

    instance Ix a => Ix (Solo a) where -- as derived
        {-# SPECIALISE instance Ix (Solo Int) #-}

        {-# INLINE range #-}
        range (Solo l, Solo u) =
          [ Solo i | i <- range (l,u) ]

        {-# INLINE unsafeIndex #-}
        unsafeIndex (Solo l, Solo u) (Solo i) =
          unsafeIndex (l,u) i

        {-# INLINE inRange #-}
        inRange (Solo l, Solo u) (Solo i) =
          inRange (l, u) i

        -- Default method for index
    # endif
    #endif

    #if !(MIN_VERSION_base(4,16,1))
    deriving instance Ix CChar
    deriving instance Ix CSChar
    deriving instance Ix CUChar
    deriving instance Ix CShort
    deriving instance Ix CUShort
    deriving instance Ix CInt
    deriving instance Ix CUInt
    deriving instance Ix CLong
    deriving instance Ix CULong
    deriving instance Ix CLLong
    deriving instance Ix CULLong
    deriving instance Ix CPtrdiff
    deriving instance Ix CSize
    deriving instance Ix CWchar
    deriving instance Ix CSigAtomic
    deriving instance Ix CIntPtr
    deriving instance Ix CUIntPtr
    deriving instance Ix CIntMax
    deriving instance Ix CUIntMax
    # if MIN_VERSION_base(4,10,0)
    deriving instance Ix CBool
    # endif

    # if MIN_VERSION_base(4,10,0)
    -- These are guarded on base-4.10.0 because that was the first version which
    -- exported their constructors, which is necessary to use
    -- GeneralizedNewtypeDeriving. See
    -- https://gitlab.haskell.org/ghc/ghc/-/issues/11983.
    deriving instance Ix WordPtr
    deriving instance Ix IntPtr
    # endif

    # if defined(HTYPE_DEV_T)
    deriving instance Ix CDev
    # endif
    # if defined(HTYPE_INO_T)
    deriving instance Ix CIno
    # endif
    # if defined(HTYPE_MODE_T)
    deriving instance Ix CMode
    # endif
    # if defined(HTYPE_OFF_T)
    deriving instance Ix COff
    # endif
    # if defined(HTYPE_PID_T)
    deriving instance Ix CPid
    # endif
    # if defined(HTYPE_SSIZE_T)
    deriving instance Ix CSsize
    # endif
    # if defined(HTYPE_GID_T)
    deriving instance Ix CGid
    # endif
    # if defined(HTYPE_NLINK_T)
    deriving instance Ix CNlink
    # endif
    # if defined(HTYPE_UID_T)
    deriving instance Ix CUid
    # endif
    # if defined(HTYPE_CC_T)
    deriving instance Ix CCc
    # endif
    # if defined(HTYPE_SPEED_T)
    deriving instance Ix CSpeed
    # endif
    # if defined(HTYPE_TCFLAG_T)
    deriving instance Ix CTcflag
    # endif
    # if defined(HTYPE_RLIM_T)
    deriving instance Ix CRLim
    # endif
    deriving instance Ix Fd

    # if MIN_VERSION_base(4,10,0)
    #  if defined(HTYPE_BLKSIZE_T)
    deriving instance Ix CBlkSize
    #  endif
    #  if defined(HTYPE_BLKCNT_T)
    deriving instance Ix CBlkCnt
    #  endif
    #  if defined(HTYPE_CLOCKID_T)
    deriving instance Ix CClockId
    #  endif
    #  if defined(HTYPE_FSBLKCNT_T)
    deriving instance Ix CFsBlkCnt
    #  endif
    #  if defined(HTYPE_FSFILCNT_T)
    deriving instance Ix CFsFilCnt
    #  endif
    #  if defined(HTYPE_ID_T)
    deriving instance Ix CId
    #  endif
    #  if defined(HTYPE_KEY_T)
    deriving instance Ix CKey
    #  endif
    #  if defined(HTYPE_SOCKLEN_T)
    deriving instance Ix CSocklen
    #  endif
    #  if defined(HTYPE_NFDS_T)
    deriving instance Ix CNfds
    #  endif
    # endif
    #endif

    #if !(MIN_VERSION_base(4,18,0))
    instance Functor ((,,,,) a b c d) where
        fmap f (a, b, c, d, e) = (a, b, c, d, f e)
    instance Functor ((,,,,,) a b c d e) where
        fmap fun (a, b, c, d, e, f) = (a, b, c, d, e, fun f)
    instance Functor ((,,,,,,) a b c d e f) where
        fmap fun (a, b, c, d, e, f, g) = (a, b, c, d, e, f, fun g)

    # if !(MIN_VERSION_base(4,14,0)) || MIN_VERSION_base(4,15,0)
    -- | Swaps @'succ'@ and @'pred'@ of the underlying type.
    instance (Enum a, Bounded a, Eq a) => Enum (Down a) where
        succ = fmap pred
        pred = fmap succ

        -- Here we use the fact that 'comparing (complement @Int)' behaves
        -- as an order-swapping `compare @Int`.
        fromEnum (Down x) = complement $ fromEnum x
        toEnum = Down . toEnum . complement

        enumFrom (Down x)
            | x == minBound
            = [Down x] -- We can't rely on 'enumFromThen _ (pred @a minBound)` behaving nicely,
                       -- since 'enumFromThen _' might be strict and 'pred minBound' might throw
            | otherwise
            = coerce $ enumFromThen x (pred x)
        enumFromThen (Down x) (Down y) = coerce $ enumFromThen x y
    # endif

    # if MIN_VERSION_base(4,17,0)
    instance (Generic1 f, Eq (Rep1 f a)) => Eq (Generically1 f a) where
       Generically1 x == Generically1 y = from1 x == from1 y
       Generically1 x /= Generically1 y = from1 x /= from1 y

    instance (Generic1 f, Ord (Rep1 f a)) => Ord (Generically1 f a) where
       Generically1 x `compare` Generically1 y = from1 x `compare` from1 y
    # endif
    #endif

    #if !(MIN_VERSION_base(4,19,0))
    deriving instance Enum (f (g a)) => Enum (Compose f g a)
    deriving instance Bounded (f (g a)) => Bounded (Compose f g a)
    deriving instance Num (f (g a)) => Num (Compose f g a)

    -- In base-4.18.0.0, the Ord instance for Compose was simplified to:
    --
    --   instance Ord (f (g a)) => Ord (Compose f g a)
    --
    -- Before that, the Ord instance was defined as:
    --
    --   instance (Ord1 f, Ord1 g, Ord a) => Ord (Compose f g a)
    --
    -- This makes deriving Real and Integral instances slightly more complicated for
    -- these older versions of base, as there are no Real1 or Integral1 classes. We
    -- opt for making the instance contexts more complicated instead.
    # if MIN_VERSION_base(4,18,0)
    deriving instance Real (f (g a)) => Real (Compose f g a)
    deriving instance Integral (f (g a)) => Integral (Compose f g a)
    # else
    deriving instance (Real (f (g a)), Ord1 f, Ord1 g, Ord a) => Real (Compose f g a)
    deriving instance (Integral (f (g a)), Ord1 f, Ord1 g, Ord a) => Integral (Compose f g a)
    # endif

    # if MIN_VERSION_base(4,18,0)
    instance Eq (SChar c) where
      _ == _ = True
    instance Ord (SChar c) where
      compare _ _ = EQ

    instance Eq (SNat n) where
      _ == _ = True
    instance Ord (SNat n) where
      compare _ _ = EQ

    instance Eq (SSymbol s) where
      _ == _ = True
    instance Ord (SSymbol s) where
      compare _ _ = EQ
    # endif
    #endif

    #if !(MIN_VERSION_base(4,20,0))
    deriving instance Fractional (f (g a)) => Fractional (Compose f g a)
    deriving instance Floating (f (g a)) => Floating (Compose f g a)

    -- RealFrac and RealFloat both have Ord as a superclass. For the reasons stated
    -- above (near the Real/Integral instances for Compose), these
    -- RealFrace/RealFloat instances are slightly more complicated for older
    -- versions of base.
    # if MIN_VERSION_base(4,18,0)
    deriving instance RealFrac (f (g a)) => RealFrac (Compose f g a)
    deriving instance RealFloat (f (g a)) => RealFloat (Compose f g a)
    # else
    deriving instance (RealFrac (f (g a)), Ord1 f, Ord1 g, Ord a) => RealFrac (Compose f g a)
    deriving instance (RealFloat (f (g a)), Ord1 f, Ord1 g, Ord a) => RealFloat (Compose f g a)
    # endif
    #endif

    #if !(MIN_VERSION_base(4,21,0))
    instance Monoid a => MonadFix ((,) a) where
        -- See the CLC proposal thread for discussion and proofs of the laws: https://github.com/haskell/core-libraries-committee/issues/238
        mfix :: forall a. (a -> (a, a)) -> (a, a)
    mfix a -> (a, a)
    f = let a :: (a, a)
    a = a -> (a, a)
    f ((a, a) -> a
    forall a b. (a, b) -> b
    snd (a, a)
    a) in (a, a)
    a

    instance Eq1 V1 where
      liftEq :: forall a b. (a -> b -> Bool) -> V1 a -> V1 b -> Bool
    liftEq a -> b -> Bool
    _ = \V1 a
    _ V1 b
    _ -> Bool
    True

    instance Ord1 V1 where
      liftCompare :: forall a b. (a -> b -> Ordering) -> V1 a -> V1 b -> Ordering
    liftCompare a -> b -> Ordering
    _ = \V1 a
    _ V1 b
    _ -> Ordering
    EQ

    instance Show1 V1 where
      liftShowsPrec :: forall a.
    (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> V1 a -> ShowS
    liftShowsPrec Int -> a -> ShowS
    _ [a] -> ShowS
    _ Int
    _ = \V1 a
    _ -> String -> ShowS
    showString String
    "V1"

    instance Read1 V1 where
      liftReadsPrec :: forall a. (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (V1 a)
    liftReadsPrec Int -> ReadS a
    _ ReadS [a]
    _ = ReadPrec (V1 a) -> Int -> ReadS (V1 a)
    forall a. ReadPrec a -> Int -> ReadS a
    readPrec_to_S ReadPrec (V1 a)
    forall a. ReadPrec a
    pfail

    # if MIN_VERSION_base(4,10,0)
      liftReadListPrec :: forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec [V1 a]
    liftReadListPrec  = ReadPrec a -> ReadPrec [a] -> ReadPrec [V1 a]
    forall (f :: * -> *) a.
    Read1 f =>
    ReadPrec a -> ReadPrec [a] -> ReadPrec [f a]
    liftReadListPrecDefault
      liftReadList :: forall a. (Int -> ReadS a) -> ReadS [a] -> ReadS [V1 a]
    liftReadList      = (Int -> ReadS a) -> ReadS [a] -> ReadS [V1 a]
    forall (f :: * -> *) a.
    Read1 f =>
    (Int -> ReadS a) -> ReadS [a] -> ReadS [f a]
    liftReadListDefault
    # endif

    instance Eq1 U1 where
      liftEq :: forall a b. (a -> b -> Bool) -> U1 a -> U1 b -> Bool
    liftEq a -> b -> Bool
    _ = \U1 a
    _ U1 b
    _ -> Bool
    True

    instance Ord1 U1 where
      liftCompare :: forall a b. (a -> b -> Ordering) -> U1 a -> U1 b -> Ordering
    liftCompare a -> b -> Ordering
    _ = \U1 a
    _ U1 b
    _ -> Ordering
    EQ

    instance Show1 U1 where
      liftShowsPrec :: forall a.
    (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> U1 a -> ShowS
    liftShowsPrec Int -> a -> ShowS
    _ [a] -> ShowS
    _ Int
    _ = \U1 a
    U1 -> String -> ShowS
    showString String
    "U1"

    instance Read1 U1 where
    # if MIN_VERSION_base(4,10,0)
      liftReadPrec :: forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec (U1 a)
    liftReadPrec ReadPrec a
    _ ReadPrec [a]
    _ =
        ReadPrec (U1 a) -> ReadPrec (U1 a)
    forall a. ReadPrec a -> ReadPrec a
    parens (Lexeme -> ReadPrec ()
    expectP (String -> Lexeme
    Ident String
    "U1") ReadPrec () -> ReadPrec (U1 a) -> ReadPrec (U1 a)
    forall a b. ReadPrec a -> ReadPrec b -> ReadPrec b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> U1 a -> ReadPrec (U1 a)
    forall a. a -> ReadPrec a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure U1 a
    forall k (p :: k). U1 p
    U1)

      liftReadListPrec :: forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec [U1 a]
    liftReadListPrec  = ReadPrec a -> ReadPrec [a] -> ReadPrec [U1 a]
    forall (f :: * -> *) a.
    Read1 f =>
    ReadPrec a -> ReadPrec [a] -> ReadPrec [f a]
    liftReadListPrecDefault
      liftReadList :: forall a. (Int -> ReadS a) -> ReadS [a] -> ReadS [U1 a]
    liftReadList      = (Int -> ReadS a) -> ReadS [a] -> ReadS [U1 a]
    forall (f :: * -> *) a.
    Read1 f =>
    (Int -> ReadS a) -> ReadS [a] -> ReadS [f a]
    liftReadListDefault
    # else
      liftReadsPrec _ _ =
        readPrec_to_S $
        parens (expectP (Ident "U1") *> pure U1)
    # endif

    instance Eq1 Par1 where
      liftEq :: forall a b. (a -> b -> Bool) -> Par1 a -> Par1 b -> Bool
    liftEq a -> b -> Bool
    eq = \(Par1 a
    a) (Par1 b
    a') -> a -> b -> Bool
    eq a
    a b
    a'

    instance Ord1 Par1 where
      liftCompare :: forall a b. (a -> b -> Ordering) -> Par1 a -> Par1 b -> Ordering
    liftCompare a -> b -> Ordering
    cmp = \(Par1 a
    a) (Par1 b
    a') -> a -> b -> Ordering
    cmp a
    a b
    a'

    instance Show1 Par1 where
      liftShowsPrec :: forall a.
    (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Par1 a -> ShowS
    liftShowsPrec Int -> a -> ShowS
    sp [a] -> ShowS
    _ Int
    d = \(Par1 { unPar1 :: forall p. Par1 p -> p
    unPar1 = a
    a }) ->
        (Int -> a -> ShowS) -> String -> String -> Int -> a -> ShowS
    forall a.
    (Int -> a -> ShowS) -> String -> String -> Int -> a -> ShowS
    showsSingleFieldRecordWith Int -> a -> ShowS
    sp String
    "Par1" String
    "unPar1" Int
    d a
    a

    instance Read1 Par1 where
    # if MIN_VERSION_base(4,10,0)
      liftReadPrec :: forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec (Par1 a)
    liftReadPrec ReadPrec a
    rp ReadPrec [a]
    _ =
        ReadPrec a
    -> String -> String -> (a -> Par1 a) -> ReadPrec (Par1 a)
    forall a t.
    ReadPrec a -> String -> String -> (a -> t) -> ReadPrec t
    readSingleFieldRecordWith ReadPrec a
    rp String
    "Par1" String
    "unPar1" a -> Par1 a
    forall p. p -> Par1 p
    Par1

      liftReadListPrec :: forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec [Par1 a]
    liftReadListPrec  = ReadPrec a -> ReadPrec [a] -> ReadPrec [Par1 a]
    forall (f :: * -> *) a.
    Read1 f =>
    ReadPrec a -> ReadPrec [a] -> ReadPrec [f a]
    liftReadListPrecDefault
      liftReadList :: forall a. (Int -> ReadS a) -> ReadS [a] -> ReadS [Par1 a]
    liftReadList      = (Int -> ReadS a) -> ReadS [a] -> ReadS [Par1 a]
    forall (f :: * -> *) a.
    Read1 f =>
    (Int -> ReadS a) -> ReadS [a] -> ReadS [f a]
    liftReadListDefault
    # else
      liftReadsPrec rp _ =
        readPrec_to_S $
        readSingleFieldRecordWith (readS_to_Prec rp) "Par1" "unPar1" Par1
    # endif

    instance Eq1 f => Eq1 (Rec1 f) where
      liftEq :: forall a b. (a -> b -> Bool) -> Rec1 f a -> Rec1 f b -> Bool
    liftEq a -> b -> Bool
    eq = \(Rec1 f a
    a) (Rec1 f b
    a') -> (a -> b -> Bool) -> f a -> f b -> Bool
    forall a b. (a -> b -> Bool) -> f a -> f b -> Bool
    forall (f :: * -> *) a b.
    Eq1 f =>
    (a -> b -> Bool) -> f a -> f b -> Bool
    liftEq a -> b -> Bool
    eq f a
    a f b
    a'

    instance Ord1 f => Ord1 (Rec1 f) where
      liftCompare :: forall a b.
    (a -> b -> Ordering) -> Rec1 f a -> Rec1 f b -> Ordering
    liftCompare a -> b -> Ordering
    cmp = \(Rec1 f a
    a) (Rec1 f b
    a') -> (a -> b -> Ordering) -> f a -> f b -> Ordering
    forall a b. (a -> b -> Ordering) -> f a -> f b -> Ordering
    forall (f :: * -> *) a b.
    Ord1 f =>
    (a -> b -> Ordering) -> f a -> f b -> Ordering
    liftCompare a -> b -> Ordering
    cmp f a
    a f b
    a'

    instance Show1 f => Show1 (Rec1 f) where
      liftShowsPrec :: forall a.
    (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Rec1 f a -> ShowS
    liftShowsPrec Int -> a -> ShowS
    sp [a] -> ShowS
    sl Int
    d = \(Rec1 { unRec1 :: forall k (f :: k -> *) (p :: k). Rec1 f p -> f p
    unRec1 = f a
    a }) ->
        (Int -> f a -> ShowS) -> String -> String -> Int -> f a -> ShowS
    forall a.
    (Int -> a -> ShowS) -> String -> String -> Int -> a -> ShowS
    showsSingleFieldRecordWith ((Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS
    forall a.
    (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS
    forall (f :: * -> *) a.
    Show1 f =>
    (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS
    liftShowsPrec Int -> a -> ShowS
    sp [a] -> ShowS
    sl) String
    "Rec1" String
    "unRec1" Int
    d f a
    a

    instance Read1 f => Read1 (Rec1 f) where
    # if MIN_VERSION_base(4,10,0)
      liftReadPrec :: forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec (Rec1 f a)
    liftReadPrec ReadPrec a
    rp ReadPrec [a]
    rl =
        ReadPrec (f a)
    -> String -> String -> (f a -> Rec1 f a) -> ReadPrec (Rec1 f a)
    forall a t.
    ReadPrec a -> String -> String -> (a -> t) -> ReadPrec t
    readSingleFieldRecordWith (ReadPrec a -> ReadPrec [a] -> ReadPrec (f a)
    forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec (f a)
    forall (f :: * -> *) a.
    Read1 f =>
    ReadPrec a -> ReadPrec [a] -> ReadPrec (f a)
    liftReadPrec ReadPrec a
    rp ReadPrec [a]
    rl) String
    "Rec1" String
    "unRec1" f a -> Rec1 f a
    forall k (f :: k -> *) (p :: k). f p -> Rec1 f p
    Rec1

      liftReadListPrec :: forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec [Rec1 f a]
    liftReadListPrec   = ReadPrec a -> ReadPrec [a] -> ReadPrec [Rec1 f a]
    forall (f :: * -> *) a.
    Read1 f =>
    ReadPrec a -> ReadPrec [a] -> ReadPrec [f a]
    liftReadListPrecDefault
      liftReadList :: forall a. (Int -> ReadS a) -> ReadS [a] -> ReadS [Rec1 f a]
    liftReadList       = (Int -> ReadS a) -> ReadS [a] -> ReadS [Rec1 f a]
    forall (f :: * -> *) a.
    Read1 f =>
    (Int -> ReadS a) -> ReadS [a] -> ReadS [f a]
    liftReadListDefault
    # else
      liftReadsPrec rp rl =
        readPrec_to_S $
        readSingleFieldRecordWith
          (readS_to_Prec (liftReadsPrec rp rl))
          "Rec1"
          "unRec1"
          Rec1
    # endif

    instance Eq c => Eq1 (K1 i c) where
      liftEq :: forall a b. (a -> b -> Bool) -> K1 i c a -> K1 i c b -> Bool
    liftEq a -> b -> Bool
    _ = \(K1 c
    a) (K1 c
    a') -> c
    a c -> c -> Bool
    forall a. Eq a => a -> a -> Bool
    == c
    a'

    instance Ord c => Ord1 (K1 i c) where
      liftCompare :: forall a b.
    (a -> b -> Ordering) -> K1 i c a -> K1 i c b -> Ordering
    liftCompare a -> b -> Ordering
    _ = \(K1 c
    a) (K1 c
    a') -> c -> c -> Ordering
    forall a. Ord a => a -> a -> Ordering
    compare c
    a c
    a'

    instance Show c => Show1 (K1 i c) where
      liftShowsPrec :: forall a.
    (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> K1 i c a -> ShowS
    liftShowsPrec Int -> a -> ShowS
    _ [a] -> ShowS
    _ Int
    d = \(K1 { unK1 :: forall k i c (p :: k). K1 i c p -> c
    unK1 = c
    a }) ->
        (Int -> c -> ShowS) -> String -> String -> Int -> c -> ShowS
    forall a.
    (Int -> a -> ShowS) -> String -> String -> Int -> a -> ShowS
    showsSingleFieldRecordWith Int -> c -> ShowS
    forall a. Show a => Int -> a -> ShowS
    showsPrec String
    "K1" String
    "unK1" Int
    d c
    a

    instance Read c => Read1 (K1 i c) where
    # if MIN_VERSION_base(4,10,0)
      liftReadPrec :: forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec (K1 i c a)
    liftReadPrec ReadPrec a
    _ ReadPrec [a]
    _ = ReadPrec (K1 i c a) -> ReadPrec (K1 i c a)
    forall a. ReadPrec a -> ReadPrec a
    readData (ReadPrec (K1 i c a) -> ReadPrec (K1 i c a))
    -> ReadPrec (K1 i c a) -> ReadPrec (K1 i c a)
    forall a b. (a -> b) -> a -> b
    $
        ReadPrec c
    -> String -> String -> (c -> K1 i c a) -> ReadPrec (K1 i c a)
    forall a t.
    ReadPrec a -> String -> String -> (a -> t) -> ReadPrec t
    readSingleFieldRecordWith ReadPrec c
    forall a. Read a => ReadPrec a
    readPrec String
    "K1" String
    "unK1" c -> K1 i c a
    forall k i c (p :: k). c -> K1 i c p
    K1

      liftReadListPrec :: forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec [K1 i c a]
    liftReadListPrec  = ReadPrec a -> ReadPrec [a] -> ReadPrec [K1 i c a]
    forall (f :: * -> *) a.
    Read1 f =>
    ReadPrec a -> ReadPrec [a] -> ReadPrec [f a]
    liftReadListPrecDefault
      liftReadList :: forall a. (Int -> ReadS a) -> ReadS [a] -> ReadS [K1 i c a]
    liftReadList      = (Int -> ReadS a) -> ReadS [a] -> ReadS [K1 i c a]
    forall (f :: * -> *) a.
    Read1 f =>
    (Int -> ReadS a) -> ReadS [a] -> ReadS [f a]
    liftReadListDefault
    # else
      liftReadsPrec _ _ =
        readPrec_to_S $
        readData $
        readSingleFieldRecordWith readPrec "K1" "unK1" K1
    # endif

    instance Eq1 f => Eq1 (M1 i c f) where
      liftEq :: forall a b. (a -> b -> Bool) -> M1 i c f a -> M1 i c f b -> Bool
    liftEq a -> b -> Bool
    eq = \(M1 f a
    a) (M1 f b
    a') -> (a -> b -> Bool) -> f a -> f b -> Bool
    forall a b. (a -> b -> Bool) -> f a -> f b -> Bool
    forall (f :: * -> *) a b.
    Eq1 f =>
    (a -> b -> Bool) -> f a -> f b -> Bool
    liftEq a -> b -> Bool
    eq f a
    a f b
    a'

    instance Ord1 f => Ord1 (M1 i c f) where
      liftCompare :: forall a b.
    (a -> b -> Ordering) -> M1 i c f a -> M1 i c f b -> Ordering
    liftCompare a -> b -> Ordering
    cmp = \(M1 f a
    a) (M1 f b
    a') -> (a -> b -> Ordering) -> f a -> f b -> Ordering
    forall a b. (a -> b -> Ordering) -> f a -> f b -> Ordering
    forall (f :: * -> *) a b.
    Ord1 f =>
    (a -> b -> Ordering) -> f a -> f b -> Ordering
    liftCompare a -> b -> Ordering
    cmp f a
    a f b
    a'

    instance Show1 f => Show1 (M1 i c f) where
      liftShowsPrec :: forall a.
    (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> M1 i c f a -> ShowS
    liftShowsPrec Int -> a -> ShowS
    sp [a] -> ShowS
    sl Int
    d = \(M1 { unM1 :: forall k i (c :: Meta) (f :: k -> *) (p :: k). M1 i c f p -> f p
    unM1 = f a
    a }) ->
        (Int -> f a -> ShowS) -> String -> String -> Int -> f a -> ShowS
    forall a.
    (Int -> a -> ShowS) -> String -> String -> Int -> a -> ShowS
    showsSingleFieldRecordWith ((Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS
    forall a.
    (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS
    forall (f :: * -> *) a.
    Show1 f =>
    (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS
    liftShowsPrec Int -> a -> ShowS
    sp [a] -> ShowS
    sl) String
    "M1" String
    "unM1" Int
    d f a
    a

    instance Read1 f => Read1 (M1 i c f) where
    # if MIN_VERSION_base(4,10,0)
      liftReadPrec :: forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec (M1 i c f a)
    liftReadPrec ReadPrec a
    rp ReadPrec [a]
    rl = ReadPrec (M1 i c f a) -> ReadPrec (M1 i c f a)
    forall a. ReadPrec a -> ReadPrec a
    readData (ReadPrec (M1 i c f a) -> ReadPrec (M1 i c f a))
    -> ReadPrec (M1 i c f a) -> ReadPrec (M1 i c f a)
    forall a b. (a -> b) -> a -> b
    $
        ReadPrec (f a)
    -> String -> String -> (f a -> M1 i c f a) -> ReadPrec (M1 i c f a)
    forall a t.
    ReadPrec a -> String -> String -> (a -> t) -> ReadPrec t
    readSingleFieldRecordWith (ReadPrec a -> ReadPrec [a] -> ReadPrec (f a)
    forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec (f a)
    forall (f :: * -> *) a.
    Read1 f =>
    ReadPrec a -> ReadPrec [a] -> ReadPrec (f a)
    liftReadPrec ReadPrec a
    rp ReadPrec [a]
    rl) String
    "M1" String
    "unM1" f a -> M1 i c f a
    forall k i (c :: Meta) (f :: k -> *) (p :: k). f p -> M1 i c f p
    M1

      liftReadListPrec :: forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec [M1 i c f a]
    liftReadListPrec  = ReadPrec a -> ReadPrec [a] -> ReadPrec [M1 i c f a]
    forall (f :: * -> *) a.
    Read1 f =>
    ReadPrec a -> ReadPrec [a] -> ReadPrec [f a]
    liftReadListPrecDefault
      liftReadList :: forall a. (Int -> ReadS a) -> ReadS [a] -> ReadS [M1 i c f a]
    liftReadList      = (Int -> ReadS a) -> ReadS [a] -> ReadS [M1 i c f a]
    forall (f :: * -> *) a.
    Read1 f =>
    (Int -> ReadS a) -> ReadS [a] -> ReadS [f a]
    liftReadListDefault
    # else
      liftReadsPrec rp rl =
        readPrec_to_S $
        readData $
        readSingleFieldRecordWith
          (readS_to_Prec (liftReadsPrec rp rl))
          "M1"
          "unM1"
          M1
    # endif

    instance (Eq1 f, Eq1 g) => Eq1 (f :+: g) where
      liftEq :: forall a b. (a -> b -> Bool) -> (:+:) f g a -> (:+:) f g b -> Bool
    liftEq a -> b -> Bool
    eq = \(:+:) f g a
    lhs (:+:) f g b
    rhs -> case ((:+:) f g a
    lhs, (:+:) f g b
    rhs) of
        (L1 f a
    a, L1 f b
    a') -> (a -> b -> Bool) -> f a -> f b -> Bool
    forall a b. (a -> b -> Bool) -> f a -> f b -> Bool
    forall (f :: * -> *) a b.
    Eq1 f =>
    (a -> b -> Bool) -> f a -> f b -> Bool
    liftEq a -> b -> Bool
    eq f a
    a f b
    a'
        (R1 g a
    b, R1 g b
    b') -> (a -> b -> Bool) -> g a -> g b -> Bool
    forall a b. (a -> b -> Bool) -> g a -> g b -> Bool
    forall (f :: * -> *) a b.
    Eq1 f =>
    (a -> b -> Bool) -> f a -> f b -> Bool
    liftEq a -> b -> Bool
    eq g a
    b g b
    b'
        ((:+:) f g a, (:+:) f g b)
    _           -> Bool
    False

    instance (Ord1 f, Ord1 g) => Ord1 (f :+: g) where
      liftCompare :: forall a b.
    (a -> b -> Ordering) -> (:+:) f g a -> (:+:) f g b -> Ordering
    liftCompare a -> b -> Ordering
    cmp = \(:+:) f g a
    lhs (:+:) f g b
    rhs -> case ((:+:) f g a
    lhs, (:+:) f g b
    rhs) of
        (L1 f a
    _, R1 g b
    _)  -> Ordering
    LT
        (R1 g a
    _, L1 f b
    _)  -> Ordering
    GT
        (L1 f a
    a, L1 f b
    a') -> (a -> b -> Ordering) -> f a -> f b -> Ordering
    forall a b. (a -> b -> Ordering) -> f a -> f b -> Ordering
    forall (f :: * -> *) a b.
    Ord1 f =>
    (a -> b -> Ordering) -> f a -> f b -> Ordering
    liftCompare a -> b -> Ordering
    cmp f a
    a f b
    a'
        (R1 g a
    b, R1 g b
    b') -> (a -> b -> Ordering) -> g a -> g b -> Ordering
    forall a b. (a -> b -> Ordering) -> g a -> g b -> Ordering
    forall (f :: * -> *) a b.
    Ord1 f =>
    (a -> b -> Ordering) -> f a -> f b -> Ordering
    liftCompare a -> b -> Ordering
    cmp g a
    b g b
    b'

    instance (Show1 f, Show1 g) => Show1 (f :+: g) where
      liftShowsPrec :: forall a.
    (Int -> a -> ShowS)
    -> ([a] -> ShowS) -> Int -> (:+:) f g a -> ShowS
    liftShowsPrec Int -> a -> ShowS
    sp [a] -> ShowS
    sl Int
    d = \(:+:) f g a
    x -> case (:+:) f g a
    x of
        L1 f a
    a -> (Int -> f a -> ShowS) -> String -> Int -> f a -> ShowS
    forall a. (Int -> a -> ShowS) -> String -> Int -> a -> ShowS
    showsUnaryWith ((Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS
    forall a.
    (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS
    forall (f :: * -> *) a.
    Show1 f =>
    (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS
    liftShowsPrec Int -> a -> ShowS
    sp [a] -> ShowS
    sl) String
    "L1" Int
    d f a
    a
        R1 g a
    b -> (Int -> g a -> ShowS) -> String -> Int -> g a -> ShowS
    forall a. (Int -> a -> ShowS) -> String -> Int -> a -> ShowS
    showsUnaryWith ((Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> g a -> ShowS
    forall a.
    (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> g a -> ShowS
    forall (f :: * -> *) a.
    Show1 f =>
    (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS
    liftShowsPrec Int -> a -> ShowS
    sp [a] -> ShowS
    sl) String
    "R1" Int
    d g a
    b

    instance (Read1 f, Read1 g) => Read1 (f :+: g) where
    # if MIN_VERSION_base(4,10,0)
      liftReadPrec :: forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec ((:+:) f g a)
    liftReadPrec ReadPrec a
    rp ReadPrec [a]
    rl = ReadPrec ((:+:) f g a) -> ReadPrec ((:+:) f g a)
    forall a. ReadPrec a -> ReadPrec a
    readData (ReadPrec ((:+:) f g a) -> ReadPrec ((:+:) f g a))
    -> ReadPrec ((:+:) f g a) -> ReadPrec ((:+:) f g a)
    forall a b. (a -> b) -> a -> b
    $
        ReadPrec (f a)
    -> String -> (f a -> (:+:) f g a) -> ReadPrec ((:+:) f g a)
    forall a t. ReadPrec a -> String -> (a -> t) -> ReadPrec t
    readUnaryWith (ReadPrec a -> ReadPrec [a] -> ReadPrec (f a)
    forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec (f a)
    forall (f :: * -> *) a.
    Read1 f =>
    ReadPrec a -> ReadPrec [a] -> ReadPrec (f a)
    liftReadPrec ReadPrec a
    rp ReadPrec [a]
    rl) String
    "L1" f a -> (:+:) f g a
    forall k (f :: k -> *) (g :: k -> *) (p :: k). f p -> (:+:) f g p
    L1 ReadPrec ((:+:) f g a)
    -> ReadPrec ((:+:) f g a) -> ReadPrec ((:+:) f g a)
    forall a. ReadPrec a -> ReadPrec a -> ReadPrec a
    forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
    <|>
        ReadPrec (g a)
    -> String -> (g a -> (:+:) f g a) -> ReadPrec ((:+:) f g a)
    forall a t. ReadPrec a -> String -> (a -> t) -> ReadPrec t
    readUnaryWith (ReadPrec a -> ReadPrec [a] -> ReadPrec (g a)
    forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec (g a)
    forall (f :: * -> *) a.
    Read1 f =>
    ReadPrec a -> ReadPrec [a] -> ReadPrec (f a)
    liftReadPrec ReadPrec a
    rp ReadPrec [a]
    rl) String
    "R1" g a -> (:+:) f g a
    forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
    R1

      liftReadListPrec :: forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec [(:+:) f g a]
    liftReadListPrec  = ReadPrec a -> ReadPrec [a] -> ReadPrec [(:+:) f g a]
    forall (f :: * -> *) a.
    Read1 f =>
    ReadPrec a -> ReadPrec [a] -> ReadPrec [f a]
    liftReadListPrecDefault
      liftReadList :: forall a. (Int -> ReadS a) -> ReadS [a] -> ReadS [(:+:) f g a]
    liftReadList      = (Int -> ReadS a) -> ReadS [a] -> ReadS [(:+:) f g a]
    forall (f :: * -> *) a.
    Read1 f =>
    (Int -> ReadS a) -> ReadS [a] -> ReadS [f a]
    liftReadListDefault
    # else
      liftReadsPrec rp rl =
        readPrec_to_S $
        readData $
        readUnaryWith (readS_to_Prec (liftReadsPrec rp rl)) "L1" L1 <|>
        readUnaryWith (readS_to_Prec (liftReadsPrec rp rl)) "R1" R1
    # endif

    instance (Eq1 f, Eq1 g) => Eq1 (f :*: g) where
      liftEq :: forall a b. (a -> b -> Bool) -> (:*:) f g a -> (:*:) f g b -> Bool
    liftEq a -> b -> Bool
    eq = \(f a
    f :*: g a
    g) (f b
    f' :*: g b
    g') -> (a -> b -> Bool) -> f a -> f b -> Bool
    forall a b. (a -> b -> Bool) -> f a -> f b -> Bool
    forall (f :: * -> *) a b.
    Eq1 f =>
    (a -> b -> Bool) -> f a -> f b -> Bool
    liftEq a -> b -> Bool
    eq f a
    f f b
    f' Bool -> Bool -> Bool
    && (a -> b -> Bool) -> g a -> g b -> Bool
    forall a b. (a -> b -> Bool) -> g a -> g b -> Bool
    forall (f :: * -> *) a b.
    Eq1 f =>
    (a -> b -> Bool) -> f a -> f b -> Bool
    liftEq a -> b -> Bool
    eq g a
    g g b
    g'

    instance (Ord1 f, Ord1 g) => Ord1 (f :*: g) where
      liftCompare :: forall a b.
    (a -> b -> Ordering) -> (:*:) f g a -> (:*:) f g b -> Ordering
    liftCompare a -> b -> Ordering
    cmp = \(f a
    f :*: g a
    g) (f b
    f' :*: g b
    g') -> (a -> b -> Ordering) -> f a -> f b -> Ordering
    forall a b. (a -> b -> Ordering) -> f a -> f b -> Ordering
    forall (f :: * -> *) a b.
    Ord1 f =>
    (a -> b -> Ordering) -> f a -> f b -> Ordering
    liftCompare a -> b -> Ordering
    cmp f a
    f f b
    f' Ordering -> Ordering -> Ordering
    forall a. Semigroup a => a -> a -> a
    <> (a -> b -> Ordering) -> g a -> g b -> Ordering
    forall a b. (a -> b -> Ordering) -> g a -> g b -> Ordering
    forall (f :: * -> *) a b.
    Ord1 f =>
    (a -> b -> Ordering) -> f a -> f b -> Ordering
    liftCompare a -> b -> Ordering
    cmp g a
    g g b
    g'

    instance (Show1 f, Show1 g) => Show1 (f :*: g) where
      liftShowsPrec :: forall a.
    (Int -> a -> ShowS)
    -> ([a] -> ShowS) -> Int -> (:*:) f g a -> ShowS
    liftShowsPrec Int -> a -> ShowS
    sp [a] -> ShowS
    sl Int
    d = \(f a
    a :*: g a
    b) ->
        (Int -> f a -> ShowS)
    -> (Int -> g a -> ShowS)
    -> Int
    -> String
    -> Int
    -> f a
    -> g a
    -> ShowS
    forall a b.
    (Int -> a -> ShowS)
    -> (Int -> b -> ShowS) -> Int -> String -> Int -> a -> b -> ShowS
    showsBinaryOpWith
          ((Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS
    forall a.
    (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS
    forall (f :: * -> *) a.
    Show1 f =>
    (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS
    liftShowsPrec Int -> a -> ShowS
    sp [a] -> ShowS
    sl)
          ((Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> g a -> ShowS
    forall a.
    (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> g a -> ShowS
    forall (f :: * -> *) a.
    Show1 f =>
    (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS
    liftShowsPrec Int -> a -> ShowS
    sp [a] -> ShowS
    sl)
          Int
    7
          String
    ":*:"
          Int
    d
          f a
    a
          g a
    b

    instance (Read1 f, Read1 g) => Read1 (f :*: g) where
    # if MIN_VERSION_base(4,10,0)
      liftReadPrec :: forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec ((:*:) f g a)
    liftReadPrec ReadPrec a
    rp ReadPrec [a]
    rl = ReadPrec ((:*:) f g a) -> ReadPrec ((:*:) f g a)
    forall a. ReadPrec a -> ReadPrec a
    parens (ReadPrec ((:*:) f g a) -> ReadPrec ((:*:) f g a))
    -> ReadPrec ((:*:) f g a) -> ReadPrec ((:*:) f g a)
    forall a b. (a -> b) -> a -> b
    $ Int -> ReadPrec ((:*:) f g a) -> ReadPrec ((:*:) f g a)
    forall a. Int -> ReadPrec a -> ReadPrec a
    prec Int
    6 (ReadPrec ((:*:) f g a) -> ReadPrec ((:*:) f g a))
    -> ReadPrec ((:*:) f g a) -> ReadPrec ((:*:) f g a)
    forall a b. (a -> b) -> a -> b
    $
        ReadPrec (f a)
    -> ReadPrec (g a)
    -> String
    -> (f a -> g a -> (:*:) f g a)
    -> ReadPrec ((:*:) f g a)
    forall a b t.
    ReadPrec a -> ReadPrec b -> String -> (a -> b -> t) -> ReadPrec t
    readBinaryOpWith (ReadPrec a -> ReadPrec [a] -> ReadPrec (f a)
    forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec (f a)
    forall (f :: * -> *) a.
    Read1 f =>
    ReadPrec a -> ReadPrec [a] -> ReadPrec (f a)
    liftReadPrec ReadPrec a
    rp ReadPrec [a]
    rl) (ReadPrec a -> ReadPrec [a] -> ReadPrec (g a)
    forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec (g a)
    forall (f :: * -> *) a.
    Read1 f =>
    ReadPrec a -> ReadPrec [a] -> ReadPrec (f a)
    liftReadPrec ReadPrec a
    rp ReadPrec [a]
    rl) String
    ":*:" f a -> g a -> (:*:) f g a
    forall k (f :: k -> *) (g :: k -> *) (p :: k).
    f p -> g p -> (:*:) f g p
    (:*:)

      liftReadListPrec :: forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec [(:*:) f g a]
    liftReadListPrec  = ReadPrec a -> ReadPrec [a] -> ReadPrec [(:*:) f g a]
    forall (f :: * -> *) a.
    Read1 f =>
    ReadPrec a -> ReadPrec [a] -> ReadPrec [f a]
    liftReadListPrecDefault
      liftReadList :: forall a. (Int -> ReadS a) -> ReadS [a] -> ReadS [(:*:) f g a]
    liftReadList      = (Int -> ReadS a) -> ReadS [a] -> ReadS [(:*:) f g a]
    forall (f :: * -> *) a.
    Read1 f =>
    (Int -> ReadS a) -> ReadS [a] -> ReadS [f a]
    liftReadListDefault
    # else
      liftReadsPrec rp rl =
        readPrec_to_S $
        parens $ prec 6 $
        readBinaryOpWith
          (readS_to_Prec (liftReadsPrec rp rl))
          (readS_to_Prec (liftReadsPrec rp rl))
          ":*:"
          (:*:)
    # endif

    instance (Eq1 f, Eq1 g) => Eq1 (f :.: g) where
      liftEq :: forall a b. (a -> b -> Bool) -> (:.:) f g a -> (:.:) f g b -> Bool
    liftEq a -> b -> Bool
    eq = \(Comp1 f (g a)
    a) (Comp1 f (g b)
    a') -> (g a -> g b -> Bool) -> f (g a) -> f (g b) -> Bool
    forall a b. (a -> b -> Bool) -> f a -> f b -> Bool
    forall (f :: * -> *) a b.
    Eq1 f =>
    (a -> b -> Bool) -> f a -> f b -> Bool
    liftEq ((a -> b -> Bool) -> g a -> g b -> Bool
    forall a b. (a -> b -> Bool) -> g a -> g b -> Bool
    forall (f :: * -> *) a b.
    Eq1 f =>
    (a -> b -> Bool) -> f a -> f b -> Bool
    liftEq a -> b -> Bool
    eq) f (g a)
    a f (g b)
    a'

    instance (Ord1 f, Ord1 g) => Ord1 (f :.: g) where
      liftCompare :: forall a b.
    (a -> b -> Ordering) -> (:.:) f g a -> (:.:) f g b -> Ordering
    liftCompare a -> b -> Ordering
    cmp = \(Comp1 f (g a)
    a) (Comp1 f (g b)
    a') -> (g a -> g b -> Ordering) -> f (g a) -> f (g b) -> Ordering
    forall a b. (a -> b -> Ordering) -> f a -> f b -> Ordering
    forall (f :: * -> *) a b.
    Ord1 f =>
    (a -> b -> Ordering) -> f a -> f b -> Ordering
    liftCompare ((a -> b -> Ordering) -> g a -> g b -> Ordering
    forall a b. (a -> b -> Ordering) -> g a -> g b -> Ordering
    forall (f :: * -> *) a b.
    Ord1 f =>
    (a -> b -> Ordering) -> f a -> f b -> Ordering
    liftCompare a -> b -> Ordering
    cmp) f (g a)
    a f (g b)
    a'

    instance (Show1 f, Show1 g) => Show1 (f :.: g) where
      liftShowsPrec :: forall a.
    (Int -> a -> ShowS)
    -> ([a] -> ShowS) -> Int -> (:.:) f g a -> ShowS
    liftShowsPrec Int -> a -> ShowS
    sp [a] -> ShowS
    sl Int
    d = \(Comp1 { unComp1 :: forall k2 k1 (f :: k2 -> *) (g :: k1 -> k2) (p :: k1).
    (:.:) f g p -> f (g p)
    unComp1 = f (g a)
    a }) ->
        (Int -> f (g a) -> ShowS)
    -> String -> String -> Int -> f (g a) -> ShowS
    forall a.
    (Int -> a -> ShowS) -> String -> String -> Int -> a -> ShowS
    showsSingleFieldRecordWith
          ((Int -> g a -> ShowS)
    -> ([g a] -> ShowS) -> Int -> f (g a) -> ShowS
    forall a.
    (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS
    forall (f :: * -> *) a.
    Show1 f =>
    (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS
    liftShowsPrec ((Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> g a -> ShowS
    forall a.
    (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> g a -> ShowS
    forall (f :: * -> *) a.
    Show1 f =>
    (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS
    liftShowsPrec Int -> a -> ShowS
    sp [a] -> ShowS
    sl) ((Int -> a -> ShowS) -> ([a] -> ShowS) -> [g a] -> ShowS
    forall a. (Int -> a -> ShowS) -> ([a] -> ShowS) -> [g a] -> ShowS
    forall (f :: * -> *) a.
    Show1 f =>
    (Int -> a -> ShowS) -> ([a] -> ShowS) -> [f a] -> ShowS
    liftShowList Int -> a -> ShowS
    sp [a] -> ShowS
    sl))
          String
    "Comp1"
          String
    "unComp1"
          Int
    d
          f (g a)
    a

    instance (Read1 f, Read1 g) => Read1 (f :.: g) where
    # if MIN_VERSION_base(4,10,0)
      liftReadPrec :: forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec ((:.:) f g a)
    liftReadPrec ReadPrec a
    rp ReadPrec [a]
    rl = ReadPrec ((:.:) f g a) -> ReadPrec ((:.:) f g a)
    forall a. ReadPrec a -> ReadPrec a
    readData (ReadPrec ((:.:) f g a) -> ReadPrec ((:.:) f g a))
    -> ReadPrec ((:.:) f g a) -> ReadPrec ((:.:) f g a)
    forall a b. (a -> b) -> a -> b
    $
        ReadPrec (f (g a))
    -> String
    -> String
    -> (f (g a) -> (:.:) f g a)
    -> ReadPrec ((:.:) f g a)
    forall a t.
    ReadPrec a -> String -> String -> (a -> t) -> ReadPrec t
    readSingleFieldRecordWith
          (ReadPrec (g a) -> ReadPrec [g a] -> ReadPrec (f (g a))
    forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec (f a)
    forall (f :: * -> *) a.
    Read1 f =>
    ReadPrec a -> ReadPrec [a] -> ReadPrec (f a)
    liftReadPrec (ReadPrec a -> ReadPrec [a] -> ReadPrec (g a)
    forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec (g a)
    forall (f :: * -> *) a.
    Read1 f =>
    ReadPrec a -> ReadPrec [a] -> ReadPrec (f a)
    liftReadPrec ReadPrec a
    rp ReadPrec [a]
    rl) (ReadPrec a -> ReadPrec [a] -> ReadPrec [g a]
    forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec [g a]
    forall (f :: * -> *) a.
    Read1 f =>
    ReadPrec a -> ReadPrec [a] -> ReadPrec [f a]
    liftReadListPrec ReadPrec a
    rp ReadPrec [a]
    rl))
          String
    "Comp1"
          String
    "unComp1"
          f (g a) -> (:.:) f g a
    forall k2 k1 (f :: k2 -> *) (g :: k1 -> k2) (p :: k1).
    f (g p) -> (:.:) f g p
    Comp1

      liftReadListPrec :: forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec [(:.:) f g a]
    liftReadListPrec  = ReadPrec a -> ReadPrec [a] -> ReadPrec [(:.:) f g a]
    forall (f :: * -> *) a.
    Read1 f =>
    ReadPrec a -> ReadPrec [a] -> ReadPrec [f a]
    liftReadListPrecDefault
      liftReadList :: forall a. (Int -> ReadS a) -> ReadS [a] -> ReadS [(:.:) f g a]
    liftReadList      = (Int -> ReadS a) -> ReadS [a] -> ReadS [(:.:) f g a]
    forall (f :: * -> *) a.
    Read1 f =>
    (Int -> ReadS a) -> ReadS [a] -> ReadS [f a]
    liftReadListDefault
    # else
      liftReadsPrec rp rl =
        readPrec_to_S $
        readData $
        readSingleFieldRecordWith
          (readS_to_Prec (liftReadsPrec (liftReadsPrec rp rl) (liftReadList rp rl)))
          "Comp1"
          "unComp1"
          Comp1
    # endif

    instance Eq1 UAddr where
      -- NB cannot use eqAddr# because its module isn't safe
      liftEq :: forall a b. (a -> b -> Bool) -> UAddr a -> UAddr b -> Bool
    liftEq a -> b -> Bool
    _ = \(UAddr Addr#
    a) (UAddr Addr#
    b) -> Addr# -> URec (Ptr ()) (ZonkAny 24)
    forall k (p :: k). Addr# -> URec (Ptr ()) p
    UAddr Addr#
    a URec (Ptr ()) (ZonkAny 24) -> URec (Ptr ()) (ZonkAny 24) -> Bool
    forall a. Eq a => a -> a -> Bool
    == Addr# -> URec (Ptr ()) (ZonkAny 24)
    forall k (p :: k). Addr# -> URec (Ptr ()) p
    UAddr Addr#
    b

    instance Ord1 UAddr where
      liftCompare :: forall a b. (a -> b -> Ordering) -> UAddr a -> UAddr b -> Ordering
    liftCompare a -> b -> Ordering
    _ = \(UAddr Addr#
    a) (UAddr Addr#
    b) -> URec (Ptr ()) (ZonkAny 22)
    -> URec (Ptr ()) (ZonkAny 22) -> Ordering
    forall a. Ord a => a -> a -> Ordering
    compare (Addr# -> URec (Ptr ()) (ZonkAny 22)
    forall k (p :: k). Addr# -> URec (Ptr ()) p
    UAddr Addr#
    a) (Addr# -> URec (Ptr ()) (ZonkAny 22)
    forall k (p :: k). Addr# -> URec (Ptr ()) p
    UAddr Addr#
    b)

    instance Show1 UAddr where
      liftShowsPrec :: forall a.
    (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> UAddr a -> ShowS
    liftShowsPrec Int -> a -> ShowS
    _ [a] -> ShowS
    _ = Int -> UAddr a -> ShowS
    forall a. Show a => Int -> a -> ShowS
    showsPrec

    -- NB no Read1 for URec (Ptr ()) because there's no Read for Ptr.

    instance Eq1 UChar where
      liftEq :: forall a b. (a -> b -> Bool) -> UChar a -> UChar b -> Bool
    liftEq a -> b -> Bool
    _ = \(UChar Char#
    a) (UChar Char#
    b) -> Char# -> URec Char (ZonkAny 20)
    forall k (p :: k). Char# -> URec Char p
    UChar Char#
    a URec Char (ZonkAny 20) -> URec Char (ZonkAny 20) -> Bool
    forall a. Eq a => a -> a -> Bool
    == Char# -> URec Char (ZonkAny 20)
    forall k (p :: k). Char# -> URec Char p
    UChar Char#
    b

    instance Ord1 UChar where
      liftCompare :: forall a b. (a -> b -> Ordering) -> UChar a -> UChar b -> Ordering
    liftCompare a -> b -> Ordering
    _ = \(UChar Char#
    a) (UChar Char#
    b) -> URec Char (ZonkAny 18) -> URec Char (ZonkAny 18) -> Ordering
    forall a. Ord a => a -> a -> Ordering
    compare (Char# -> URec Char (ZonkAny 18)
    forall k (p :: k). Char# -> URec Char p
    UChar Char#
    a) (Char# -> URec Char (ZonkAny 18)
    forall k (p :: k). Char# -> URec Char p
    UChar Char#
    b)

    instance Show1 UChar where
      liftShowsPrec :: forall a.
    (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> UChar a -> ShowS
    liftShowsPrec Int -> a -> ShowS
    _ [a] -> ShowS
    _ = Int -> UChar a -> ShowS
    forall a. Show a => Int -> a -> ShowS
    showsPrec

    instance Eq1 UDouble where
      liftEq :: forall a b. (a -> b -> Bool) -> UDouble a -> UDouble b -> Bool
    liftEq a -> b -> Bool
    _ = \(UDouble Double#
    a) (UDouble Double#
    b) -> Double# -> URec Double (ZonkAny 16)
    forall k (p :: k). Double# -> URec Double p
    UDouble Double#
    a URec Double (ZonkAny 16) -> URec Double (ZonkAny 16) -> Bool
    forall a. Eq a => a -> a -> Bool
    == Double# -> URec Double (ZonkAny 16)
    forall k (p :: k). Double# -> URec Double p
    UDouble Double#
    b

    instance Ord1 UDouble where
      liftCompare :: forall a b.
    (a -> b -> Ordering) -> UDouble a -> UDouble b -> Ordering
    liftCompare a -> b -> Ordering
    _ = \(UDouble Double#
    a) (UDouble Double#
    b) -> URec Double (ZonkAny 14) -> URec Double (ZonkAny 14) -> Ordering
    forall a. Ord a => a -> a -> Ordering
    compare (Double# -> URec Double (ZonkAny 14)
    forall k (p :: k). Double# -> URec Double p
    UDouble Double#
    a) (Double# -> URec Double (ZonkAny 14)
    forall k (p :: k). Double# -> URec Double p
    UDouble Double#
    b)

    instance Show1 UDouble where
      liftShowsPrec :: forall a.
    (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> UDouble a -> ShowS
    liftShowsPrec Int -> a -> ShowS
    _ [a] -> ShowS
    _ = Int -> UDouble a -> ShowS
    forall a. Show a => Int -> a -> ShowS
    showsPrec

    instance Eq1 UFloat where
      liftEq :: forall a b. (a -> b -> Bool) -> UFloat a -> UFloat b -> Bool
    liftEq a -> b -> Bool
    _ = \(UFloat Float#
    a) (UFloat Float#
    b) -> Float# -> URec Float (ZonkAny 12)
    forall k (p :: k). Float# -> URec Float p
    UFloat Float#
    a URec Float (ZonkAny 12) -> URec Float (ZonkAny 12) -> Bool
    forall a. Eq a => a -> a -> Bool
    == Float# -> URec Float (ZonkAny 12)
    forall k (p :: k). Float# -> URec Float p
    UFloat Float#
    b

    instance Ord1 UFloat where
      liftCompare :: forall a b.
    (a -> b -> Ordering) -> UFloat a -> UFloat b -> Ordering
    liftCompare a -> b -> Ordering
    _ = \(UFloat Float#
    a) (UFloat Float#
    b) -> URec Float (ZonkAny 10) -> URec Float (ZonkAny 10) -> Ordering
    forall a. Ord a => a -> a -> Ordering
    compare (Float# -> URec Float (ZonkAny 10)
    forall k (p :: k). Float# -> URec Float p
    UFloat Float#
    a) (Float# -> URec Float (ZonkAny 10)
    forall k (p :: k). Float# -> URec Float p
    UFloat Float#
    b)

    instance Show1 UFloat where
      liftShowsPrec :: forall a.
    (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> UFloat a -> ShowS
    liftShowsPrec Int -> a -> ShowS
    _ [a] -> ShowS
    _ = Int -> UFloat a -> ShowS
    forall a. Show a => Int -> a -> ShowS
    showsPrec

    instance Eq1 UInt where
      liftEq :: forall a b. (a -> b -> Bool) -> UInt a -> UInt b -> Bool
    liftEq a -> b -> Bool
    _ = \(UInt Int#
    a) (UInt Int#
    b) -> Int# -> URec Int (ZonkAny 8)
    forall k (p :: k). Int# -> URec Int p
    UInt Int#
    a URec Int (ZonkAny 8) -> URec Int (ZonkAny 8) -> Bool
    forall a. Eq a => a -> a -> Bool
    == Int# -> URec Int (ZonkAny 8)
    forall k (p :: k). Int# -> URec Int p
    UInt Int#
    b

    instance Ord1 UInt where
      liftCompare :: forall a b. (a -> b -> Ordering) -> UInt a -> UInt b -> Ordering
    liftCompare a -> b -> Ordering
    _ = \(UInt Int#
    a) (UInt Int#
    b) -> URec Int (ZonkAny 6) -> URec Int (ZonkAny 6) -> Ordering
    forall a. Ord a => a -> a -> Ordering
    compare (Int# -> URec Int (ZonkAny 6)
    forall k (p :: k). Int# -> URec Int p
    UInt Int#
    a) (Int# -> URec Int (ZonkAny 6)
    forall k (p :: k). Int# -> URec Int p
    UInt Int#
    b)

    instance Show1 UInt where
      liftShowsPrec :: forall a.
    (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> UInt a -> ShowS
    liftShowsPrec Int -> a -> ShowS
    _ [a] -> ShowS
    _ = Int -> UInt a -> ShowS
    forall a. Show a => Int -> a -> ShowS
    showsPrec

    instance Eq1 UWord where
      liftEq :: forall a b. (a -> b -> Bool) -> UWord a -> UWord b -> Bool
    liftEq a -> b -> Bool
    _ = \(UWord Word#
    a) (UWord Word#
    b) -> Word# -> URec Word (ZonkAny 4)
    forall k (p :: k). Word# -> URec Word p
    UWord Word#
    a URec Word (ZonkAny 4) -> URec Word (ZonkAny 4) -> Bool
    forall a. Eq a => a -> a -> Bool
    == Word# -> URec Word (ZonkAny 4)
    forall k (p :: k). Word# -> URec Word p
    UWord Word#
    b

    instance Ord1 UWord where
      liftCompare :: forall a b. (a -> b -> Ordering) -> UWord a -> UWord b -> Ordering
    liftCompare a -> b -> Ordering
    _ = \(UWord Word#
    a) (UWord Word#
    b) -> URec Word (ZonkAny 2) -> URec Word (ZonkAny 2) -> Ordering
    forall a. Ord a => a -> a -> Ordering
    compare (Word# -> URec Word (ZonkAny 2)
    forall k (p :: k). Word# -> URec Word p
    UWord Word#
    a) (Word# -> URec Word (ZonkAny 2)
    forall k (p :: k). Word# -> URec Word p
    UWord Word#
    b)

    instance Show1 UWord where
      liftShowsPrec :: forall a.
    (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> UWord a -> ShowS
    liftShowsPrec Int -> a -> ShowS
    _ [a] -> ShowS
    _ = Int -> UWord a -> ShowS
    forall a. Show a => Int -> a -> ShowS
    showsPrec

    readSingleFieldRecordWith :: ReadPrec a -> String -> String -> (a -> t) -> ReadPrec t
    readSingleFieldRecordWith :: forall a t.
    ReadPrec a -> String -> String -> (a -> t) -> ReadPrec t
    readSingleFieldRecordWith ReadPrec a
    rp String
    name String
    field a -> t
    cons = ReadPrec t -> ReadPrec t
    forall a. ReadPrec a -> ReadPrec a
    parens (ReadPrec t -> ReadPrec t) -> ReadPrec t -> ReadPrec t
    forall a b. (a -> b) -> a -> b
    $ Int -> ReadPrec t -> ReadPrec t
    forall a. Int -> ReadPrec a -> ReadPrec a
    prec Int
    11 (ReadPrec t -> ReadPrec t) -> ReadPrec t -> ReadPrec t
    forall a b. (a -> b) -> a -> b
    $ do
      Lexeme -> ReadPrec ()
    expectP (Lexeme -> ReadPrec ()) -> Lexeme -> ReadPrec ()
    forall a b. (a -> b) -> a -> b
    $ String -> Lexeme
    Ident String
    name
      Lexeme -> ReadPrec ()
    expectP (Lexeme -> ReadPrec ()) -> Lexeme -> ReadPrec ()
    forall a b. (a -> b) -> a -> b
    $ String -> Lexeme
    Punc String
    "{"
      x <- String -> ReadPrec a -> ReadPrec a
    forall a. String -> ReadPrec a -> ReadPrec a
    readField String
    field (ReadPrec a -> ReadPrec a) -> ReadPrec a -> ReadPrec a
    forall a b. (a -> b) -> a -> b
    $ ReadPrec a -> ReadPrec a
    forall a. ReadPrec a -> ReadPrec a
    reset ReadPrec a
    rp
      expectP $ Punc "}"
      pure $ cons x

    readBinaryOpWith
      :: ReadPrec a
      -> ReadPrec b
      -> String
      -> (a -> b -> t)
      -> ReadPrec t
    readBinaryOpWith :: forall a b t.
    ReadPrec a -> ReadPrec b -> String -> (a -> b -> t) -> ReadPrec t
    readBinaryOpWith ReadPrec a
    rp1 ReadPrec b
    rp2 String
    name a -> b -> t
    cons =
      a -> b -> t
    cons (a -> b -> t) -> ReadPrec a -> ReadPrec (b -> t)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> ReadPrec a -> ReadPrec a
    forall a. ReadPrec a -> ReadPrec a
    step ReadPrec a
    rp1 ReadPrec (b -> t) -> ReadPrec () -> ReadPrec (b -> t)
    forall a b. ReadPrec a -> ReadPrec b -> ReadPrec a
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* Lexeme -> ReadPrec ()
    expectP (String -> Lexeme
    Symbol String
    name) ReadPrec (b -> t) -> ReadPrec b -> ReadPrec t
    forall a b. ReadPrec (a -> b) -> ReadPrec a -> ReadPrec b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> ReadPrec b -> ReadPrec b
    forall a. ReadPrec a -> ReadPrec a
    step ReadPrec b
    rp2

    # if !(MIN_VERSION_base(4,10,0))
    readData :: ReadPrec a -> ReadPrec a
    readData reader = parens $ prec 10 reader

    readUnaryWith :: ReadPrec a -> String -> (a -> t) -> ReadPrec t
    readUnaryWith rp name cons = do
        expectP $ Ident name
        x <- step rp
        return $ cons x
    # endif

    # if !(MIN_VERSION_base(4,11,0))
    readField :: String -> ReadPrec a -> ReadPrec a
    readField fieldName readVal = do
            expectP (Ident fieldName)
            expectP (Punc "=")
            readVal
    {-# NOINLINE readField #-}
    # endif

    showsSingleFieldRecordWith :: (Int -> a -> ShowS) -> String -> String -> Int -> a -> ShowS
    showsSingleFieldRecordWith :: forall a.
    (Int -> a -> ShowS) -> String -> String -> Int -> a -> ShowS
    showsSingleFieldRecordWith Int -> a -> ShowS
    sp String
    name String
    field Int
    d a
    x =
      Bool -> ShowS -> ShowS
    showParen (Int
    d Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    > Int
    appPrec) (ShowS -> ShowS) -> ShowS -> ShowS
    forall a b. (a -> b) -> a -> b
    $
        String -> ShowS
    showString String
    name ShowS -> ShowS -> ShowS
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . String -> ShowS
    showString String
    " {" ShowS -> ShowS -> ShowS
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . String -> ShowS
    showString String
    field ShowS -> ShowS -> ShowS
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . String -> ShowS
    showString String
    " = " ShowS -> ShowS -> ShowS
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Int -> a -> ShowS
    sp Int
    0 a
    x ShowS -> ShowS -> ShowS
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Char -> ShowS
    showChar Char
    '}'

    showsBinaryOpWith
      :: (Int -> a -> ShowS)
      -> (Int -> b -> ShowS)
      -> Int
      -> String
      -> Int
      -> a
      -> b
      -> ShowS
    showsBinaryOpWith :: forall a b.
    (Int -> a -> ShowS)
    -> (Int -> b -> ShowS) -> Int -> String -> Int -> a -> b -> ShowS
    showsBinaryOpWith Int -> a -> ShowS
    sp1 Int -> b -> ShowS
    sp2 Int
    opPrec String
    name Int
    d a
    x b
    y = Bool -> ShowS -> ShowS
    showParen (Int
    d Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    >= Int
    opPrec) (ShowS -> ShowS) -> ShowS -> ShowS
    forall a b. (a -> b) -> a -> b
    $
      Int -> a -> ShowS
    sp1 Int
    opPrec a
    x ShowS -> ShowS -> ShowS
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Char -> ShowS
    showChar Char
    ' ' ShowS -> ShowS -> ShowS
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . String -> ShowS
    showString String
    name ShowS -> ShowS -> ShowS
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Char -> ShowS
    showChar Char
    ' ' ShowS -> ShowS -> ShowS
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Int -> b -> ShowS
    sp2 Int
    opPrec b
    y

    instance Show (UAddr p) where
      -- This Show instance would be equivalent to what deriving Show would generate,
      -- but because deriving Show doesn't support Addr# fields we define it manually.
      showsPrec :: Int -> UAddr p -> ShowS
    showsPrec Int
    d (UAddr Addr#
    x) =
        Bool -> ShowS -> ShowS
    showParen (Int
    d Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    > Int
    appPrec)
          (\String
    y -> String -> ShowS
    showString String
    "UAddr {uAddr# = " (Int -> Ptr (ZonkAny 0) -> ShowS
    forall a. Show a => Int -> a -> ShowS
    showsPrec Int
    0 (Addr# -> Ptr (ZonkAny 0)
    forall a. Addr# -> Ptr a
    Ptr Addr#
    x) (Char -> ShowS
    showChar Char
    '}' String
    y)))
    #endif