------------------------------------------------------------------------------
--
-- | Instances of the Data class for Prelude-like types.
-- We define top-level definitions for representations.
--
------------------------------------------------------------------------------

{-# LANGUAGE TemplateHaskell, FlexibleInstances,
             UndecidableInstances, CPP, MultiParamTypeClasses #-}
#if MIN_VERSION_base(4,7,0)
{-# LANGUAGE StandaloneDeriving, DeriveDataTypeable #-}
#endif
{-# OPTIONS_GHC -fno-warn-orphans #-}
-- This is a module full of orphans, so don't warn about them

module Data.Generics.SYB.WithClass.Instances () where

import Data.Generics.SYB.WithClass.Basics
import Data.Generics.SYB.WithClass.Derive

import Data.Array
import Data.ByteString.Char8 (ByteString)
import qualified Data.ByteString.Lazy as L (ByteString)
import Data.Int              -- So we can give Data instance for Int8, ...
import Data.Word             -- So we can give Data instance for Word8, ...
import GHC.Real( Ratio(..) ) -- So we can give Data instance for Ratio
import System.IO             -- So we can give Data instance for IO, Handle
import GHC.Ptr               -- So we can give Data instance for Ptr
import GHC.ForeignPtr        -- So we can give Data instance for ForeignPtr
import GHC.Stable            -- So we can give Data instance for StablePtr
import GHC.ST                -- So we can give Data instance for ST
import Data.IORef            -- So we can give Data instance for IORef
import Control.Concurrent.MVar   -- So we can give Data instance for MVar & Co.
import qualified Data.Map as M
import qualified Data.Set as S


falseConstr :: Constr
falseConstr :: Constr
falseConstr  = DataType -> String -> [String] -> Fixity -> Constr
mkConstr DataType
boolDataType "False" [] Fixity
Prefix
trueConstr :: Constr
trueConstr :: Constr
trueConstr   = DataType -> String -> [String] -> Fixity -> Constr
mkConstr DataType
boolDataType "True"  [] Fixity
Prefix
boolDataType :: DataType
boolDataType :: DataType
boolDataType = String -> [Constr] -> DataType
mkDataType "Prelude.Bool" [Constr
falseConstr,Constr
trueConstr]

instance Sat (ctx Bool) =>
         Data ctx Bool where
  toConstr :: Proxy ctx -> Bool -> Constr
toConstr _ False = Constr
falseConstr
  toConstr _ True  = Constr
trueConstr
  gunfold :: Proxy ctx
-> (forall b r. Data ctx b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c Bool
gunfold _ _ z :: forall r. r -> c r
z c :: Constr
c  = case Constr -> ConIndex
constrIndex Constr
c of
                       1 -> Bool -> c Bool
forall r. r -> c r
z Bool
False
                       2 -> Bool -> c Bool
forall r. r -> c r
z Bool
True
                       _ -> String -> c Bool
forall a. HasCallStack => String -> a
error "gunfold Bool"
  dataTypeOf :: Proxy ctx -> Bool -> DataType
dataTypeOf _ _ = DataType
boolDataType


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


charType :: DataType
charType :: DataType
charType = String -> DataType
mkStringType "Prelude.Char"

instance Sat (ctx Char) =>
         Data ctx Char where
  toConstr :: Proxy ctx -> Char -> Constr
toConstr _ x :: Char
x = DataType -> String -> Constr
mkStringConstr DataType
charType [Char
x]
  gunfold :: Proxy ctx
-> (forall b r. Data ctx b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c Char
gunfold _ _ z :: forall r. r -> c r
z c :: Constr
c = case Constr -> ConstrRep
constrRep Constr
c of
                      (StringConstr [x :: Char
x]) -> Char -> c Char
forall r. r -> c r
z Char
x
                      _ -> String -> c Char
forall a. HasCallStack => String -> a
error "gunfold Char"
  dataTypeOf :: Proxy ctx -> Char -> DataType
dataTypeOf _ _ = DataType
charType


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


floatType :: DataType
floatType :: DataType
floatType = String -> DataType
mkFloatType "Prelude.Float"

instance Sat (ctx Float) =>
         Data ctx Float where
  toConstr :: Proxy ctx -> Float -> Constr
toConstr _ x :: Float
x = DataType -> Double -> Constr
mkFloatConstr DataType
floatType (Float -> Double
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
x)
  gunfold :: Proxy ctx
-> (forall b r. Data ctx b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c Float
gunfold _ _ z :: forall r. r -> c r
z c :: Constr
c = case Constr -> ConstrRep
constrRep Constr
c of
                      (FloatConstr x :: Double
x) -> Float -> c Float
forall r. r -> c r
z (Double -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
x)
                      _ -> String -> c Float
forall a. HasCallStack => String -> a
error "gunfold Float"
  dataTypeOf :: Proxy ctx -> Float -> DataType
dataTypeOf _ _ = DataType
floatType


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


doubleType :: DataType
doubleType :: DataType
doubleType = String -> DataType
mkFloatType "Prelude.Double"

instance Sat (ctx Double) =>
         Data ctx Double where
  toConstr :: Proxy ctx -> Double -> Constr
toConstr _ = DataType -> Double -> Constr
mkFloatConstr DataType
floatType
  gunfold :: Proxy ctx
-> (forall b r. Data ctx b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c Double
gunfold _ _ z :: forall r. r -> c r
z c :: Constr
c = case Constr -> ConstrRep
constrRep Constr
c of
                      (FloatConstr x :: Double
x) -> Double -> c Double
forall r. r -> c r
z Double
x
                      _ -> String -> c Double
forall a. HasCallStack => String -> a
error "gunfold Double"
  dataTypeOf :: Proxy ctx -> Double -> DataType
dataTypeOf _ _ = DataType
doubleType


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


intType :: DataType
intType :: DataType
intType = String -> DataType
mkIntType "Prelude.Int"

instance Sat (ctx Int) =>
         Data ctx Int where
  toConstr :: Proxy ctx -> ConIndex -> Constr
toConstr _ x :: ConIndex
x = DataType -> Integer -> Constr
mkIntConstr DataType
intType (ConIndex -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral ConIndex
x)
  gunfold :: Proxy ctx
-> (forall b r. Data ctx b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c ConIndex
gunfold _ _ z :: forall r. r -> c r
z c :: Constr
c = case Constr -> ConstrRep
constrRep Constr
c of
                      (IntConstr x :: Integer
x) -> ConIndex -> c ConIndex
forall r. r -> c r
z (Integer -> ConIndex
forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
x)
                      _ -> String -> c ConIndex
forall a. HasCallStack => String -> a
error "gunfold Int"
  dataTypeOf :: Proxy ctx -> ConIndex -> DataType
dataTypeOf _ _ = DataType
intType


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


integerType :: DataType
integerType :: DataType
integerType = String -> DataType
mkIntType "Prelude.Integer"

instance Sat (ctx Integer) =>
         Data ctx Integer where
  toConstr :: Proxy ctx -> Integer -> Constr
toConstr _ = DataType -> Integer -> Constr
mkIntConstr DataType
integerType
  gunfold :: Proxy ctx
-> (forall b r. Data ctx b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c Integer
gunfold _ _ z :: forall r. r -> c r
z c :: Constr
c = case Constr -> ConstrRep
constrRep Constr
c of
                      (IntConstr x :: Integer
x) -> Integer -> c Integer
forall r. r -> c r
z Integer
x
                      _ -> String -> c Integer
forall a. HasCallStack => String -> a
error "gunfold Integer"
  dataTypeOf :: Proxy ctx -> Integer -> DataType
dataTypeOf _ _ = DataType
integerType


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


int8Type :: DataType
int8Type :: DataType
int8Type = String -> DataType
mkIntType "Data.Int.Int8"

instance Sat (ctx Int8) =>
         Data ctx Int8 where
  toConstr :: Proxy ctx -> Int8 -> Constr
toConstr _ x :: Int8
x = DataType -> Integer -> Constr
mkIntConstr DataType
int8Type (Int8 -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int8
x)
  gunfold :: Proxy ctx
-> (forall b r. Data ctx b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c Int8
gunfold _ _ z :: forall r. r -> c r
z c :: Constr
c = case Constr -> ConstrRep
constrRep Constr
c of
                      (IntConstr x :: Integer
x) -> Int8 -> c Int8
forall r. r -> c r
z (Integer -> Int8
forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
x)
                      _ -> String -> c Int8
forall a. HasCallStack => String -> a
error "gunfold Int8"
  dataTypeOf :: Proxy ctx -> Int8 -> DataType
dataTypeOf _ _ = DataType
int8Type


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


int16Type :: DataType
int16Type :: DataType
int16Type = String -> DataType
mkIntType "Data.Int.Int16"

instance Sat (ctx Int16) =>
         Data ctx Int16 where
  toConstr :: Proxy ctx -> Int16 -> Constr
toConstr _ x :: Int16
x = DataType -> Integer -> Constr
mkIntConstr DataType
int16Type (Int16 -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int16
x)
  gunfold :: Proxy ctx
-> (forall b r. Data ctx b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c Int16
gunfold _ _ z :: forall r. r -> c r
z c :: Constr
c = case Constr -> ConstrRep
constrRep Constr
c of
                      (IntConstr x :: Integer
x) -> Int16 -> c Int16
forall r. r -> c r
z (Integer -> Int16
forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
x)
                      _ -> String -> c Int16
forall a. HasCallStack => String -> a
error "gunfold Int16"
  dataTypeOf :: Proxy ctx -> Int16 -> DataType
dataTypeOf _ _ = DataType
int16Type


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


int32Type :: DataType
int32Type :: DataType
int32Type = String -> DataType
mkIntType "Data.Int.Int32"

instance Sat (ctx Int32) =>
         Data ctx Int32 where
  toConstr :: Proxy ctx -> Int32 -> Constr
toConstr _ x :: Int32
x = DataType -> Integer -> Constr
mkIntConstr DataType
int32Type (Int32 -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int32
x)
  gunfold :: Proxy ctx
-> (forall b r. Data ctx b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c Int32
gunfold _ _ z :: forall r. r -> c r
z c :: Constr
c = case Constr -> ConstrRep
constrRep Constr
c of
                      (IntConstr x :: Integer
x) -> Int32 -> c Int32
forall r. r -> c r
z (Integer -> Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
x)
                      _ -> String -> c Int32
forall a. HasCallStack => String -> a
error "gunfold Int32"
  dataTypeOf :: Proxy ctx -> Int32 -> DataType
dataTypeOf _ _ = DataType
int32Type


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


int64Type :: DataType
int64Type :: DataType
int64Type = String -> DataType
mkIntType "Data.Int.Int64"

instance Sat (ctx Int64) =>
         Data ctx Int64 where
  toConstr :: Proxy ctx -> Int64 -> Constr
toConstr _ x :: Int64
x = DataType -> Integer -> Constr
mkIntConstr DataType
int64Type (Int64 -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int64
x)
  gunfold :: Proxy ctx
-> (forall b r. Data ctx b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c Int64
gunfold _ _ z :: forall r. r -> c r
z c :: Constr
c = case Constr -> ConstrRep
constrRep Constr
c of
                      (IntConstr x :: Integer
x) -> Int64 -> c Int64
forall r. r -> c r
z (Integer -> Int64
forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
x)
                      _ -> String -> c Int64
forall a. HasCallStack => String -> a
error "gunfold Int64"
  dataTypeOf :: Proxy ctx -> Int64 -> DataType
dataTypeOf _ _ = DataType
int64Type


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


wordType :: DataType
wordType :: DataType
wordType = String -> DataType
mkIntType "Data.Word.Word"

instance Sat (ctx Word) =>
         Data ctx Word where
  toConstr :: Proxy ctx -> Word -> Constr
toConstr _ x :: Word
x = DataType -> Integer -> Constr
mkIntConstr DataType
wordType (Word -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
x)
  gunfold :: Proxy ctx
-> (forall b r. Data ctx b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c Word
gunfold _ _ z :: forall r. r -> c r
z c :: Constr
c = case Constr -> ConstrRep
constrRep Constr
c of
                      (IntConstr x :: Integer
x) -> Word -> c Word
forall r. r -> c r
z (Integer -> Word
forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
x)
                      _ -> String -> c Word
forall a. HasCallStack => String -> a
error "gunfold Word"
  dataTypeOf :: Proxy ctx -> Word -> DataType
dataTypeOf _ _ = DataType
wordType


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


word8Type :: DataType
word8Type :: DataType
word8Type = String -> DataType
mkIntType "Data.Word.Word8"

instance Sat (ctx Word8) =>
         Data ctx Word8 where
  toConstr :: Proxy ctx -> Word8 -> Constr
toConstr _ x :: Word8
x = DataType -> Integer -> Constr
mkIntConstr DataType
word8Type (Word8 -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word8
x)
  gunfold :: Proxy ctx
-> (forall b r. Data ctx b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c Word8
gunfold _ _ z :: forall r. r -> c r
z c :: Constr
c = case Constr -> ConstrRep
constrRep Constr
c of
                      (IntConstr x :: Integer
x) -> Word8 -> c Word8
forall r. r -> c r
z (Integer -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
x)
                      _ -> String -> c Word8
forall a. HasCallStack => String -> a
error "gunfold Word8"
  dataTypeOf :: Proxy ctx -> Word8 -> DataType
dataTypeOf _ _ = DataType
word8Type


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


word16Type :: DataType
word16Type :: DataType
word16Type = String -> DataType
mkIntType "Data.Word.Word16"

instance Sat (ctx Word16) =>
         Data ctx Word16 where
  toConstr :: Proxy ctx -> Word16 -> Constr
toConstr _ x :: Word16
x = DataType -> Integer -> Constr
mkIntConstr DataType
word16Type (Word16 -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word16
x)
  gunfold :: Proxy ctx
-> (forall b r. Data ctx b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c Word16
gunfold _ _ z :: forall r. r -> c r
z c :: Constr
c = case Constr -> ConstrRep
constrRep Constr
c of
                      (IntConstr x :: Integer
x) -> Word16 -> c Word16
forall r. r -> c r
z (Integer -> Word16
forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
x)
                      _ -> String -> c Word16
forall a. HasCallStack => String -> a
error "gunfold Word16"
  dataTypeOf :: Proxy ctx -> Word16 -> DataType
dataTypeOf _ _ = DataType
word16Type


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


word32Type :: DataType
word32Type :: DataType
word32Type = String -> DataType
mkIntType "Data.Word.Word32"

instance Sat (ctx Word32) =>
         Data ctx Word32 where
  toConstr :: Proxy ctx -> Word32 -> Constr
toConstr _ x :: Word32
x = DataType -> Integer -> Constr
mkIntConstr DataType
word32Type (Word32 -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word32
x)
  gunfold :: Proxy ctx
-> (forall b r. Data ctx b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c Word32
gunfold _ _ z :: forall r. r -> c r
z c :: Constr
c = case Constr -> ConstrRep
constrRep Constr
c of
                      (IntConstr x :: Integer
x) -> Word32 -> c Word32
forall r. r -> c r
z (Integer -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
x)
                      _ -> String -> c Word32
forall a. HasCallStack => String -> a
error "gunfold Word32"
  dataTypeOf :: Proxy ctx -> Word32 -> DataType
dataTypeOf _ _ = DataType
word32Type


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


word64Type :: DataType
word64Type :: DataType
word64Type = String -> DataType
mkIntType "Data.Word.Word64"

instance Sat (ctx Word64) =>
         Data ctx Word64 where
  toConstr :: Proxy ctx -> Word64 -> Constr
toConstr _ x :: Word64
x = DataType -> Integer -> Constr
mkIntConstr DataType
word64Type (Word64 -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word64
x)
  gunfold :: Proxy ctx
-> (forall b r. Data ctx b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c Word64
gunfold _ _ z :: forall r. r -> c r
z c :: Constr
c = case Constr -> ConstrRep
constrRep Constr
c of
                      (IntConstr x :: Integer
x) -> Word64 -> c Word64
forall r. r -> c r
z (Integer -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
x)
                      _ -> String -> c Word64
forall a. HasCallStack => String -> a
error "gunfold Word64"
  dataTypeOf :: Proxy ctx -> Word64 -> DataType
dataTypeOf _ _ = DataType
word64Type




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


ratioConstr :: Constr
ratioConstr :: Constr
ratioConstr = DataType -> String -> [String] -> Fixity -> Constr
mkConstr DataType
ratioDataType ":%" [] Fixity
Infix
ratioDataType :: DataType
ratioDataType :: DataType
ratioDataType = String -> [Constr] -> DataType
mkDataType "GHC.Real.Ratio" [Constr
ratioConstr]

instance (Sat (ctx (Ratio a)), Data ctx a, Integral a) =>
          Data ctx (Ratio a) where
  toConstr :: Proxy ctx -> Ratio a -> Constr
toConstr _ _ = Constr
ratioConstr
  gunfold :: Proxy ctx
-> (forall b r. Data ctx b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c (Ratio a)
gunfold _ k :: forall b r. Data ctx b => c (b -> r) -> c r
k z :: forall r. r -> c r
z c :: Constr
c | Constr -> ConIndex
constrIndex Constr
c ConIndex -> ConIndex -> Bool
forall a. Eq a => a -> a -> Bool
== 1 = c (a -> Ratio a) -> c (Ratio a)
forall b r. Data ctx b => c (b -> r) -> c r
k (c (a -> a -> Ratio a) -> c (a -> Ratio a)
forall b r. Data ctx b => c (b -> r) -> c r
k ((a -> a -> Ratio a) -> c (a -> a -> Ratio a)
forall r. r -> c r
z a -> a -> Ratio a
forall a. a -> a -> Ratio a
(:%)))
  gunfold _ _ _ _ = String -> c (Ratio a)
forall a. HasCallStack => String -> a
error "gunfold Ratio"
  dataTypeOf :: Proxy ctx -> Ratio a -> DataType
dataTypeOf _ _  = DataType
ratioDataType


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


nilConstr :: Constr
nilConstr :: Constr
nilConstr    = DataType -> String -> [String] -> Fixity -> Constr
mkConstr DataType
listDataType "[]" [] Fixity
Prefix
consConstr :: Constr
consConstr :: Constr
consConstr   = DataType -> String -> [String] -> Fixity -> Constr
mkConstr DataType
listDataType "(:)" [] Fixity
Infix
listDataType :: DataType
listDataType :: DataType
listDataType = String -> [Constr] -> DataType
mkDataType "Prelude.[]" [Constr
nilConstr,Constr
consConstr]

instance (Sat (ctx [a]), Data ctx a) =>
         Data ctx [a] where
  gfoldl :: Proxy ctx
-> (forall b c. Data ctx b => w (b -> c) -> b -> w c)
-> (forall g. g -> w g)
-> [a]
-> w [a]
gfoldl _ _ z :: forall g. g -> w g
z []     = [a] -> w [a]
forall g. g -> w g
z []
  gfoldl _ f :: forall b c. Data ctx b => w (b -> c) -> b -> w c
f z :: forall g. g -> w g
z (x :: a
x:xs :: [a]
xs) = (a -> [a] -> [a]) -> w (a -> [a] -> [a])
forall g. g -> w g
z (:) w (a -> [a] -> [a]) -> a -> w ([a] -> [a])
forall b c. Data ctx b => w (b -> c) -> b -> w c
`f` a
x w ([a] -> [a]) -> [a] -> w [a]
forall b c. Data ctx b => w (b -> c) -> b -> w c
`f` [a]
xs
  toConstr :: Proxy ctx -> [a] -> Constr
toConstr _ []    = Constr
nilConstr
  toConstr _ (_:_) = Constr
consConstr
  gunfold :: Proxy ctx
-> (forall b r. Data ctx b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c [a]
gunfold _ k :: forall b r. Data ctx b => c (b -> r) -> c r
k z :: forall r. r -> c r
z c :: Constr
c = case Constr -> ConIndex
constrIndex Constr
c of
                      1 -> [a] -> c [a]
forall r. r -> c r
z []
                      2 -> c ([a] -> [a]) -> c [a]
forall b r. Data ctx b => c (b -> r) -> c r
k (c (a -> [a] -> [a]) -> c ([a] -> [a])
forall b r. Data ctx b => c (b -> r) -> c r
k ((a -> [a] -> [a]) -> c (a -> [a] -> [a])
forall r. r -> c r
z (:)))
                      _ -> String -> c [a]
forall a. HasCallStack => String -> a
error "gunfold List"
  dataTypeOf :: Proxy ctx -> [a] -> DataType
dataTypeOf _ _ = DataType
listDataType
  dataCast1 :: Proxy ctx -> (forall b. Data ctx b => w (t b)) -> Maybe (w [a])
dataCast1 _ f :: forall b. Data ctx b => w (t b)
f = w (t a) -> Maybe (w [a])
forall k1 k2 (c :: k1 -> *) (t :: k2 -> k1) (t' :: k2 -> k1)
       (a :: k2).
(Typeable t, Typeable t') =>
c (t a) -> Maybe (c (t' a))
gcast1 w (t a)
forall b. Data ctx b => w (t b)
f

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


nothingConstr :: Constr
nothingConstr :: Constr
nothingConstr = DataType -> String -> [String] -> Fixity -> Constr
mkConstr DataType
maybeDataType "Nothing" [] Fixity
Prefix
justConstr :: Constr
justConstr :: Constr
justConstr    = DataType -> String -> [String] -> Fixity -> Constr
mkConstr DataType
maybeDataType "Just"    [] Fixity
Prefix
maybeDataType :: DataType
maybeDataType :: DataType
maybeDataType = String -> [Constr] -> DataType
mkDataType "Prelude.Maybe" [Constr
nothingConstr,Constr
justConstr]

instance (Sat (ctx (Maybe a)), Data ctx a) =>
          Data ctx (Maybe a) where
  gfoldl :: Proxy ctx
-> (forall b c. Data ctx b => w (b -> c) -> b -> w c)
-> (forall g. g -> w g)
-> Maybe a
-> w (Maybe a)
gfoldl _ _ z :: forall g. g -> w g
z Nothing  = Maybe a -> w (Maybe a)
forall g. g -> w g
z Maybe a
forall a. Maybe a
Nothing
  gfoldl _ f :: forall b c. Data ctx b => w (b -> c) -> b -> w c
f z :: forall g. g -> w g
z (Just x :: a
x) = (a -> Maybe a) -> w (a -> Maybe a)
forall g. g -> w g
z a -> Maybe a
forall a. a -> Maybe a
Just w (a -> Maybe a) -> a -> w (Maybe a)
forall b c. Data ctx b => w (b -> c) -> b -> w c
`f` a
x
  toConstr :: Proxy ctx -> Maybe a -> Constr
toConstr _ Nothing  = Constr
nothingConstr
  toConstr _ (Just _) = Constr
justConstr
  gunfold :: Proxy ctx
-> (forall b r. Data ctx b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c (Maybe a)
gunfold _ k :: forall b r. Data ctx b => c (b -> r) -> c r
k z :: forall r. r -> c r
z c :: Constr
c = case Constr -> ConIndex
constrIndex Constr
c of
                      1 -> Maybe a -> c (Maybe a)
forall r. r -> c r
z Maybe a
forall a. Maybe a
Nothing
                      2 -> c (a -> Maybe a) -> c (Maybe a)
forall b r. Data ctx b => c (b -> r) -> c r
k ((a -> Maybe a) -> c (a -> Maybe a)
forall r. r -> c r
z a -> Maybe a
forall a. a -> Maybe a
Just)
                      _ -> String -> c (Maybe a)
forall a. HasCallStack => String -> a
error "gunfold Maybe"
  dataTypeOf :: Proxy ctx -> Maybe a -> DataType
dataTypeOf _ _ = DataType
maybeDataType
  dataCast1 :: Proxy ctx
-> (forall b. Data ctx b => w (t b)) -> Maybe (w (Maybe a))
dataCast1 _ f :: forall b. Data ctx b => w (t b)
f  = w (t a) -> Maybe (w (Maybe a))
forall k1 k2 (c :: k1 -> *) (t :: k2 -> k1) (t' :: k2 -> k1)
       (a :: k2).
(Typeable t, Typeable t') =>
c (t a) -> Maybe (c (t' a))
gcast1 w (t a)
forall b. Data ctx b => w (t b)
f


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


ltConstr :: Constr
ltConstr :: Constr
ltConstr         = DataType -> String -> [String] -> Fixity -> Constr
mkConstr DataType
orderingDataType "LT" [] Fixity
Prefix
eqConstr :: Constr
eqConstr :: Constr
eqConstr         = DataType -> String -> [String] -> Fixity -> Constr
mkConstr DataType
orderingDataType "EQ" [] Fixity
Prefix
gtConstr :: Constr
gtConstr :: Constr
gtConstr         = DataType -> String -> [String] -> Fixity -> Constr
mkConstr DataType
orderingDataType "GT" [] Fixity
Prefix
orderingDataType :: DataType
orderingDataType :: DataType
orderingDataType = String -> [Constr] -> DataType
mkDataType "Prelude.Ordering" [Constr
ltConstr,Constr
eqConstr,Constr
gtConstr]

instance Sat (ctx Ordering) =>
         Data ctx Ordering where
  gfoldl :: Proxy ctx
-> (forall b c. Data ctx b => w (b -> c) -> b -> w c)
-> (forall g. g -> w g)
-> Ordering
-> w Ordering
gfoldl _ _ z :: forall g. g -> w g
z LT  = Ordering -> w Ordering
forall g. g -> w g
z Ordering
LT
  gfoldl _ _ z :: forall g. g -> w g
z EQ  = Ordering -> w Ordering
forall g. g -> w g
z Ordering
EQ
  gfoldl _ _ z :: forall g. g -> w g
z GT  = Ordering -> w Ordering
forall g. g -> w g
z Ordering
GT
  toConstr :: Proxy ctx -> Ordering -> Constr
toConstr _ LT  = Constr
ltConstr
  toConstr _ EQ  = Constr
eqConstr
  toConstr _ GT  = Constr
gtConstr
  gunfold :: Proxy ctx
-> (forall b r. Data ctx b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c Ordering
gunfold _ _ z :: forall r. r -> c r
z c :: Constr
c = case Constr -> ConIndex
constrIndex Constr
c of
                      1 -> Ordering -> c Ordering
forall r. r -> c r
z Ordering
LT
                      2 -> Ordering -> c Ordering
forall r. r -> c r
z Ordering
EQ
                      3 -> Ordering -> c Ordering
forall r. r -> c r
z Ordering
GT
                      _ -> String -> c Ordering
forall a. HasCallStack => String -> a
error "gunfold Ordering"
  dataTypeOf :: Proxy ctx -> Ordering -> DataType
dataTypeOf _ _ = DataType
orderingDataType


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


leftConstr :: Constr
leftConstr :: Constr
leftConstr     = DataType -> String -> [String] -> Fixity -> Constr
mkConstr DataType
eitherDataType "Left"  [] Fixity
Prefix
rightConstr :: Constr
rightConstr :: Constr
rightConstr    = DataType -> String -> [String] -> Fixity -> Constr
mkConstr DataType
eitherDataType "Right" [] Fixity
Prefix
eitherDataType :: DataType
eitherDataType :: DataType
eitherDataType = String -> [Constr] -> DataType
mkDataType "Prelude.Either" [Constr
leftConstr,Constr
rightConstr]

instance (Sat (ctx (Either a b)), Data ctx a, Data ctx b) =>
          Data ctx (Either a b) where
  gfoldl :: Proxy ctx
-> (forall b c. Data ctx b => w (b -> c) -> b -> w c)
-> (forall g. g -> w g)
-> Either a b
-> w (Either a b)
gfoldl _ f :: forall b c. Data ctx b => w (b -> c) -> b -> w c
f z :: forall g. g -> w g
z (Left a :: a
a)   = (a -> Either a b) -> w (a -> Either a b)
forall g. g -> w g
z a -> Either a b
forall a b. a -> Either a b
Left  w (a -> Either a b) -> a -> w (Either a b)
forall b c. Data ctx b => w (b -> c) -> b -> w c
`f` a
a
  gfoldl _ f :: forall b c. Data ctx b => w (b -> c) -> b -> w c
f z :: forall g. g -> w g
z (Right a :: b
a)  = (b -> Either a b) -> w (b -> Either a b)
forall g. g -> w g
z b -> Either a b
forall a b. b -> Either a b
Right w (b -> Either a b) -> b -> w (Either a b)
forall b c. Data ctx b => w (b -> c) -> b -> w c
`f` b
a
  toConstr :: Proxy ctx -> Either a b -> Constr
toConstr _ (Left _)  = Constr
leftConstr
  toConstr _ (Right _) = Constr
rightConstr
  gunfold :: Proxy ctx
-> (forall b r. Data ctx b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c (Either a b)
gunfold _ k :: forall b r. Data ctx b => c (b -> r) -> c r
k z :: forall r. r -> c r
z c :: Constr
c = case Constr -> ConIndex
constrIndex Constr
c of
                      1 -> c (a -> Either a b) -> c (Either a b)
forall b r. Data ctx b => c (b -> r) -> c r
k ((a -> Either a b) -> c (a -> Either a b)
forall r. r -> c r
z a -> Either a b
forall a b. a -> Either a b
Left)
                      2 -> c (b -> Either a b) -> c (Either a b)
forall b r. Data ctx b => c (b -> r) -> c r
k ((b -> Either a b) -> c (b -> Either a b)
forall r. r -> c r
z b -> Either a b
forall a b. b -> Either a b
Right)
                      _ -> String -> c (Either a b)
forall a. HasCallStack => String -> a
error "gunfold Either"
  dataTypeOf :: Proxy ctx -> Either a b -> DataType
dataTypeOf _ _ = DataType
eitherDataType
  dataCast2 :: Proxy ctx
-> (forall b c. (Data ctx b, Data ctx c) => w (t b c))
-> Maybe (w (Either a b))
dataCast2 _ f :: forall b c. (Data ctx b, Data ctx c) => w (t b c)
f  = w (t a b) -> Maybe (w (Either a b))
forall k1 k2 k3 (c :: k1 -> *) (t :: k2 -> k3 -> k1)
       (t' :: k2 -> k3 -> k1) (a :: k2) (b :: k3).
(Typeable t, Typeable t') =>
c (t a b) -> Maybe (c (t' a b))
gcast2 w (t a b)
forall b c. (Data ctx b, Data ctx c) => w (t b c)
f


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


--
-- A last resort for functions
--

instance (Sat (ctx (a -> b)), Data ctx a, Data ctx b) =>
          Data ctx (a -> b) where
  toConstr :: Proxy ctx -> (a -> b) -> Constr
toConstr _ _   = String -> Constr
forall a. HasCallStack => String -> a
error "toConstr"
  gunfold :: Proxy ctx
-> (forall b r. Data ctx b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c (a -> b)
gunfold _ _ _  = String -> Constr -> c (a -> b)
forall a. HasCallStack => String -> a
error "gunfold (->)"
  dataTypeOf :: Proxy ctx -> (a -> b) -> DataType
dataTypeOf _ _ = String -> DataType
mkNorepType "Prelude.(->)"
  dataCast2 :: Proxy ctx
-> (forall b c. (Data ctx b, Data ctx c) => w (t b c))
-> Maybe (w (a -> b))
dataCast2 _ f :: forall b c. (Data ctx b, Data ctx c) => w (t b c)
f  = w (t a b) -> Maybe (w (a -> b))
forall k1 k2 k3 (c :: k1 -> *) (t :: k2 -> k3 -> k1)
       (t' :: k2 -> k3 -> k1) (a :: k2) (b :: k3).
(Typeable t, Typeable t') =>
c (t a b) -> Maybe (c (t' a b))
gcast2 w (t a b)
forall b c. (Data ctx b, Data ctx c) => w (t b c)
f


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


tuple0Constr :: Constr
tuple0Constr :: Constr
tuple0Constr = DataType -> String -> [String] -> Fixity -> Constr
mkConstr DataType
tuple0DataType "()" [] Fixity
Prefix
tuple0DataType :: DataType
tuple0DataType :: DataType
tuple0DataType = String -> [Constr] -> DataType
mkDataType "Prelude.()" [Constr
tuple0Constr]

instance (Sat (ctx ())) =>
          Data ctx () where
  toConstr :: Proxy ctx -> () -> Constr
toConstr _ _    = Constr
tuple0Constr
  gunfold :: Proxy ctx
-> (forall b r. Data ctx b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c ()
gunfold _ _ z :: forall r. r -> c r
z c :: Constr
c | Constr -> ConIndex
constrIndex Constr
c ConIndex -> ConIndex -> Bool
forall a. Eq a => a -> a -> Bool
== 1 = () -> c ()
forall r. r -> c r
z ()
  gunfold _ _ _ _ = String -> c ()
forall a. HasCallStack => String -> a
error "gunfold ()"
  dataTypeOf :: Proxy ctx -> () -> DataType
dataTypeOf _ _  = DataType
tuple0DataType


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


tuple2Constr :: Constr
tuple2Constr :: Constr
tuple2Constr = DataType -> String -> [String] -> Fixity -> Constr
mkConstr DataType
tuple2DataType "(,)" [] Fixity
Infix
tuple2DataType :: DataType
tuple2DataType :: DataType
tuple2DataType = String -> [Constr] -> DataType
mkDataType "Prelude.(,)" [Constr
tuple2Constr]

instance (Sat (ctx (a,b)), Data ctx a, Data ctx b) =>
          Data ctx (a,b) where
  gfoldl :: Proxy ctx
-> (forall b c. Data ctx b => w (b -> c) -> b -> w c)
-> (forall g. g -> w g)
-> (a, b)
-> w (a, b)
gfoldl _ f :: forall b c. Data ctx b => w (b -> c) -> b -> w c
f z :: forall g. g -> w g
z (a :: a
a,b :: b
b) = (a -> b -> (a, b)) -> w (a -> b -> (a, b))
forall g. g -> w g
z (,) w (a -> b -> (a, b)) -> a -> w (b -> (a, b))
forall b c. Data ctx b => w (b -> c) -> b -> w c
`f` a
a w (b -> (a, b)) -> b -> w (a, b)
forall b c. Data ctx b => w (b -> c) -> b -> w c
`f` b
b
  toConstr :: Proxy ctx -> (a, b) -> Constr
toConstr _ _    = Constr
tuple2Constr
  gunfold :: Proxy ctx
-> (forall b r. Data ctx b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c (a, b)
gunfold _ k :: forall b r. Data ctx b => c (b -> r) -> c r
k z :: forall r. r -> c r
z c :: Constr
c | Constr -> ConIndex
constrIndex Constr
c ConIndex -> ConIndex -> Bool
forall a. Eq a => a -> a -> Bool
== 1 = c (b -> (a, b)) -> c (a, b)
forall b r. Data ctx b => c (b -> r) -> c r
k (c (a -> b -> (a, b)) -> c (b -> (a, b))
forall b r. Data ctx b => c (b -> r) -> c r
k ((a -> b -> (a, b)) -> c (a -> b -> (a, b))
forall r. r -> c r
z (,)))
  gunfold _ _ _ _ = String -> c (a, b)
forall a. HasCallStack => String -> a
error "gunfold (,)"
  dataTypeOf :: Proxy ctx -> (a, b) -> DataType
dataTypeOf _ _  = DataType
tuple2DataType
  dataCast2 :: Proxy ctx
-> (forall b c. (Data ctx b, Data ctx c) => w (t b c))
-> Maybe (w (a, b))
dataCast2 _ f :: forall b c. (Data ctx b, Data ctx c) => w (t b c)
f   = w (t a b) -> Maybe (w (a, b))
forall k1 k2 k3 (c :: k1 -> *) (t :: k2 -> k3 -> k1)
       (t' :: k2 -> k3 -> k1) (a :: k2) (b :: k3).
(Typeable t, Typeable t') =>
c (t a b) -> Maybe (c (t' a b))
gcast2 w (t a b)
forall b c. (Data ctx b, Data ctx c) => w (t b c)
f


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


tuple3Constr :: Constr
tuple3Constr :: Constr
tuple3Constr = DataType -> String -> [String] -> Fixity -> Constr
mkConstr DataType
tuple3DataType "(,,)" [] Fixity
Infix
tuple3DataType :: DataType
tuple3DataType :: DataType
tuple3DataType = String -> [Constr] -> DataType
mkDataType "Prelude.(,)" [Constr
tuple3Constr]

instance (Sat (ctx (a,b,c)), Data ctx a, Data ctx b, Data ctx c) =>
          Data ctx (a,b,c) where
  gfoldl :: Proxy ctx
-> (forall b c. Data ctx b => w (b -> c) -> b -> w c)
-> (forall g. g -> w g)
-> (a, b, c)
-> w (a, b, c)
gfoldl _ f :: forall b c. Data ctx b => w (b -> c) -> b -> w c
f z :: forall g. g -> w g
z (a :: a
a,b :: b
b,c :: c
c) = (a -> b -> c -> (a, b, c)) -> w (a -> b -> c -> (a, b, c))
forall g. g -> w g
z (,,) w (a -> b -> c -> (a, b, c)) -> a -> w (b -> c -> (a, b, c))
forall b c. Data ctx b => w (b -> c) -> b -> w c
`f` a
a w (b -> c -> (a, b, c)) -> b -> w (c -> (a, b, c))
forall b c. Data ctx b => w (b -> c) -> b -> w c
`f` b
b w (c -> (a, b, c)) -> c -> w (a, b, c)
forall b c. Data ctx b => w (b -> c) -> b -> w c
`f` c
c
  toConstr :: Proxy ctx -> (a, b, c) -> Constr
toConstr _ _    = Constr
tuple3Constr
  gunfold :: Proxy ctx
-> (forall b r. Data ctx b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c (a, b, c)
gunfold _ k :: forall b r. Data ctx b => c (b -> r) -> c r
k z :: forall r. r -> c r
z c :: Constr
c | Constr -> ConIndex
constrIndex Constr
c ConIndex -> ConIndex -> Bool
forall a. Eq a => a -> a -> Bool
== 1 = c (c -> (a, b, c)) -> c (a, b, c)
forall b r. Data ctx b => c (b -> r) -> c r
k (c (b -> c -> (a, b, c)) -> c (c -> (a, b, c))
forall b r. Data ctx b => c (b -> r) -> c r
k (c (a -> b -> c -> (a, b, c)) -> c (b -> c -> (a, b, c))
forall b r. Data ctx b => c (b -> r) -> c r
k ((a -> b -> c -> (a, b, c)) -> c (a -> b -> c -> (a, b, c))
forall r. r -> c r
z (,,))))
  gunfold _ _ _ _ = String -> c (a, b, c)
forall a. HasCallStack => String -> a
error "gunfold (,,)"
  dataTypeOf :: Proxy ctx -> (a, b, c) -> DataType
dataTypeOf _ _  = DataType
tuple3DataType

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


tuple4Constr :: Constr
tuple4Constr :: Constr
tuple4Constr = DataType -> String -> [String] -> Fixity -> Constr
mkConstr DataType
tuple4DataType "(,,,)" [] Fixity
Infix
tuple4DataType :: DataType
tuple4DataType :: DataType
tuple4DataType = String -> [Constr] -> DataType
mkDataType "Prelude.(,,,)" [Constr
tuple4Constr]

instance (Sat (ctx (a,b,c,d)), Data ctx a, Data ctx b, Data ctx c, Data ctx d) =>
          Data ctx (a,b,c,d) where
  gfoldl :: Proxy ctx
-> (forall b c. Data ctx b => w (b -> c) -> b -> w c)
-> (forall g. g -> w g)
-> (a, b, c, d)
-> w (a, b, c, d)
gfoldl _ f :: forall b c. Data ctx b => w (b -> c) -> b -> w c
f z :: forall g. g -> w g
z (a :: a
a,b :: b
b,c :: c
c,d :: d
d) = (a -> b -> c -> d -> (a, b, c, d))
-> w (a -> b -> c -> d -> (a, b, c, d))
forall g. g -> w g
z (,,,) w (a -> b -> c -> d -> (a, b, c, d))
-> a -> w (b -> c -> d -> (a, b, c, d))
forall b c. Data ctx b => w (b -> c) -> b -> w c
`f` a
a w (b -> c -> d -> (a, b, c, d)) -> b -> w (c -> d -> (a, b, c, d))
forall b c. Data ctx b => w (b -> c) -> b -> w c
`f` b
b w (c -> d -> (a, b, c, d)) -> c -> w (d -> (a, b, c, d))
forall b c. Data ctx b => w (b -> c) -> b -> w c
`f` c
c w (d -> (a, b, c, d)) -> d -> w (a, b, c, d)
forall b c. Data ctx b => w (b -> c) -> b -> w c
`f` d
d
  toConstr :: Proxy ctx -> (a, b, c, d) -> Constr
toConstr _ _ = Constr
tuple4Constr
  gunfold :: Proxy ctx
-> (forall b r. Data ctx b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c (a, b, c, d)
gunfold _ k :: forall b r. Data ctx b => c (b -> r) -> c r
k z :: forall r. r -> c r
z c :: Constr
c = case Constr -> ConIndex
constrIndex Constr
c of
                      1 -> c (d -> (a, b, c, d)) -> c (a, b, c, d)
forall b r. Data ctx b => c (b -> r) -> c r
k (c (c -> d -> (a, b, c, d)) -> c (d -> (a, b, c, d))
forall b r. Data ctx b => c (b -> r) -> c r
k (c (b -> c -> d -> (a, b, c, d)) -> c (c -> d -> (a, b, c, d))
forall b r. Data ctx b => c (b -> r) -> c r
k (c (a -> b -> c -> d -> (a, b, c, d))
-> c (b -> c -> d -> (a, b, c, d))
forall b r. Data ctx b => c (b -> r) -> c r
k ((a -> b -> c -> d -> (a, b, c, d))
-> c (a -> b -> c -> d -> (a, b, c, d))
forall r. r -> c r
z (,,,)))))
                      _ -> String -> c (a, b, c, d)
forall a. HasCallStack => String -> a
error "gunfold (,,,)"
  dataTypeOf :: Proxy ctx -> (a, b, c, d) -> DataType
dataTypeOf _ _ = DataType
tuple4DataType


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


tuple5Constr :: Constr
tuple5Constr :: Constr
tuple5Constr = DataType -> String -> [String] -> Fixity -> Constr
mkConstr DataType
tuple5DataType "(,,,,)" [] Fixity
Infix
tuple5DataType :: DataType
tuple5DataType :: DataType
tuple5DataType = String -> [Constr] -> DataType
mkDataType "Prelude.(,,,,)" [Constr
tuple5Constr]

instance (Sat (ctx (a,b,c,d,e)), Data ctx a, Data ctx b, Data ctx c, Data ctx d, Data ctx e) =>
          Data ctx (a,b,c,d,e) where
  gfoldl :: Proxy ctx
-> (forall b c. Data ctx b => w (b -> c) -> b -> w c)
-> (forall g. g -> w g)
-> (a, b, c, d, e)
-> w (a, b, c, d, e)
gfoldl _ f :: forall b c. Data ctx b => w (b -> c) -> b -> w c
f z :: forall g. g -> w g
z (a :: a
a,b :: b
b,c :: c
c,d :: d
d,e :: e
e) = (a -> b -> c -> d -> e -> (a, b, c, d, e))
-> w (a -> b -> c -> d -> e -> (a, b, c, d, e))
forall g. g -> w g
z (,,,,) w (a -> b -> c -> d -> e -> (a, b, c, d, e))
-> a -> w (b -> c -> d -> e -> (a, b, c, d, e))
forall b c. Data ctx b => w (b -> c) -> b -> w c
`f` a
a w (b -> c -> d -> e -> (a, b, c, d, e))
-> b -> w (c -> d -> e -> (a, b, c, d, e))
forall b c. Data ctx b => w (b -> c) -> b -> w c
`f` b
b w (c -> d -> e -> (a, b, c, d, e))
-> c -> w (d -> e -> (a, b, c, d, e))
forall b c. Data ctx b => w (b -> c) -> b -> w c
`f` c
c w (d -> e -> (a, b, c, d, e)) -> d -> w (e -> (a, b, c, d, e))
forall b c. Data ctx b => w (b -> c) -> b -> w c
`f` d
d w (e -> (a, b, c, d, e)) -> e -> w (a, b, c, d, e)
forall b c. Data ctx b => w (b -> c) -> b -> w c
`f` e
e
  toConstr :: Proxy ctx -> (a, b, c, d, e) -> Constr
toConstr _ _ = Constr
tuple5Constr
  gunfold :: Proxy ctx
-> (forall b r. Data ctx b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c (a, b, c, d, e)
gunfold _ k :: forall b r. Data ctx b => c (b -> r) -> c r
k z :: forall r. r -> c r
z c :: Constr
c = case Constr -> ConIndex
constrIndex Constr
c of
                      1 -> c (e -> (a, b, c, d, e)) -> c (a, b, c, d, e)
forall b r. Data ctx b => c (b -> r) -> c r
k (c (d -> e -> (a, b, c, d, e)) -> c (e -> (a, b, c, d, e))
forall b r. Data ctx b => c (b -> r) -> c r
k (c (c -> d -> e -> (a, b, c, d, e)) -> c (d -> e -> (a, b, c, d, e))
forall b r. Data ctx b => c (b -> r) -> c r
k (c (b -> c -> d -> e -> (a, b, c, d, e))
-> c (c -> d -> e -> (a, b, c, d, e))
forall b r. Data ctx b => c (b -> r) -> c r
k (c (a -> b -> c -> d -> e -> (a, b, c, d, e))
-> c (b -> c -> d -> e -> (a, b, c, d, e))
forall b r. Data ctx b => c (b -> r) -> c r
k ((a -> b -> c -> d -> e -> (a, b, c, d, e))
-> c (a -> b -> c -> d -> e -> (a, b, c, d, e))
forall r. r -> c r
z (,,,,))))))
                      _ -> String -> c (a, b, c, d, e)
forall a. HasCallStack => String -> a
error "gunfold (,,,,)"
  dataTypeOf :: Proxy ctx -> (a, b, c, d, e) -> DataType
dataTypeOf _ _ = DataType
tuple5DataType


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


tuple6Constr :: Constr
tuple6Constr :: Constr
tuple6Constr = DataType -> String -> [String] -> Fixity -> Constr
mkConstr DataType
tuple6DataType "(,,,,,)" [] Fixity
Infix
tuple6DataType :: DataType
tuple6DataType :: DataType
tuple6DataType = String -> [Constr] -> DataType
mkDataType "Prelude.(,,,,,)" [Constr
tuple6Constr]

instance (Sat (ctx (a,b,c,d,e,f)), Data ctx a, Data ctx b, Data ctx c, Data ctx d, Data ctx e, Data ctx f) =>
          Data ctx (a,b,c,d,e,f) where
  gfoldl :: Proxy ctx
-> (forall b c. Data ctx b => w (b -> c) -> b -> w c)
-> (forall g. g -> w g)
-> (a, b, c, d, e, f)
-> w (a, b, c, d, e, f)
gfoldl _ f :: forall b c. Data ctx b => w (b -> c) -> b -> w c
f z :: forall g. g -> w g
z (a :: a
a,b :: b
b,c :: c
c,d :: d
d,e :: e
e,f' :: f
f') = (a -> b -> c -> d -> e -> f -> (a, b, c, d, e, f))
-> w (a -> b -> c -> d -> e -> f -> (a, b, c, d, e, f))
forall g. g -> w g
z (,,,,,) w (a -> b -> c -> d -> e -> f -> (a, b, c, d, e, f))
-> a -> w (b -> c -> d -> e -> f -> (a, b, c, d, e, f))
forall b c. Data ctx b => w (b -> c) -> b -> w c
`f` a
a w (b -> c -> d -> e -> f -> (a, b, c, d, e, f))
-> b -> w (c -> d -> e -> f -> (a, b, c, d, e, f))
forall b c. Data ctx b => w (b -> c) -> b -> w c
`f` b
b w (c -> d -> e -> f -> (a, b, c, d, e, f))
-> c -> w (d -> e -> f -> (a, b, c, d, e, f))
forall b c. Data ctx b => w (b -> c) -> b -> w c
`f` c
c w (d -> e -> f -> (a, b, c, d, e, f))
-> d -> w (e -> f -> (a, b, c, d, e, f))
forall b c. Data ctx b => w (b -> c) -> b -> w c
`f` d
d w (e -> f -> (a, b, c, d, e, f))
-> e -> w (f -> (a, b, c, d, e, f))
forall b c. Data ctx b => w (b -> c) -> b -> w c
`f` e
e w (f -> (a, b, c, d, e, f)) -> f -> w (a, b, c, d, e, f)
forall b c. Data ctx b => w (b -> c) -> b -> w c
`f` f
f'
  toConstr :: Proxy ctx -> (a, b, c, d, e, f) -> Constr
toConstr _ _ = Constr
tuple6Constr
  gunfold :: Proxy ctx
-> (forall b r. Data ctx b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c (a, b, c, d, e, f)
gunfold _ k :: forall b r. Data ctx b => c (b -> r) -> c r
k z :: forall r. r -> c r
z c :: Constr
c = case Constr -> ConIndex
constrIndex Constr
c of
                      1 -> c (f -> (a, b, c, d, e, f)) -> c (a, b, c, d, e, f)
forall b r. Data ctx b => c (b -> r) -> c r
k (c (e -> f -> (a, b, c, d, e, f)) -> c (f -> (a, b, c, d, e, f))
forall b r. Data ctx b => c (b -> r) -> c r
k (c (d -> e -> f -> (a, b, c, d, e, f))
-> c (e -> f -> (a, b, c, d, e, f))
forall b r. Data ctx b => c (b -> r) -> c r
k (c (c -> d -> e -> f -> (a, b, c, d, e, f))
-> c (d -> e -> f -> (a, b, c, d, e, f))
forall b r. Data ctx b => c (b -> r) -> c r
k (c (b -> c -> d -> e -> f -> (a, b, c, d, e, f))
-> c (c -> d -> e -> f -> (a, b, c, d, e, f))
forall b r. Data ctx b => c (b -> r) -> c r
k (c (a -> b -> c -> d -> e -> f -> (a, b, c, d, e, f))
-> c (b -> c -> d -> e -> f -> (a, b, c, d, e, f))
forall b r. Data ctx b => c (b -> r) -> c r
k ((a -> b -> c -> d -> e -> f -> (a, b, c, d, e, f))
-> c (a -> b -> c -> d -> e -> f -> (a, b, c, d, e, f))
forall r. r -> c r
z (,,,,,)))))))
                      _ -> String -> c (a, b, c, d, e, f)
forall a. HasCallStack => String -> a
error "gunfold (,,,,,)"
  dataTypeOf :: Proxy ctx -> (a, b, c, d, e, f) -> DataType
dataTypeOf _ _ = DataType
tuple6DataType


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


tuple7Constr :: Constr
tuple7Constr :: Constr
tuple7Constr = DataType -> String -> [String] -> Fixity -> Constr
mkConstr DataType
tuple7DataType "(,,,,,,)" [] Fixity
Infix
tuple7DataType :: DataType
tuple7DataType :: DataType
tuple7DataType = String -> [Constr] -> DataType
mkDataType "Prelude.(,,,,,,)" [Constr
tuple7Constr]

instance (Sat (ctx (a,b,c,d,e,f,g)), Data ctx a, Data ctx b, Data ctx c, Data ctx d, Data ctx e, Data ctx f, Data ctx g) =>
          Data ctx (a,b,c,d,e,f,g) where
  gfoldl :: Proxy ctx
-> (forall b c. Data ctx b => w (b -> c) -> b -> w c)
-> (forall g. g -> w g)
-> (a, b, c, d, e, f, g)
-> w (a, b, c, d, e, f, g)
gfoldl _ f :: forall b c. Data ctx b => w (b -> c) -> b -> w c
f z :: forall g. g -> w g
z (a :: a
a,b :: b
b,c :: c
c,d :: d
d,e :: e
e,f' :: f
f',g :: g
g) =
    (a -> b -> c -> d -> e -> f -> g -> (a, b, c, d, e, f, g))
-> w (a -> b -> c -> d -> e -> f -> g -> (a, b, c, d, e, f, g))
forall g. g -> w g
z (,,,,,,) w (a -> b -> c -> d -> e -> f -> g -> (a, b, c, d, e, f, g))
-> a -> w (b -> c -> d -> e -> f -> g -> (a, b, c, d, e, f, g))
forall b c. Data ctx b => w (b -> c) -> b -> w c
`f` a
a w (b -> c -> d -> e -> f -> g -> (a, b, c, d, e, f, g))
-> b -> w (c -> d -> e -> f -> g -> (a, b, c, d, e, f, g))
forall b c. Data ctx b => w (b -> c) -> b -> w c
`f` b
b w (c -> d -> e -> f -> g -> (a, b, c, d, e, f, g))
-> c -> w (d -> e -> f -> g -> (a, b, c, d, e, f, g))
forall b c. Data ctx b => w (b -> c) -> b -> w c
`f` c
c w (d -> e -> f -> g -> (a, b, c, d, e, f, g))
-> d -> w (e -> f -> g -> (a, b, c, d, e, f, g))
forall b c. Data ctx b => w (b -> c) -> b -> w c
`f` d
d w (e -> f -> g -> (a, b, c, d, e, f, g))
-> e -> w (f -> g -> (a, b, c, d, e, f, g))
forall b c. Data ctx b => w (b -> c) -> b -> w c
`f` e
e w (f -> g -> (a, b, c, d, e, f, g))
-> f -> w (g -> (a, b, c, d, e, f, g))
forall b c. Data ctx b => w (b -> c) -> b -> w c
`f` f
f' w (g -> (a, b, c, d, e, f, g)) -> g -> w (a, b, c, d, e, f, g)
forall b c. Data ctx b => w (b -> c) -> b -> w c
`f` g
g
  toConstr :: Proxy ctx -> (a, b, c, d, e, f, g) -> Constr
toConstr _ _ = Constr
tuple7Constr
  gunfold :: Proxy ctx
-> (forall b r. Data ctx b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c (a, b, c, d, e, f, g)
gunfold _ k :: forall b r. Data ctx b => c (b -> r) -> c r
k z :: forall r. r -> c r
z c :: Constr
c = case Constr -> ConIndex
constrIndex Constr
c of
                      1 -> c (g -> (a, b, c, d, e, f, g)) -> c (a, b, c, d, e, f, g)
forall b r. Data ctx b => c (b -> r) -> c r
k (c (f -> g -> (a, b, c, d, e, f, g))
-> c (g -> (a, b, c, d, e, f, g))
forall b r. Data ctx b => c (b -> r) -> c r
k (c (e -> f -> g -> (a, b, c, d, e, f, g))
-> c (f -> g -> (a, b, c, d, e, f, g))
forall b r. Data ctx b => c (b -> r) -> c r
k (c (d -> e -> f -> g -> (a, b, c, d, e, f, g))
-> c (e -> f -> g -> (a, b, c, d, e, f, g))
forall b r. Data ctx b => c (b -> r) -> c r
k (c (c -> d -> e -> f -> g -> (a, b, c, d, e, f, g))
-> c (d -> e -> f -> g -> (a, b, c, d, e, f, g))
forall b r. Data ctx b => c (b -> r) -> c r
k (c (b -> c -> d -> e -> f -> g -> (a, b, c, d, e, f, g))
-> c (c -> d -> e -> f -> g -> (a, b, c, d, e, f, g))
forall b r. Data ctx b => c (b -> r) -> c r
k (c (a -> b -> c -> d -> e -> f -> g -> (a, b, c, d, e, f, g))
-> c (b -> c -> d -> e -> f -> g -> (a, b, c, d, e, f, g))
forall b r. Data ctx b => c (b -> r) -> c r
k ((a -> b -> c -> d -> e -> f -> g -> (a, b, c, d, e, f, g))
-> c (a -> b -> c -> d -> e -> f -> g -> (a, b, c, d, e, f, g))
forall r. r -> c r
z (,,,,,,))))))))
                      _ -> String -> c (a, b, c, d, e, f, g)
forall a. HasCallStack => String -> a
error "gunfold (,,,,,,)"
  dataTypeOf :: Proxy ctx -> (a, b, c, d, e, f, g) -> DataType
dataTypeOf _ _ = DataType
tuple7DataType


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


instance Sat (ctx TypeRep) =>
         Data ctx TypeRep where
  toConstr :: Proxy ctx -> TypeRep -> Constr
toConstr _ _   = String -> Constr
forall a. HasCallStack => String -> a
error "toConstr"
  gunfold :: Proxy ctx
-> (forall b r. Data ctx b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c TypeRep
gunfold _ _ _  = String -> Constr -> c TypeRep
forall a. HasCallStack => String -> a
error "gunfold TypeRep"
  dataTypeOf :: Proxy ctx -> TypeRep -> DataType
dataTypeOf _ _ = String -> DataType
mkNorepType "Data.Typeable.TypeRep"


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


instance Sat (ctx TyCon) =>
         Data ctx TyCon where
  toConstr :: Proxy ctx -> TyCon -> Constr
toConstr _ _   = String -> Constr
forall a. HasCallStack => String -> a
error "toConstr"
  gunfold :: Proxy ctx
-> (forall b r. Data ctx b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c TyCon
gunfold _ _ _  = String -> Constr -> c TyCon
forall a. HasCallStack => String -> a
error "gunfold TyCon"
  dataTypeOf :: Proxy ctx -> TyCon -> DataType
dataTypeOf _ _ = String -> DataType
mkNorepType "Data.Typeable.TyCon"


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


-- INSTANCE_TYPEABLE0(DataType,dataTypeTc,"DataType")
#if MIN_VERSION_base(4,7,0)
deriving instance Typeable DataType
#else
#ifndef __HADDOCK__
$(deriveTypeable [''DataType])
#endif
#endif

instance Sat (ctx DataType) =>
         Data ctx DataType where
  toConstr :: Proxy ctx -> DataType -> Constr
toConstr _ _   = String -> Constr
forall a. HasCallStack => String -> a
error "toConstr"
  gunfold :: Proxy ctx
-> (forall b r. Data ctx b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c DataType
gunfold _ _ _  = String -> Constr -> c DataType
forall a. HasCallStack => String -> a
error "gunfold DataType"
  dataTypeOf :: Proxy ctx -> DataType -> DataType
dataTypeOf _ _ = String -> DataType
mkNorepType "Data.Generics.Basics.DataType"


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


instance (Sat (ctx (IO a)), Typeable a) =>
          Data ctx (IO a) where
  toConstr :: Proxy ctx -> IO a -> Constr
toConstr _ _   = String -> Constr
forall a. HasCallStack => String -> a
error "toConstr"
  gunfold :: Proxy ctx
-> (forall b r. Data ctx b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c (IO a)
gunfold _ _ _  = String -> Constr -> c (IO a)
forall a. HasCallStack => String -> a
error "gunfold IO"
  dataTypeOf :: Proxy ctx -> IO a -> DataType
dataTypeOf _ _ = String -> DataType
mkNorepType "GHC.IOBase.IO"


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


instance Sat (ctx Handle) =>
         Data ctx Handle where
  toConstr :: Proxy ctx -> Handle -> Constr
toConstr _ _   = String -> Constr
forall a. HasCallStack => String -> a
error "toConstr"
  gunfold :: Proxy ctx
-> (forall b r. Data ctx b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c Handle
gunfold _ _ _  = String -> Constr -> c Handle
forall a. HasCallStack => String -> a
error "gunfold Handle"
  dataTypeOf :: Proxy ctx -> Handle -> DataType
dataTypeOf _ _ = String -> DataType
mkNorepType "GHC.IOBase.Handle"


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


instance (Sat (ctx (Ptr a)), Typeable a) =>
          Data ctx (Ptr a) where
  toConstr :: Proxy ctx -> Ptr a -> Constr
toConstr _ _   = String -> Constr
forall a. HasCallStack => String -> a
error "toConstr"
  gunfold :: Proxy ctx
-> (forall b r. Data ctx b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c (Ptr a)
gunfold _ _ _  = String -> Constr -> c (Ptr a)
forall a. HasCallStack => String -> a
error "gunfold Ptr"
  dataTypeOf :: Proxy ctx -> Ptr a -> DataType
dataTypeOf _ _ = String -> DataType
mkNorepType "GHC.Ptr.Ptr"


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


instance (Sat (ctx (StablePtr a)), Typeable a) =>
          Data ctx (StablePtr a) where
  toConstr :: Proxy ctx -> StablePtr a -> Constr
toConstr _ _   = String -> Constr
forall a. HasCallStack => String -> a
error "toConstr"
  gunfold :: Proxy ctx
-> (forall b r. Data ctx b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c (StablePtr a)
gunfold _ _ _  = String -> Constr -> c (StablePtr a)
forall a. HasCallStack => String -> a
error "gunfold StablePtr"
  dataTypeOf :: Proxy ctx -> StablePtr a -> DataType
dataTypeOf _ _ = String -> DataType
mkNorepType "GHC.Stable.StablePtr"


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


instance (Sat (ctx (IORef a)), Typeable a) =>
          Data ctx (IORef a) where
  toConstr :: Proxy ctx -> IORef a -> Constr
toConstr _ _   = String -> Constr
forall a. HasCallStack => String -> a
error "toConstr"
  gunfold :: Proxy ctx
-> (forall b r. Data ctx b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c (IORef a)
gunfold _ _ _  = String -> Constr -> c (IORef a)
forall a. HasCallStack => String -> a
error "gunfold IORef"
  dataTypeOf :: Proxy ctx -> IORef a -> DataType
dataTypeOf _ _ = String -> DataType
mkNorepType "GHC.IOBase.IORef"


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


instance (Sat (ctx (ForeignPtr a)), Typeable a) =>
          Data ctx (ForeignPtr a) where
  toConstr :: Proxy ctx -> ForeignPtr a -> Constr
toConstr _ _   = String -> Constr
forall a. HasCallStack => String -> a
error "toConstr"
  gunfold :: Proxy ctx
-> (forall b r. Data ctx b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c (ForeignPtr a)
gunfold _ _ _  = String -> Constr -> c (ForeignPtr a)
forall a. HasCallStack => String -> a
error "gunfold ForeignPtr"
  dataTypeOf :: Proxy ctx -> ForeignPtr a -> DataType
dataTypeOf _ _ = String -> DataType
mkNorepType "GHC.ForeignPtr.ForeignPtr"


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


instance (Sat (ctx (ST s a)), Typeable s, Typeable a) =>
          Data ctx (ST s a) where
  toConstr :: Proxy ctx -> ST s a -> Constr
toConstr _ _   = String -> Constr
forall a. HasCallStack => String -> a
error "toConstr"
  gunfold :: Proxy ctx
-> (forall b r. Data ctx b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c (ST s a)
gunfold _ _ _  = String -> Constr -> c (ST s a)
forall a. HasCallStack => String -> a
error "gunfold ST"
  dataTypeOf :: Proxy ctx -> ST s a -> DataType
dataTypeOf _ _ = String -> DataType
mkNorepType "GHC.ST.ST"


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

{-
instance Sat (ctx ThreadId) =>
         Data ctx ThreadId where
  toConstr _ _   = error "toConstr"
  gunfold _ _ _  = error "gunfold ThreadId"
  dataTypeOf _ _ = mkNorepType "GHC.Conc.ThreadId"


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


instance (Sat (ctx (TVar a)), Typeable a) =>
          Data ctx (TVar a) where
  toConstr _ _   = error "toConstr"
  gunfold _ _ _  = error "gunfold TVar"
  dataTypeOf _ _ = mkNorepType "GHC.Conc.TVar"-}


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


instance (Sat (ctx (MVar a)), Typeable a) =>
          Data ctx (MVar a) where
  toConstr :: Proxy ctx -> MVar a -> Constr
toConstr _ _   = String -> Constr
forall a. HasCallStack => String -> a
error "toConstr"
  gunfold :: Proxy ctx
-> (forall b r. Data ctx b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c (MVar a)
gunfold _ _ _  = String -> Constr -> c (MVar a)
forall a. HasCallStack => String -> a
error "gunfold MVar"
  dataTypeOf :: Proxy ctx -> MVar a -> DataType
dataTypeOf _ _ = String -> DataType
mkNorepType "GHC.Conc.MVar"


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


{-instance (Sat (ctx (STM a)), Typeable a) =>
          Data ctx (STM a) where
  toConstr _ _   = error "toConstr"
  gunfold _ _ _  = error "gunfold STM"
  dataTypeOf _ _ = mkNorepType "GHC.Conc.STM"-}


------------------------------------------------------------------------------
-- The following instances were adapted from various modules within the Data
-- namespace. Until GHC takes onboard SYB3, they'll have to stay in here.
------------------------------------------------------------------------------

instance (Sat (ctx [b]), Sat (ctx (Array a b)), Typeable a, Data ctx b, Data ctx [b], Ix a) =>
          Data ctx (Array a b) where
  gfoldl :: Proxy ctx
-> (forall b c. Data ctx b => w (b -> c) -> b -> w c)
-> (forall g. g -> w g)
-> Array a b
-> w (Array a b)
gfoldl _ f :: forall b c. Data ctx b => w (b -> c) -> b -> w c
f z :: forall g. g -> w g
z a :: Array a b
a = ([b] -> Array a b) -> w ([b] -> Array a b)
forall g. g -> w g
z ((a, a) -> [b] -> Array a b
forall i e. Ix i => (i, i) -> [e] -> Array i e
listArray (Array a b -> (a, a)
forall i e. Array i e -> (i, i)
bounds Array a b
a)) w ([b] -> Array a b) -> [b] -> w (Array a b)
forall b c. Data ctx b => w (b -> c) -> b -> w c
`f` (Array a b -> [b]
forall i e. Array i e -> [e]
elems Array a b
a)
  toConstr :: Proxy ctx -> Array a b -> Constr
toConstr _ _   = String -> Constr
forall a. HasCallStack => String -> a
error "toConstr"
  gunfold :: Proxy ctx
-> (forall b r. Data ctx b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c (Array a b)
gunfold _ _ _  = String -> Constr -> c (Array a b)
forall a. HasCallStack => String -> a
error "gunfold Array"
  dataTypeOf :: Proxy ctx -> Array a b -> DataType
dataTypeOf _ _ = String -> DataType
mkNorepType "Data.Array.Array"

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


emptyMapConstr :: Constr
emptyMapConstr :: Constr
emptyMapConstr     = DataType -> String -> [String] -> Fixity -> Constr
mkConstr DataType
mapDataType "empty"  [] Fixity
Prefix
insertMapConstr :: Constr
insertMapConstr :: Constr
insertMapConstr    = DataType -> String -> [String] -> Fixity -> Constr
mkConstr DataType
mapDataType "insert" [] Fixity
Prefix
mapDataType :: DataType
mapDataType :: DataType
mapDataType = String -> [Constr] -> DataType
mkDataType "Data.Map.Map" [Constr
emptyMapConstr,Constr
insertMapConstr]

instance (Sat (ctx (M.Map a b)), Data ctx a, Data ctx b, Ord a) =>
          Data ctx (M.Map a b) where
  gfoldl :: Proxy ctx
-> (forall b c. Data ctx b => w (b -> c) -> b -> w c)
-> (forall g. g -> w g)
-> Map a b
-> w (Map a b)
gfoldl _ f :: forall b c. Data ctx b => w (b -> c) -> b -> w c
f z :: forall g. g -> w g
z m :: Map a b
m = case Map a b -> Maybe ((a, b), Map a b)
forall k a. Map k a -> Maybe ((k, a), Map k a)
M.minViewWithKey Map a b
m of
                     Nothing -> Map a b -> w (Map a b)
forall g. g -> w g
z Map a b
forall k a. Map k a
M.empty
                     Just ((k :: a
k,a :: b
a),m' :: Map a b
m') -> (a -> b -> Map a b -> Map a b) -> w (a -> b -> Map a b -> Map a b)
forall g. g -> w g
z a -> b -> Map a b -> Map a b
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert w (a -> b -> Map a b -> Map a b)
-> a -> w (b -> Map a b -> Map a b)
forall b c. Data ctx b => w (b -> c) -> b -> w c
`f` a
k w (b -> Map a b -> Map a b) -> b -> w (Map a b -> Map a b)
forall b c. Data ctx b => w (b -> c) -> b -> w c
`f` b
a w (Map a b -> Map a b) -> Map a b -> w (Map a b)
forall b c. Data ctx b => w (b -> c) -> b -> w c
`f` Map a b
m' 
  toConstr :: Proxy ctx -> Map a b -> Constr
toConstr _ m :: Map a b
m | Map a b -> ConIndex
forall k a. Map k a -> ConIndex
M.size Map a b
m ConIndex -> ConIndex -> Bool
forall a. Eq a => a -> a -> Bool
== 0 = Constr
emptyMapConstr
               | Bool
otherwise     = Constr
insertMapConstr
  gunfold :: Proxy ctx
-> (forall b r. Data ctx b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c (Map a b)
gunfold _ k :: forall b r. Data ctx b => c (b -> r) -> c r
k z :: forall r. r -> c r
z c :: Constr
c = case Constr -> ConIndex
constrIndex Constr
c of
                      1 -> Map a b -> c (Map a b)
forall r. r -> c r
z Map a b
forall k a. Map k a
M.empty
                      2 -> c (Map a b -> Map a b) -> c (Map a b)
forall b r. Data ctx b => c (b -> r) -> c r
k (c (b -> Map a b -> Map a b) -> c (Map a b -> Map a b)
forall b r. Data ctx b => c (b -> r) -> c r
k (c (a -> b -> Map a b -> Map a b) -> c (b -> Map a b -> Map a b)
forall b r. Data ctx b => c (b -> r) -> c r
k ((a -> b -> Map a b -> Map a b) -> c (a -> b -> Map a b -> Map a b)
forall r. r -> c r
z a -> b -> Map a b -> Map a b
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert)))
                      _ -> String -> c (Map a b)
forall a. HasCallStack => String -> a
error "gunfold Map"
  dataTypeOf :: Proxy ctx -> Map a b -> DataType
dataTypeOf _ _ = DataType
mapDataType
  dataCast2 :: Proxy ctx
-> (forall b c. (Data ctx b, Data ctx c) => w (t b c))
-> Maybe (w (Map a b))
dataCast2 _ f :: forall b c. (Data ctx b, Data ctx c) => w (t b c)
f  = w (t a b) -> Maybe (w (Map a b))
forall k1 k2 k3 (c :: k1 -> *) (t :: k2 -> k3 -> k1)
       (t' :: k2 -> k3 -> k1) (a :: k2) (b :: k3).
(Typeable t, Typeable t') =>
c (t a b) -> Maybe (c (t' a b))
gcast2 w (t a b)
forall b c. (Data ctx b, Data ctx c) => w (t b c)
f

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


emptySetConstr :: Constr
emptySetConstr :: Constr
emptySetConstr     = DataType -> String -> [String] -> Fixity -> Constr
mkConstr DataType
mapDataType "empty"  [] Fixity
Prefix
insertSetConstr :: Constr
insertSetConstr :: Constr
insertSetConstr    = DataType -> String -> [String] -> Fixity -> Constr
mkConstr DataType
mapDataType "insert" [] Fixity
Prefix
setDataType :: DataType
setDataType :: DataType
setDataType = String -> [Constr] -> DataType
mkDataType "Data.Set.Set" [Constr
emptySetConstr,Constr
insertSetConstr]

instance (Sat (ctx (S.Set a)), Data ctx a, Ord a) =>
          Data ctx (S.Set a ) where
  gfoldl :: Proxy ctx
-> (forall b c. Data ctx b => w (b -> c) -> b -> w c)
-> (forall g. g -> w g)
-> Set a
-> w (Set a)
gfoldl _ f :: forall b c. Data ctx b => w (b -> c) -> b -> w c
f z :: forall g. g -> w g
z s :: Set a
s = case Set a -> Maybe (a, Set a)
forall a. Set a -> Maybe (a, Set a)
S.minView Set a
s of
                     Nothing -> Set a -> w (Set a)
forall g. g -> w g
z Set a
forall a. Set a
S.empty
                     Just (a :: a
a,s' :: Set a
s') -> (a -> Set a -> Set a) -> w (a -> Set a -> Set a)
forall g. g -> w g
z a -> Set a -> Set a
forall a. Ord a => a -> Set a -> Set a
S.insert w (a -> Set a -> Set a) -> a -> w (Set a -> Set a)
forall b c. Data ctx b => w (b -> c) -> b -> w c
`f` a
a w (Set a -> Set a) -> Set a -> w (Set a)
forall b c. Data ctx b => w (b -> c) -> b -> w c
`f` Set a
s' 
  toConstr :: Proxy ctx -> Set a -> Constr
toConstr _ m :: Set a
m | Set a -> ConIndex
forall a. Set a -> ConIndex
S.size Set a
m ConIndex -> ConIndex -> Bool
forall a. Eq a => a -> a -> Bool
== 0 = Constr
emptySetConstr
               | Bool
otherwise     = Constr
insertSetConstr
  gunfold :: Proxy ctx
-> (forall b r. Data ctx b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c (Set a)
gunfold _ k :: forall b r. Data ctx b => c (b -> r) -> c r
k z :: forall r. r -> c r
z c :: Constr
c = case Constr -> ConIndex
constrIndex Constr
c of
                      1 -> Set a -> c (Set a)
forall r. r -> c r
z Set a
forall a. Set a
S.empty
                      2 -> c (Set a -> Set a) -> c (Set a)
forall b r. Data ctx b => c (b -> r) -> c r
k (c (a -> Set a -> Set a) -> c (Set a -> Set a)
forall b r. Data ctx b => c (b -> r) -> c r
k ((a -> Set a -> Set a) -> c (a -> Set a -> Set a)
forall r. r -> c r
z a -> Set a -> Set a
forall a. Ord a => a -> Set a -> Set a
S.insert))
                      _ -> String -> c (Set a)
forall a. HasCallStack => String -> a
error "gunfold Set"
  dataTypeOf :: Proxy ctx -> Set a -> DataType
dataTypeOf _ _ = DataType
setDataType
  dataCast1 :: Proxy ctx -> (forall b. Data ctx b => w (t b)) -> Maybe (w (Set a))
dataCast1 _ f :: forall b. Data ctx b => w (t b)
f  = w (t a) -> Maybe (w (Set a))
forall k1 k2 (c :: k1 -> *) (t :: k2 -> k1) (t' :: k2 -> k1)
       (a :: k2).
(Typeable t, Typeable t') =>
c (t a) -> Maybe (c (t' a))
gcast1 w (t a)
forall b. Data ctx b => w (t b)
f

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

$( deriveData [''ByteString] )
$( deriveData [''L.ByteString] )