generic-deriving 1.10.2 → 1.10.3
raw patch · 4 files changed
+564/−193 lines, 4 files
Files
- CHANGELOG.md +6/−0
- generic-deriving.cabal +1/−1
- src/Generics/Deriving/Base/Internal.hs +222/−11
- src/Generics/Deriving/Instances.hs +335/−181
CHANGELOG.md view
@@ -1,3 +1,9 @@+# 1.10.3+* Backported `Enum`, `Bounded`, `Ix`, `Functor`, `Applicative`, `Monad`,+ `MonadFix`, `MonadPlus`, `MonadZip`, `Foldable`, `Traversable`, and+ `Data` instances (introduced in `base-4.9`) for datatypes in the+ `Generics.Deriving.Base` module+ # 1.10.2 * Fix TH regression on GHC 7.0
generic-deriving.cabal view
@@ -1,5 +1,5 @@ name: generic-deriving-version: 1.10.2+version: 1.10.3 synopsis: Generic programming library for generalised deriving. description:
src/Generics/Deriving/Base/Internal.hs view
@@ -1,9 +1,14 @@ {-# LANGUAGE CPP #-}+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveFunctor #-}+{-# LANGUAGE DeriveFoldable #-}+{-# LANGUAGE DeriveTraversable #-} {-# LANGUAGE EmptyDataDecls #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE KindSignatures #-} {-# LANGUAGE MagicHash #-} {-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE TypeSynonymInstances #-}@@ -618,13 +623,26 @@ #if __GLASGOW_HASKELL__ >= 701 import GHC.Generics+#else+import Control.Applicative ( Alternative(..) )+import Control.Monad ( MonadPlus(..) )+import Control.Monad.Fix ( MonadFix(..), fix )+import Data.Data ( Data )+import Data.Ix ( Ix )+import Text.ParserCombinators.ReadPrec (pfail)+import Text.Read ( Read(..), parens, readListDefault, readListPrecDefault ) #endif #if __GLASGOW_HASKELL__ < 709+import Control.Applicative ( Applicative(..) )+import Data.Foldable ( Foldable(..) )+import Data.Monoid ( Monoid(..) )+import Data.Traversable ( Traversable(..) ) import Data.Word ( Word ) #endif #if __GLASGOW_HASKELL__ < 711+import Data.Typeable import GHC.Prim ( Addr#, Char#, Double#, Float#, Int#, Word# ) import GHC.Ptr ( Ptr ) #endif@@ -636,45 +654,160 @@ -- | Void: used for datatypes without constructors data V1 p+ deriving (Functor, Foldable, Traversable, Typeable) +deriving instance Eq (V1 p)+deriving instance Data p => Data (V1 p)+deriving instance Ord (V1 p)+deriving instance Show (V1 p)+-- Implement Read instance manually to get around an old GHC bug+-- (Trac #7931)+instance Read (V1 p) where+ readPrec = parens pfail+ readList = readListDefault+ readListPrec = readListPrecDefault+ -- | Unit: used for constructors without arguments data U1 p = U1- deriving (Eq, Ord, Read, Show)+ deriving (Eq, Ord, Read, Show, Functor, Foldable, Traversable, Data, Typeable)+instance Applicative U1 where+ pure _ = U1+ U1 <*> U1 = U1 +instance Alternative U1 where+ empty = U1+ U1 <|> U1 = U1++instance Monad U1 where+ return _ = U1+ U1 >>= _ = U1+ -- | Used for marking occurrences of the parameter newtype Par1 p = Par1 { unPar1 :: p }- deriving (Eq, Ord, Read, Show)+ deriving (Eq, Ord, Read, Show, Functor, Foldable, Traversable, Data, Typeable) +instance Applicative Par1 where+ pure a = Par1 a+ Par1 f <*> Par1 x = Par1 (f x)++instance Monad Par1 where+ return a = Par1 a+ Par1 x >>= f = f x++instance MonadFix Par1 where+ mfix f = Par1 (fix (unPar1 . f))+ -- | Recursive calls of kind * -> * newtype Rec1 f p = Rec1 { unRec1 :: f p }- deriving (Eq, Ord, Read, Show)+ deriving (Eq, Ord, Read, Functor, Show) +instance Applicative f => Applicative (Rec1 f) where+ pure a = Rec1 (pure a)+ Rec1 f <*> Rec1 x = Rec1 (f <*> x)++instance Alternative f => Alternative (Rec1 f) where+ empty = Rec1 empty+ Rec1 l <|> Rec1 r = Rec1 (l <|> r)++instance Monad f => Monad (Rec1 f) where+ return a = Rec1 (return a)+ Rec1 x >>= f = Rec1 (x >>= \a -> unRec1 (f a))++instance MonadFix f => MonadFix (Rec1 f) where+ mfix f = Rec1 (mfix (unRec1 . f))++instance MonadPlus f => MonadPlus (Rec1 f) where+ mzero = Rec1 mzero+ mplus (Rec1 a) (Rec1 b) = Rec1 (mplus a b)+ -- | Constants, additional parameters and recursion of kind * newtype K1 i c p = K1 { unK1 :: c }- deriving (Eq, Ord, Read, Show)+ deriving (Eq, Ord, Read, Show, Functor, Data, Typeable) +instance Foldable (K1 i c) where+ foldr _ z K1{} = z+ foldMap _ K1{} = mempty++instance Traversable (K1 i c) where+ traverse _ (K1 c) = pure (K1 c)+ -- | Meta-information (constructor names, etc.) newtype M1 i c f p = M1 { unM1 :: f p }- deriving (Eq, Ord, Read, Show)+ deriving (Eq, Ord, Read, Show, Functor, Foldable, Traversable) +instance Applicative f => Applicative (M1 i c f) where+ pure a = M1 (pure a)+ M1 f <*> M1 x = M1 (f <*> x)++instance Alternative f => Alternative (M1 i c f) where+ empty = M1 empty+ M1 l <|> M1 r = M1 (l <|> r)++instance Monad f => Monad (M1 i c f) where+ return a = M1 (return a)+ M1 x >>= f = M1 (x >>= \a -> unM1 (f a))++instance MonadPlus f => MonadPlus (M1 i c f) where+ mzero = M1 mzero+ mplus (M1 a) (M1 b) = M1 (mplus a b)++instance MonadFix f => MonadFix (M1 i c f) where+ mfix f = M1 (mfix (unM1. f))+ -- | Sums: encode choice between constructors infixr 5 :+: data (:+:) f g p = L1 (f p) | R1 (g p)- deriving (Eq, Ord, Read, Show)+ deriving (Eq, Ord, Read, Show, Functor, Foldable, Traversable) -- | Products: encode multiple arguments to constructors infixr 6 :*: data (:*:) f g p = f p :*: g p- deriving (Eq, Ord, Read, Show)+ deriving (Eq, Ord, Read, Show, Functor, Foldable, Traversable) +instance (Applicative f, Applicative g) => Applicative (f :*: g) where+ pure a = pure a :*: pure a+ (f :*: g) <*> (x :*: y) = (f <*> x) :*: (g <*> y)++instance (Alternative f, Alternative g) => Alternative (f :*: g) where+ empty = empty :*: empty+ (x1 :*: y1) <|> (x2 :*: y2) = (x1 <|> x2) :*: (y1 <|> y2)++instance (Monad f, Monad g) => Monad (f :*: g) where+ return a = return a :*: return a+ (m :*: n) >>= f = (m >>= \a -> fstP (f a)) :*: (n >>= \a -> sndP (f a))+ where+ fstP (a :*: _) = a+ sndP (_ :*: b) = b++instance (MonadFix f, MonadFix g) => MonadFix (f :*: g) where+ mfix f = (mfix (fstP . f)) :*: (mfix (sndP . f))+ where+ fstP (a :*: _) = a+ sndP (_ :*: b) = b++instance (MonadPlus f, MonadPlus g) => MonadPlus (f :*: g) where+ mzero = mzero :*: mzero+ (x1 :*: y1) `mplus` (x2 :*: y2) = (x1 `mplus` x2) :*: (y1 `mplus` y2)+ -- | Composition of functors infixr 7 :.: newtype (:.:) f g p = Comp1 { unComp1 :: f (g p) }- deriving (Eq, Ord, Read, Show)+ deriving (Eq, Ord, Read, Show, Functor, Foldable, Traversable)++instance (Applicative f, Applicative g) => Applicative (f :.: g) where+ pure x = Comp1 (pure (pure x))+ Comp1 f <*> Comp1 x = Comp1 (fmap (<*>) f <*> x)++instance (Alternative f, Applicative g) => Alternative (f :.: g) where+ empty = Comp1 empty+ Comp1 x <|> Comp1 y = Comp1 (x <|> y)+ -- | Tag for K1: recursion (of kind *) data R+ deriving Typeable -- | Tag for K1: parameters (other than the last) data P+ deriving Typeable -- | Type synonym for encoding recursion (of kind *) type Rec0 = K1 R@@ -683,10 +816,13 @@ -- | Tag for M1: datatype data D+ deriving Typeable -- | Tag for M1: constructor data C+ deriving Typeable -- | Tag for M1: record selector data S+ deriving Typeable -- | Type synonym for encoding meta-information for datatypes type D1 = M1 D@@ -710,6 +846,7 @@ -- | Used for constructor fields without a name data NoSelector+ deriving Typeable instance Selector NoSelector where selName _ = "" @@ -729,12 +866,12 @@ -- | Datatype to represent the arity of a tuple. data Arity = NoArity | Arity Int- deriving (Eq, Show, Ord, Read)+ deriving (Eq, Show, Ord, Read, Typeable) -- | Datatype to represent the fixity of a constructor. An infix -- | declaration directly corresponds to an application of 'Infix'. data Fixity = Prefix | Infix Associativity Int- deriving (Eq, Show, Ord, Read)+ deriving (Eq, Show, Ord, Read, Data, Typeable) -- | Get the precedence of a fixity value. prec :: Fixity -> Int@@ -745,7 +882,7 @@ data Associativity = LeftAssociative | RightAssociative | NotAssociative- deriving (Eq, Show, Ord, Read)+ deriving (Eq, Show, Ord, Read, Bounded, Enum, Ix, Data, Typeable) -- | Representable types of kind * class Generic a where@@ -769,29 +906,103 @@ -- | Constants of kind @#@ data family URec (a :: *) (p :: *) +# if __GLASGOW_HASKELL__ >= 707+deriving instance Typeable URec+# else+instance Typeable2 URec where+ typeOf2 _ =+# if __GLASGOW_HASKELL__ >= 701+ mkTyConApp (mkTyCon3 "generic-deriving"+ "Generics.Deriving.Base.Internal"+ "URec") []+# else+ mkTyConApp (mkTyCon "Generics.Deriving.Base.Internal.URec") []+# endif+# endif+ -- | Used for marking occurrences of 'Addr#' data instance URec (Ptr ()) p = UAddr { uAddr# :: Addr# } deriving (Eq, Ord) +instance Functor (URec (Ptr ())) where+ fmap _ (UAddr a) = UAddr a++instance Foldable (URec (Ptr ())) where+ foldr _ z UAddr{} = z+ foldMap _ UAddr{} = mempty++instance Traversable (URec (Ptr ())) where+ traverse _ (UAddr a) = pure (UAddr a)+ -- | Used for marking occurrences of 'Char#' data instance URec Char p = UChar { uChar# :: Char# } deriving (Eq, Ord, Show) +instance Functor (URec Char) where+ fmap _ (UChar c) = UChar c++instance Foldable (URec Char) where+ foldr _ z UChar{} = z+ foldMap _ UChar{} = mempty++instance Traversable (URec Char) where+ traverse _ (UChar c) = pure (UChar c)+ -- | Used for marking occurrences of 'Double#' data instance URec Double p = UDouble { uDouble# :: Double# } deriving (Eq, Ord, Show) +instance Functor (URec Double) where+ fmap _ (UDouble d) = UDouble d++instance Foldable (URec Double) where+ foldr _ z UDouble{} = z+ foldMap _ UDouble{} = mempty++instance Traversable (URec Double) where+ traverse _ (UDouble d) = pure (UDouble d)+ -- | Used for marking occurrences of 'Float#' data instance URec Float p = UFloat { uFloat# :: Float# } deriving (Eq, Ord, Show) +instance Functor (URec Float) where+ fmap _ (UFloat f) = UFloat f++instance Foldable (URec Float) where+ foldr _ z UFloat{} = z+ foldMap _ UFloat{} = mempty++instance Traversable (URec Float) where+ traverse _ (UFloat f) = pure (UFloat f)+ -- | Used for marking occurrences of 'Int#' data instance URec Int p = UInt { uInt# :: Int# } deriving (Eq, Ord, Show) +instance Functor (URec Int) where+ fmap _ (UInt i) = UInt i++instance Foldable (URec Int) where+ foldr _ z UInt{} = z+ foldMap _ UInt{} = mempty++instance Traversable (URec Int) where+ traverse _ (UInt i) = pure (UInt i)+ -- | Used for marking occurrences of 'Word#' data instance URec Word p = UWord { uWord# :: Word# } deriving (Eq, Ord, Show)++instance Functor (URec Word) where+ fmap _ (UWord w) = UWord w++instance Foldable (URec Word) where+ foldr _ z UWord{} = z+ foldMap _ UWord{} = mempty++instance Traversable (URec Word) where+ traverse _ (UWord w) = pure (UWord w) -- | Type synonym for 'URec': 'Addr#' type UAddr = URec (Ptr ())
src/Generics/Deriving/Instances.hs view
@@ -23,13 +23,29 @@ -- and the Generic1 instances #if __GLASGOW_HASKELL__ < 711 Rep0ExitCode+ , Rep0Version+ , Rep1ConSum+ , Rep1ConProduct+ , Rep1ConCompose+ , Rep1K1+ , Rep1M1+ , Rep1Par1+ , Rep1Rec1+ , Rep1U1+ , Rep0V1+ , Rep1V1 , Rep0UAddr+ , Rep1UAddr , Rep0UChar+ , Rep1UChar , Rep0UDouble+ , Rep1UDouble , Rep0UFloat+ , Rep1UFloat , Rep0UInt+ , Rep1UInt , Rep0UWord- , Rep0Version+ , Rep1UWord # if __GLASGOW_HASKELL__ >= 701 , Rep0Complex , Rep1Complex@@ -150,20 +166,299 @@ ----- +type Rep0Version = D1 D1Version (C1 C1_0Version (S1 S1_0_0Version (Rec0 [Int])+ :*: S1 S1_0_1Version (Rec0 [String])))++instance Generic Version where+ type Rep Version = Rep0Version+ from (Version b t) = M1 (M1 (M1 (K1 b) :*: M1 (K1 t)))+ to (M1 (M1 (M1 (K1 b) :*: M1 (K1 t)))) = Version b t++data D1Version+data C1_0Version+data S1_0_0Version+data S1_0_1Version++instance Datatype D1Version where+ datatypeName _ = "Version"+ moduleName _ = "Data.Version"++instance Constructor C1_0Version where+ conName _ = "Version"+ conIsRecord _ = True++instance Selector S1_0_0Version where+ selName _ = "versionBranch"++instance Selector S1_0_1Version where+ selName _ = "versionTags"++-----++type Rep1ConSum f g = D1 D1ConSum (C1 C1_0ConSum (S1 NoSelector (Rec1 f))+ :+: C1 C1_1ConSum (S1 NoSelector (Rec1 g)))++instance Generic1 (f :+: g) where+ type Rep1 (f :+: g) = Rep1ConSum f g+ from1 (L1 l) = M1 (L1 (M1 (M1 (Rec1 l))))+ from1 (R1 r) = M1 (R1 (M1 (M1 (Rec1 r))))+ to1 (M1 (L1 (M1 (M1 l)))) = L1 (unRec1 l)+ to1 (M1 (R1 (M1 (M1 r)))) = R1 (unRec1 r)++data D1ConSum+data C1_0ConSum+data C1_1ConSum++instance Datatype D1ConSum where+ datatypeName _ = ":+:"+# if __GLASGOW_HASKELL__ < 701+ moduleName _ = "Generics.Deriving.Base.Internal"+# else+ moduleName _ = "GHC.Generics"+# endif++instance Constructor C1_0ConSum where+ conName _ = "L1"++instance Constructor C1_1ConSum where+ conName _ = "R1"++-----++type Rep1ConProduct f g = D1 D1ConProduct (C1 C1_ConProduct (S1 NoSelector (Rec1 f)+ :*: S1 NoSelector (Rec1 g)))++instance Generic1 (f :*: g) where+ type Rep1 (f :*: g) = Rep1ConProduct f g+ from1 (f :*: g) = M1 (M1 (M1 (Rec1 f) :*: M1 (Rec1 g)))+ to1 (M1 (M1 (M1 f :*: M1 g))) = unRec1 f :*: unRec1 g++data D1ConProduct+data C1_ConProduct++instance Datatype D1ConProduct where+ datatypeName _ = ":*:"+# if __GLASGOW_HASKELL__ < 701+ moduleName _ = "Generics.Deriving.Base.Internal"+# else+ moduleName _ = "GHC.Generics"+# endif++instance Constructor C1_ConProduct where+ conName _ = ":*:"+ conFixity _ = Infix RightAssociative 6++-----++type Rep1ConCompose f g =+ D1 D1ConCompose (C1 C1_0ConCompose (S1 S1_0_0ConCompose (f :.: Rec1 g)))++instance Functor f => Generic1 (f :.: g) where+ type Rep1 (f :.: g) = Rep1ConCompose f g+ from1 (Comp1 c) = M1 (M1 (M1 (Comp1 (fmap Rec1 c))))+ to1 (M1 (M1 (M1 c))) = Comp1 (fmap unRec1 (unComp1 c))++data D1ConCompose+data C1_0ConCompose+data S1_0_0ConCompose++instance Datatype D1ConCompose where+ datatypeName _ = ":.:"+# if __GLASGOW_HASKELL__ < 701+ moduleName _ = "Generics.Deriving.Base.Internal"+# else+ moduleName _ = "GHC.Generics"+# endif++instance Constructor C1_0ConCompose where+ conName _ = "Comp1"+ conIsRecord _ = True++instance Selector S1_0_0ConCompose where+ selName _ = "unComp1"++-----++type Rep1K1 i c = D1 D1K1 (C1 C1_0K1 (S1 S1_0_0K1 (Rec0 c)))++instance Generic1 (K1 i c) where+ type Rep1 (K1 i c) = Rep1K1 i c+ from1 (K1 c) = M1 (M1 (M1 (K1 c)))+ to1 (M1 (M1 (M1 c))) = K1 (unK1 c)++data D1K1+data C1_0K1+data S1_0_0K1++instance Datatype D1K1 where+ datatypeName _ = "K1"+# if __GLASGOW_HASKELL__ < 701+ moduleName _ = "Generics.Deriving.Base.Internal"+# else+ moduleName _ = "GHC.Generics"+# endif++instance Constructor C1_0K1 where+ conName _ = "K1"+ conIsRecord _ = True++instance Selector S1_0_0K1 where+ selName _ = "unK1"++-----++type Rep1M1 i c f = D1 D1M1 (C1 C1_0M1 (S1 S1_0_0M1 (Rec1 f)))++instance Generic1 (M1 i c f) where+ type Rep1 (M1 i c f) = Rep1M1 i c f+ from1 (M1 m) = M1 (M1 (M1 (Rec1 m)))+ to1 (M1 (M1 (M1 m))) = M1 (unRec1 m)++data D1M1+data C1_0M1+data S1_0_0M1++instance Datatype D1M1 where+ datatypeName _ = "M1"+# if __GLASGOW_HASKELL__ < 701+ moduleName _ = "Generics.Deriving.Base.Internal"+# else+ moduleName _ = "GHC.Generics"+# endif++instance Constructor C1_0M1 where+ conName _ = "M1"+ conIsRecord _ = True++instance Selector S1_0_0M1 where+ selName _ = "unM1"++-----++type Rep1Par1 = D1 D1Par1 (C1 C1_0Par1 (S1 S1_0_0Par1 Par1))++instance Generic1 Par1 where+ type Rep1 Par1 = Rep1Par1+ from1 (Par1 p) = M1 (M1 (M1 (Par1 p)))+ to1 (M1 (M1 (M1 p))) = Par1 (unPar1 p)++data D1Par1+data C1_0Par1+data S1_0_0Par1++instance Datatype D1Par1 where+ datatypeName _ = "Par1"+# if __GLASGOW_HASKELL__ < 701+ moduleName _ = "Generics.Deriving.Base.Internal"+# else+ moduleName _ = "GHC.Generics"+# endif++instance Constructor C1_0Par1 where+ conName _ = "Par1"+ conIsRecord _ = True++instance Selector S1_0_0Par1 where+ selName _ = "unPar1"++-----++type Rep1Rec1 f = D1 D1Rec1 (C1 C1_0Rec1 (S1 S1_0_0Rec1 (Rec1 f)))++instance Generic1 (Rec1 f) where+ type Rep1 (Rec1 f) = Rep1Rec1 f+ from1 (Rec1 r) = M1 (M1 (M1 (Rec1 r)))+ to1 (M1 (M1 (M1 r))) = Rec1 (unRec1 r)++data D1Rec1+data C1_0Rec1+data S1_0_0Rec1++instance Datatype D1Rec1 where+ datatypeName _ = "Rec1"+# if __GLASGOW_HASKELL__ < 701+ moduleName _ = "Generics.Deriving.Base.Internal"+# else+ moduleName _ = "GHC.Generics"+# endif++instance Constructor C1_0Rec1 where+ conName _ = "Rec1"+ conIsRecord _ = True++instance Selector S1_0_0Rec1 where+ selName _ = "unRec1"++-----++type Rep1U1 = D1 D1U1 (C1 C1_0U1 U1)++instance Generic1 U1 where+ type Rep1 U1 = Rep1U1+ from1 U1 = M1 (M1 U1)+ to1 (M1 (M1 U1)) = U1++data D1U1+data C1_0U1++instance Datatype D1U1 where+ datatypeName _ = "U1"+# if __GLASGOW_HASKELL__ < 701+ moduleName _ = "Generics.Deriving.Base.Internal"+# else+ moduleName _ = "GHC.Generics"+# endif++instance Constructor C1_0U1 where+ conName _ = "U1"++-----++type Rep0V1 p = D1 D1V1 V1+type Rep1V1 = D1 D1V1 V1++instance Generic (V1 p) where+ type Rep (V1 p) = Rep0V1 p+ from _ = M1 (error "No generic representation for empty datatype V1")+ to (M1 _) = error "No values for empty datatype V1"++instance Generic1 V1 where+ type Rep1 V1 = Rep1V1+ from1 _ = M1 (error "No generic representation for empty datatype V1")+ to1 (M1 _) = error "No values for empty datatype V1"++data D1V1++instance Datatype D1V1 where+ datatypeName _ = "V1"+# if __GLASGOW_HASKELL__ < 701+ moduleName _ = "Generics.Deriving.Base.Internal"+# else+ moduleName _ = "GHC.Generics"+# endif++-----+ type Rep0UAddr p = D1 D1UAddr (C1 C1_0UAddr (S1 S1_0_0UAddr UAddr))+type Rep1UAddr = D1 D1UAddr (C1 C1_0UAddr (S1 S1_0_0UAddr UAddr)) instance Generic (UAddr p) where type Rep (UAddr p) = Rep0UAddr p from (UAddr a) = M1 (M1 (M1 (UAddr a))) to (M1 (M1 (M1 (UAddr a)))) = UAddr a +instance Generic1 UAddr where+ type Rep1 UAddr = Rep1UAddr+ from1 (UAddr a) = M1 (M1 (M1 (UAddr a)))+ to1 (M1 (M1 (M1 (UAddr a)))) = UAddr a+ data D1UAddr data C1_0UAddr data S1_0_0UAddr instance Datatype D1UAddr where datatypeName _ = "UAddr"- moduleName _ = "Generics.Deriving.Base"+ moduleName _ = "Generics.Deriving.Base.Internal" instance Constructor C1_0UAddr where conName _ = "UAddr"@@ -175,19 +470,25 @@ ----- type Rep0UChar p = D1 D1UChar (C1 C1_0UChar (S1 S1_0_0UChar UChar))+type Rep1UChar = D1 D1UChar (C1 C1_0UChar (S1 S1_0_0UChar UChar)) instance Generic (UChar p) where type Rep (UChar p) = Rep0UChar p from (UChar c) = M1 (M1 (M1 (UChar c))) to (M1 (M1 (M1 (UChar c)))) = UChar c +instance Generic1 UChar where+ type Rep1 UChar = Rep1UChar+ from1 (UChar c) = M1 (M1 (M1 (UChar c)))+ to1 (M1 (M1 (M1 (UChar c)))) = UChar c+ data D1UChar data C1_0UChar data S1_0_0UChar instance Datatype D1UChar where datatypeName _ = "UChar"- moduleName _ = "Generics.Deriving.Base"+ moduleName _ = "Generics.Deriving.Base.Internal" instance Constructor C1_0UChar where conName _ = "UChar"@@ -199,19 +500,25 @@ ----- type Rep0UDouble p = D1 D1UDouble (C1 C1_0UDouble (S1 S1_0_0UDouble UDouble))+type Rep1UDouble = D1 D1UDouble (C1 C1_0UDouble (S1 S1_0_0UDouble UDouble)) instance Generic (UDouble p) where type Rep (UDouble p) = Rep0UDouble p from (UDouble d) = M1 (M1 (M1 (UDouble d))) to (M1 (M1 (M1 (UDouble d)))) = UDouble d +instance Generic1 UDouble where+ type Rep1 UDouble = Rep1UDouble+ from1 (UDouble d) = M1 (M1 (M1 (UDouble d)))+ to1 (M1 (M1 (M1 (UDouble d)))) = UDouble d+ data D1UDouble data C1_0UDouble data S1_0_0UDouble instance Datatype D1UDouble where datatypeName _ = "UDouble"- moduleName _ = "Generics.Deriving.Base"+ moduleName _ = "Generics.Deriving.Base.Internal" instance Constructor C1_0UDouble where conName _ = "UDouble"@@ -223,19 +530,25 @@ ----- type Rep0UFloat p = D1 D1UFloat (C1 C1_0UFloat (S1 S1_0_0UFloat UFloat))+type Rep1UFloat = D1 D1UFloat (C1 C1_0UFloat (S1 S1_0_0UFloat UFloat)) instance Generic (UFloat p) where type Rep (UFloat p) = Rep0UFloat p from (UFloat f) = M1 (M1 (M1 (UFloat f))) to (M1 (M1 (M1 (UFloat f)))) = UFloat f +instance Generic1 UFloat where+ type Rep1 UFloat = Rep1UFloat+ from1 (UFloat f) = M1 (M1 (M1 (UFloat f)))+ to1 (M1 (M1 (M1 (UFloat f)))) = UFloat f+ data D1UFloat data C1_0UFloat data S1_0_0UFloat instance Datatype D1UFloat where datatypeName _ = "UFloat"- moduleName _ = "Generics.Deriving.Base"+ moduleName _ = "Generics.Deriving.Base.Internal" instance Constructor C1_0UFloat where conName _ = "UFloat"@@ -247,19 +560,25 @@ ----- type Rep0UInt p = D1 D1UInt (C1 C1_0UInt (S1 S1_0_0UInt UInt))+type Rep1UInt = D1 D1UInt (C1 C1_0UInt (S1 S1_0_0UInt UInt)) instance Generic (UInt p) where type Rep (UInt p) = Rep0UInt p from (UInt i) = M1 (M1 (M1 (UInt i))) to (M1 (M1 (M1 (UInt i)))) = UInt i +instance Generic1 UInt where+ type Rep1 UInt = Rep1UInt+ from1 (UInt i) = M1 (M1 (M1 (UInt i)))+ to1 (M1 (M1 (M1 (UInt i)))) = UInt i+ data D1UInt data C1_0UInt data S1_0_0UInt instance Datatype D1UInt where datatypeName _ = "UInt"- moduleName _ = "Generics.Deriving.Base"+ moduleName _ = "Generics.Deriving.Base.Internal" instance Constructor C1_0UInt where conName _ = "UInt"@@ -271,19 +590,25 @@ ----- type Rep0UWord p = D1 D1UWord (C1 C1_0UWord (S1 S1_0_0UWord UWord))+type Rep1UWord = D1 D1UWord (C1 C1_0UWord (S1 S1_0_0UWord UWord)) instance Generic (UWord p) where type Rep (UWord p) = Rep0UWord p from (UWord w) = M1 (M1 (M1 (UWord w))) to (M1 (M1 (M1 (UWord w)))) = UWord w +instance Generic1 UWord where+ type Rep1 UWord = Rep1UWord+ from1 (UWord w) = M1 (M1 (M1 (UWord w)))+ to1 (M1 (M1 (M1 (UWord w)))) = UWord w+ data D1UWord data C1_0UWord data S1_0_0UWord instance Datatype D1UWord where datatypeName _ = "UWord"- moduleName _ = "Generics.Deriving.Base"+ moduleName _ = "Generics.Deriving.Base.Internal" instance Constructor C1_0UWord where conName _ = "UWord"@@ -294,35 +619,6 @@ ----- -type Rep0Version = D1 D1Version (C1 C1_0Version (S1 S1_0_0Version (Rec0 [Int])- :*: S1 S1_0_1Version (Rec0 [String])))--instance Generic Version where- type Rep Version = Rep0Version- from (Version b t) = M1 (M1 (M1 (K1 b) :*: M1 (K1 t)))- to (M1 (M1 (M1 (K1 b) :*: M1 (K1 t)))) = Version b t--data D1Version-data C1_0Version-data S1_0_0Version-data S1_0_1Version--instance Datatype D1Version where- datatypeName _ = "Version"- moduleName _ = "Data.Version"--instance Constructor C1_0Version where- conName _ = "Version"- conIsRecord _ = True--instance Selector S1_0_0Version where- selName _ = "versionBranch"--instance Selector S1_0_1Version where- selName _ = "versionTags"-------- # if __GLASGOW_HASKELL__ >= 701 type Rep0Complex a = D1 D1Complex (C1 C1_0Complex (S1 NoSelector (Rec0 a) :*: S1 NoSelector (Rec0 a)))@@ -447,7 +743,7 @@ instance Datatype D1Arity where datatypeName _ = "Arity" # if __GLASGOW_HASKELL__ < 701- moduleName _ = "Generics.Deriving.Base"+ moduleName _ = "Generics.Deriving.Base.Internal" # else moduleName _ = "GHC.Generics" # endif@@ -483,7 +779,7 @@ instance Datatype D1Associativity where datatypeName _ = "Associativity" # if __GLASGOW_HASKELL__ < 701- moduleName _ = "Generics.Deriving.Base"+ moduleName _ = "Generics.Deriving.Base.Internal" # else moduleName _ = "GHC.Generics" # endif@@ -633,7 +929,7 @@ instance Datatype D1Fixity where datatypeName _ = "Fixity" # if __GLASGOW_HASKELL__ < 701- moduleName _ = "Generics.Deriving.Base"+ moduleName _ = "Generics.Deriving.Base.Internal" # else moduleName _ = "GHC.Generics" # endif@@ -837,20 +1133,6 @@ from U1 = M1 (M1 U1) to (M1 (M1 U1)) = U1 -data D1U1-data C1_0U1--instance Datatype D1U1 where- datatypeName _ = "U1"-# if __GLASGOW_HASKELL__ < 701- moduleName _ = "Generics.Deriving.Base"-# else- moduleName _ = "GHC.Generics"-# endif--instance Constructor C1_0U1 where- conName _ = "U1"- ----- type Rep0Par1 p = D1 D1Par1 (C1 C1_0Par1 (S1 S1_0_0Par1 (Rec0 p)))@@ -860,25 +1142,6 @@ from (Par1 p) = M1 (M1 (M1 (K1 p))) to (M1 (M1 (M1 (K1 p)))) = Par1 p -data D1Par1-data C1_0Par1-data S1_0_0Par1--instance Datatype D1Par1 where- datatypeName _ = "Par1"-# if __GLASGOW_HASKELL__ < 701- moduleName _ = "Generics.Deriving.Base"-# else- moduleName _ = "GHC.Generics"-# endif--instance Constructor C1_0Par1 where- conName _ = "Par1"- conIsRecord _ = True--instance Selector S1_0_0Par1 where- selName _ = "unPar1"- ----- type Rep0Rec1 f p = D1 D1Rec1 (C1 C1_0Rec1 (S1 S1_0_0Rec1 (Rec0 (f p))))@@ -888,25 +1151,6 @@ from (Rec1 r) = M1 (M1 (M1 (K1 r))) to (M1 (M1 (M1 (K1 r)))) = Rec1 r -data D1Rec1-data C1_0Rec1-data S1_0_0Rec1--instance Datatype D1Rec1 where- datatypeName _ = "Rec1"-# if __GLASGOW_HASKELL__ < 701- moduleName _ = "Generics.Deriving.Base"-# else- moduleName _ = "GHC.Generics"-# endif--instance Constructor C1_0Rec1 where- conName _ = "Rec1"- conIsRecord _ = True--instance Selector S1_0_0Rec1 where- selName _ = "unRec1"- ----- type Rep0K1 i c p = D1 D1K1 (C1 C1_0K1 (S1 S1_0_0K1 (Rec0 c)))@@ -916,25 +1160,6 @@ from (K1 c) = M1 (M1 (M1 (K1 c))) to (M1 (M1 (M1 (K1 c)))) = K1 c -data D1K1-data C1_0K1-data S1_0_0K1--instance Datatype D1K1 where- datatypeName _ = "K1"-# if __GLASGOW_HASKELL__ < 701- moduleName _ = "Generics.Deriving.Base"-# else- moduleName _ = "GHC.Generics"-# endif--instance Constructor C1_0K1 where- conName _ = "K1"- conIsRecord _ = True--instance Selector S1_0_0K1 where- selName _ = "unK1"- ----- type Rep0M1 i c f p = D1 D1M1 (C1 C1_0M1 (S1 S1_0_0M1 (Rec0 (f p))))@@ -944,25 +1169,6 @@ from (M1 m) = M1 (M1 (M1 (K1 m))) to (M1 (M1 (M1 (K1 m)))) = M1 m -data D1M1-data C1_0M1-data S1_0_0M1--instance Datatype D1M1 where- datatypeName _ = "M1"-# if __GLASGOW_HASKELL__ < 701- moduleName _ = "Generics.Deriving.Base"-# else- moduleName _ = "GHC.Generics"-# endif--instance Constructor C1_0M1 where- conName _ = "M1"- conIsRecord _ = True--instance Selector S1_0_0M1 where- selName _ = "unM1"- ----- type Rep0ConSum f g p = D1 D1ConSum (C1 C1_0ConSum (S1 NoSelector (Rec0 (f p)))@@ -977,24 +1183,6 @@ to (M1 (L1 (M1 (M1 (K1 l))))) = L1 l to (M1 (R1 (M1 (M1 (K1 r))))) = R1 r -data D1ConSum-data C1_0ConSum-data C1_1ConSum--instance Datatype D1ConSum where- datatypeName _ = ":+:"-# if __GLASGOW_HASKELL__ < 701- moduleName _ = "Generics.Deriving.Base"-# else- moduleName _ = "GHC.Generics"-# endif--instance Constructor C1_0ConSum where- conName _ = "L1"--instance Constructor C1_1ConSum where- conName _ = "R1"- ----- type Rep0ConProduct f g p =@@ -1006,21 +1194,6 @@ from (f :*: g) = M1 (M1 (M1 (K1 f) :*: M1 (K1 g))) to (M1 (M1 (M1 (K1 f) :*: M1 (K1 g)))) = f :*: g -data D1ConProduct-data C1_ConProduct--instance Datatype D1ConProduct where- datatypeName _ = ":*:"-# if __GLASGOW_HASKELL__ < 701- moduleName _ = "Generics.Deriving.Base"-# else- moduleName _ = "GHC.Generics"-# endif--instance Constructor C1_ConProduct where- conName _ = ":*:"- conFixity _ = Infix RightAssociative 6- ----- type Rep0ConCompose f g p =@@ -1030,25 +1203,6 @@ type Rep ((f :.: g) p) = Rep0ConCompose f g p from (Comp1 c) = M1 (M1 (M1 (K1 c))) to (M1 (M1 (M1 (K1 c)))) = Comp1 c--data D1ConCompose-data C1_0ConCompose-data S1_0_0ConCompose--instance Datatype D1ConCompose where- datatypeName _ = ":.:"-# if __GLASGOW_HASKELL__ < 701- moduleName _ = "Generics.Deriving.Base"-# else- moduleName _ = "GHC.Generics"-# endif--instance Constructor C1_0ConCompose where- conName _ = "Comp1"- conIsRecord _ = True--instance Selector S1_0_0ConCompose where- selName _ = "unComp1" #endif -----