packages feed

generic-deriving 1.13.1 → 1.14

raw patch · 14 files changed

+230/−100 lines, 14 filesdep ~template-haskelldep ~th-abstractionPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: template-haskell, th-abstraction

API changes (from Hackage documentation)

- Generics.Deriving.Enum: instance (Generics.Deriving.Eq.GEq a, Generics.Deriving.Enum.GEnum a, Generics.Deriving.Enum.GIx a) => Generics.Deriving.Enum.GIx (Data.Semigroup.Option a)
- Generics.Deriving.Enum: instance Generics.Deriving.Enum.GEnum a => Generics.Deriving.Enum.GEnum (Data.Semigroup.Option a)
- Generics.Deriving.Eq: instance Generics.Deriving.Eq.GEq a => Generics.Deriving.Eq.GEq (Data.Semigroup.Option a)
- Generics.Deriving.Foldable: instance Generics.Deriving.Foldable.GFoldable Data.Semigroup.Option
- Generics.Deriving.Functor: instance Generics.Deriving.Functor.GFunctor Data.Semigroup.Option
- Generics.Deriving.Show: instance Generics.Deriving.Show.GShow a => Generics.Deriving.Show.GShow (Data.Semigroup.Option a)
- Generics.Deriving.Traversable: instance Generics.Deriving.Traversable.GTraversable Data.Semigroup.Option

Files

CHANGELOG.md view
@@ -1,3 +1,10 @@+# 1.14 [2020.09.30]+* Remove instances for `Data.Semigroup.Option`, which is deprecated as of+  `base-4.15.0.0`.+* Allow building with `template-haskell-2.17.0.0` (GHC 9.0).+* Fix a bug in which `deriveAll1` would needlessly reject data types whose last+  type parameter appears as an oversaturated argument to a type family.+ # 1.13.1 [2019.11.26] * Backport the `Generic(1)` instances for `Kleisli` introduced in `base-4.14`. 
README.md view
@@ -24,3 +24,63 @@ The current implementation integrates with the new GHC Generics. See http://www.haskell.org/haskellwiki/GHC.Generics for more information. Template Haskell code is provided for supporting older GHCs.++This library is organized as follows:++* `Generics.Deriving.Base` defines the core functionality for GHC generics,+  including the `Generic(1)` classes and representation data types.+  On modern versions of GHC, this simply re-exports `GHC.Generics` from+  `base`. On older versions of GHC, this module backports parts of+  `GHC.Generics` that were not included at the time, including `Generic(1)`+  instances.++* `Generics.Deriving.TH` implements Template Haskell functionality for+  deriving instances of `Generic(1)`.++* Educational code: in order to provide examples of how to define and use+  `GHC.Generics`-based defaults, this library offers a number of modules+  which define examples of type classes along with default implementations+  for the classes' methods. Currently, the following modules are provided:++  * `Generics.Deriving.Copoint`++  * `Generics.Deriving.ConNames`++  * `Generics.Deriving.Enum`++  * `Generics.Deriving.Eq`++  * `Generics.Deriving.Foldable`++  * `Generics.Deriving.Functor`++  * `Generics.Deriving.Monoid`++  * `Generics.Deriving.Semigroup`++  * `Generics.Deriving.Show`++  * `Generics.Deriving.Traversable`++  * `Generics.Deriving.Uniplate`++  It is worth emphasizing that these modules are primarly intended for+  educational purposes. Many of the classes in these modules resemble other+  commonly used classes—for example, `GShow` from `Generics.Deriving.Show`+  resembles `Show` from `base`—but in general, the classes that+  `generic-deriving` defines are not drop-in replacements. Moreover, the+  generic defaults that `generic-deriving` provide often make simplifying+  assumptions that may violate expectations of how these classes might work+  elsewhere. For example, the generic default for `GShow` does not behave+  exactly like `deriving Show` would.++  If you are seeking `GHC.Generics`-based defaults for type classes in+  `base`, consider using the+  [`generic-data`](http://hackage.haskell.org/package/generic-data) library.++* `Generics.Deriving.Default` provides newtypes that allow leveraging the+  generic defaults in this library using the `DerivingVia` GHC language+  extension.++* `Generics.Deriving` re-exports `Generics.Deriving.Base`,+  `Generics.Deriving.Default`, and a selection of educational modules.
generic-deriving.cabal view
@@ -1,5 +1,5 @@ name:                   generic-deriving-version:                1.13.1+version:                1.14 synopsis:               Generic programming library for generalised deriving. description: @@ -13,6 +13,50 @@   The current implementation integrates with the new GHC Generics. See   <http://www.haskell.org/haskellwiki/GHC.Generics> for more information.   Template Haskell code is provided for supporting older GHCs.+  .+  This library is organized as follows:+  .+  * "Generics.Deriving.Base" defines the core functionality for GHC generics,+    including the @Generic(1)@ classes and representation data types.+    On modern versions of GHC, this simply re-exports "GHC.Generics" from+    @base@. On older versions of GHC, this module backports parts of+    "GHC.Generics" that were not included at the time, including @Generic(1)@+    instances.+  .+  * "Generics.Deriving.TH" implements Template Haskell functionality for+    deriving instances of @Generic(1)@.+  .+  * Educational code: in order to provide examples of how to define and use+    "GHC.Generics"-based defaults, this library offers a number of modules+    which define examples of type classes along with default implementations+    for the classes' methods. Currently, the following modules are provided:+    "Generics.Deriving.Copoint", "Generics.Deriving.ConNames",+    "Generics.Deriving.Enum", "Generics.Deriving.Eq",+    "Generics.Deriving.Foldable", "Generics.Deriving.Functor",+    "Generics.Deriving.Monoid", "Generics.Deriving.Semigroup",+    "Generics.Deriving.Show", "Generics.Deriving.Traversable",+    and "Generics.Deriving.Uniplate".+    .    +    It is worth emphasizing that these modules are primarly intended for+    educational purposes. Many of the classes in these modules resemble other+    commonly used classes—for example, @GShow@ from "Generics.Deriving.Show"+    resembles @Show@ from @base@—but in general, the classes that+    @generic-deriving@ defines are not drop-in replacements. Moreover, the+    generic defaults that @generic-deriving@ provide often make simplifying+    assumptions that may violate expectations of how these classes might work+    elsewhere. For example, the generic default for @GShow@ does not behave+    exactly like @deriving Show@ would.+    .+    If you are seeking "GHC.Generics"-based defaults for type classes in+    @base@, consider using the+    @<http://hackage.haskell.org/package/generic-data generic-data>@ library.+  .+  * "Generics.Deriving.Default" provides newtypes that allow leveraging the+    generic defaults in this library using the @DerivingVia@ GHC language+    extension.+  .+  * "Generics.Deriving" re-exports "Generics.Deriving.Base",+    "Generics.Deriving.Default", and a selection of educational modules.  homepage:               https://github.com/dreixel/generic-deriving bug-reports:            https://github.com/dreixel/generic-deriving/issues@@ -35,7 +79,7 @@                       , GHC == 8.2.2                       , GHC == 8.4.4                       , GHC == 8.6.5-                      , GHC == 8.8.1+                      , GHC == 8.8.3                       , GHC == 8.10.1 extra-source-files:     CHANGELOG.md                       , README.md@@ -83,8 +127,8 @@    build-depends:        containers       >= 0.1   && < 0.7                       , ghc-prim                     < 1-                      , template-haskell >= 2.4   && < 2.17-                      , th-abstraction   >= 0.3   && < 0.4+                      , template-haskell >= 2.4   && < 2.18+                      , th-abstraction   >= 0.4   && < 0.5    default-language:     Haskell2010   ghc-options:          -Wall@@ -95,12 +139,15 @@   other-modules:        DefaultSpec                         EmptyCaseSpec                         ExampleSpec+                        T68Spec                         TypeInTypeSpec   build-depends:        base             >= 4.3  && < 5                       , generic-deriving                       , hspec            >= 2    && < 3-                      , template-haskell >= 2.4  && < 2.17+                      , template-haskell >= 2.4  && < 2.18   build-tool-depends:   hspec-discover:hspec-discover   hs-source-dirs:       tests   default-language:     Haskell2010   ghc-options:          -Wall -threaded -rtsopts+  if impl(ghc >= 8.6)+    ghc-options:        -Wno-star-is-type
src/Generics/Deriving/Enum.hs view
@@ -71,7 +71,7 @@ #if MIN_VERSION_base(4,9,0) import           Data.List.NonEmpty (NonEmpty) import qualified Data.Semigroup as Semigroup (First, Last)-import           Data.Semigroup (Arg, Max, Min, Option, WrappedMonoid)+import           Data.Semigroup (Arg, Max, Min, WrappedMonoid) #endif  -----------------------------------------------------------------------------@@ -477,9 +477,6 @@ #if MIN_VERSION_base(4,9,0) instance GEnum a => GEnum (NonEmpty a) where   genum = genumDefault--instance GEnum a => GEnum (Option a) where-  genum = genumDefault #endif  instance GEnum Ordering where@@ -1016,13 +1013,6 @@  #if MIN_VERSION_base(4,9,0) instance (GEq a, GEnum a, GIx a) => GIx (NonEmpty a) where-  range   = rangeDefault-  index   = indexDefault-  inRange = inRangeDefault-#endif--#if MIN_VERSION_base(4,9,0)-instance (GEq a, GEnum a, GIx a) => GIx (Option a) where   range   = rangeDefault   index   = indexDefault   inRange = inRangeDefault
src/Generics/Deriving/Eq.hs view
@@ -72,7 +72,7 @@ #if MIN_VERSION_base(4,9,0) import           Data.List.NonEmpty (NonEmpty) import qualified Data.Semigroup as Semigroup (First, Last)-import           Data.Semigroup (Arg(..), Max, Min, Option, WrappedMonoid)+import           Data.Semigroup (Arg(..), Max, Min, WrappedMonoid) #endif  --------------------------------------------------------------------------------@@ -479,9 +479,6 @@  #if MIN_VERSION_base(4,9,0) instance GEq a => GEq (NonEmpty a) where-  geq = geqdefault--instance GEq a => GEq (Option a) where   geq = geqdefault #endif 
src/Generics/Deriving/Foldable.hs view
@@ -81,7 +81,7 @@ import qualified Data.Functor.Sum as Functor (Sum) import           Data.List.NonEmpty (NonEmpty) import qualified Data.Semigroup as Semigroup (First, Last)-import           Data.Semigroup (Arg, Max, Min, Option, WrappedMonoid)+import           Data.Semigroup (Arg, Max, Min, WrappedMonoid) #endif  --------------------------------------------------------------------------------@@ -241,9 +241,6 @@   gfoldMap = gfoldMapdefault  instance GFoldable NonEmpty where-  gfoldMap = gfoldMapdefault--instance GFoldable Option where   gfoldMap = gfoldMapdefault #endif 
src/Generics/Deriving/Functor.hs view
@@ -66,7 +66,7 @@ import qualified Data.Functor.Sum as Functor (Sum) import           Data.List.NonEmpty (NonEmpty) import qualified Data.Semigroup as Semigroup (First, Last)-import           Data.Semigroup (Arg, Max, Min, Option, WrappedMonoid)+import           Data.Semigroup (Arg, Max, Min, WrappedMonoid) #endif  --------------------------------------------------------------------------------@@ -211,9 +211,6 @@   gmap = gmapdefault  instance GFunctor NonEmpty where-  gmap = gmapdefault--instance GFunctor Option where   gmap = gmapdefault #endif 
src/Generics/Deriving/Semigroup/Internal.hs view
@@ -189,9 +189,6 @@  instance GSemigroup (NonEmpty a) where   gsappend = (<>)--instance GSemigroup a => GSemigroup (Option a) where-  gsappend (Option a) (Option b) = Option (gsappend a b) #endif  -- Tuple instances
src/Generics/Deriving/Show.hs view
@@ -68,7 +68,7 @@ #if MIN_VERSION_base(4,9,0) import           Data.List.NonEmpty (NonEmpty) import qualified Data.Semigroup as Semigroup (First, Last)-import           Data.Semigroup (Arg, Max, Min, Option, WrappedMonoid)+import           Data.Semigroup (Arg, Max, Min, WrappedMonoid) #endif  --------------------------------------------------------------------------------@@ -539,9 +539,6 @@  #if MIN_VERSION_base(4,9,0) instance GShow a => GShow (NonEmpty a) where-  gshowsPrec = gshowsPrecdefault--instance GShow a => GShow (Option a) where   gshowsPrec = gshowsPrecdefault #endif 
src/Generics/Deriving/TH.hs view
@@ -345,11 +345,7 @@   let origSigTy = if useKindSigs                      then SigT origTy origKind                      else origTy-  tyIns <- tySynInstDCompat repName-#if MIN_VERSION_th_abstraction(0,3,0)-                            Nothing-#endif-                            [return origSigTy] (return tyInsRHS)+  tyIns <- tySynInstDCompat repName Nothing [return origSigTy] (return tyInsRHS)   let ecOptions = emptyCaseOptions opts       mkBody maker = [clause [] (normalB $         mkCaseExp gClass ecOptions name instTys cons maker) []]@@ -754,7 +750,7 @@ repFieldArg Gen0 t = boxT t repFieldArg (Gen1 name _) (VarT t) | t == name = conT par1TypeName repFieldArg gk@(Gen1 name _) t = do-  let tyHead:tyArgs      = unapplyTy t+  let (tyHead, tyArgs)   = unapplyTy t       numLastArgs        = min 1 $ length tyArgs       (lhsArgs, rhsArgs) = splitAt (length tyArgs - numLastArgs) tyArgs       rec0Type           = boxT t@@ -771,9 +767,8 @@                                `appT` repFieldArg gk beta       inspectTy _ = rec0Type -  itf <- isTyFamily tyHead-  if any (not . (`ground` name)) lhsArgs-       || any (not . (`ground` name)) tyArgs && itf+  itf <- isInTypeFamilyApp name tyHead tyArgs+  if any (not . (`ground` name)) lhsArgs || itf      then outOfPlaceTyVarError      else case rhsArgs of           []   -> rec0Type@@ -888,7 +883,7 @@ wC t name   | ground t name = conE $ boxRepName t   | otherwise = do-      let tyHead:tyArgs      = unapplyTy t+      let (tyHead, tyArgs)   = unapplyTy t           numLastArgs        = min 1 $ length tyArgs           (lhsArgs, rhsArgs) = splitAt (length tyArgs - numLastArgs) tyArgs @@ -902,9 +897,8 @@                                     (varE composeValName)                                     (varE fmapValName `appE` wC beta name) -      itf <- isTyFamily tyHead-      if any (not . (`ground` name)) lhsArgs-           || any (not . (`ground` name)) tyArgs && itf+      itf <- isInTypeFamilyApp name tyHead tyArgs+      if any (not . (`ground` name)) lhsArgs || itf          then outOfPlaceTyVarError          else case rhsArgs of               []   -> conE $ boxRepName t@@ -947,7 +941,7 @@ unwC t name   | ground t name = varE $ unboxRepName t   | otherwise = do-      let tyHead:tyArgs      = unapplyTy t+      let (tyHead, tyArgs)   = unapplyTy t           numLastArgs        = min 1 $ length tyArgs           (lhsArgs, rhsArgs) = splitAt (length tyArgs - numLastArgs) tyArgs @@ -961,9 +955,8 @@                                     (varE composeValName)                                     (varE unComp1ValName) -      itf <- isTyFamily tyHead-      if any (not . (`ground` name)) lhsArgs-           || any (not . (`ground` name)) tyArgs && itf+      itf <- isInTypeFamilyApp name tyHead tyArgs+      if any (not . (`ground` name)) lhsArgs || itf          then outOfPlaceTyVarError          else case rhsArgs of               []   -> varE $ unboxRepName t
src/Generics/Deriving/TH/Internal.hs view
@@ -26,6 +26,7 @@ import           Data.Set (Set)  import           Language.Haskell.TH.Datatype+import           Language.Haskell.TH.Datatype.TyVarBndr import           Language.Haskell.TH.Lib import           Language.Haskell.TH.Ppr (pprint) import           Language.Haskell.TH.Syntax@@ -101,9 +102,9 @@  -- | Converts a VarT or a SigT into Just the corresponding TyVarBndr. -- Converts other Types to Nothing.-typeToTyVarBndr :: Type -> Maybe TyVarBndr-typeToTyVarBndr (VarT n)          = Just (PlainTV n)-typeToTyVarBndr (SigT (VarT n) k) = Just (KindedTV n k)+typeToTyVarBndr :: Type -> Maybe TyVarBndrUnit+typeToTyVarBndr (VarT n)          = Just (plainTV n)+typeToTyVarBndr (SigT (VarT n) k) = Just (kindedTV n k) typeToTyVarBndr _                 = Nothing  -- | If a Type is a SigT, returns its kind signature. Otherwise, return *.@@ -143,38 +144,63 @@ makeFunKind argKinds resKind = foldr' ArrowK resKind argKinds #endif --- | Is the given type a type family constructor (and not a data family constructor)?-isTyFamily :: Type -> Q Bool-isTyFamily (ConT n) = do-    info <- reify n-    return $ case info of+-- | Detect if a Name occurs as an argument to some type family. This makes an+-- effort to exclude /oversaturated/ arguments to type families. For instance,+-- if one declared the following type family:+--+-- @+-- type family F a :: Type -> Type+-- @+--+-- Then in the type @F a b@, we would consider @a@ to be an argument to @F@,+-- but not @b@.+isInTypeFamilyApp :: Name -> Type -> [Type] -> Q Bool+isInTypeFamilyApp name tyFun tyArgs =+  case tyFun of+    ConT tcName -> go tcName+    _           -> return False+  where+    go :: Name -> Q Bool+    go tcName = do+      info <- reify tcName+      case info of #if MIN_VERSION_template_haskell(2,11,0)-         FamilyI OpenTypeFamilyD{} _       -> True+        FamilyI (OpenTypeFamilyD (TypeFamilyHead _ bndrs _ _)) _+          -> withinFirstArgs bndrs #elif MIN_VERSION_template_haskell(2,7,0)-         FamilyI (FamilyD TypeFam _ _ _) _ -> True+        FamilyI (FamilyD TypeFam _ bndrs _) _+          -> withinFirstArgs bndrs #else-         TyConI  (FamilyD TypeFam _ _ _)   -> True+        TyConI (FamilyD TypeFam _ bndrs _)+          -> withinFirstArgs bndrs #endif-#if MIN_VERSION_template_haskell(2,9,0)-         FamilyI ClosedTypeFamilyD{} _     -> True++#if MIN_VERSION_template_haskell(2,11,0)+        FamilyI (ClosedTypeFamilyD (TypeFamilyHead _ bndrs _ _) _) _+          -> withinFirstArgs bndrs+#elif MIN_VERSION_template_haskell(2,9,0)+        FamilyI (ClosedTypeFamilyD _ bndrs _ _) _+          -> withinFirstArgs bndrs #endif-         _ -> False-isTyFamily _ = return False +        _ -> return False+      where+        withinFirstArgs :: [a] -> Q Bool+        withinFirstArgs bndrs =+          let firstArgs = take (length bndrs) tyArgs+              argFVs    = freeVariables firstArgs+          in return $ name `elem` argFVs+ -- | True if the type does not mention the Name ground :: Type -> Name -> Bool-ground (AppT t1 t2) name = ground t1 name && ground t2 name-ground (SigT t _)   name = ground t name-ground (VarT t)     name = t /= name-ground ForallT{}    _    = rankNError-ground _            _    = True+ground ty name = name `notElem` freeVariables ty  -- | Construct a type via curried application. applyTyToTys :: Type -> [Type] -> Type applyTyToTys = foldl' AppT  -- | Apply a type constructor name to type variable binders.-applyTyToTvbs :: Name -> [TyVarBndr] -> Type+applyTyToTvbs :: Name -> [TyVarBndr_ flag] -> Type applyTyToTvbs = foldl' (\a -> AppT a . tyVarBndrToType) . ConT  -- | Split an applied type into its individual components. For example, this:@@ -188,14 +214,17 @@ -- @ -- [Either, Int, Char] -- @-unapplyTy :: Type -> [Type]-unapplyTy = reverse . go+unapplyTy :: Type -> (Type, [Type])+unapplyTy ty = go ty ty []   where-    go :: Type -> [Type]-    go (AppT t1 t2)    = t2 : go t1-    go (SigT t _)      = go t-    go (ForallT _ _ t) = go t-    go t               = [t]+    go :: Type -> Type -> [Type] -> (Type, [Type])+    go _      (AppT ty1 ty2)     args = go ty1 ty1 (ty2:args)+    go origTy (SigT ty' _)       args = go origTy ty' args+#if MIN_VERSION_template_haskell(2,11,0)+    go origTy (InfixT ty1 n ty2) args = go origTy (ConT n `AppT` ty1 `AppT` ty2) args+    go origTy (ParensT ty')      args = go origTy ty' args+#endif+    go origTy _                  args = (origTy, args)  -- | Split a type signature by the arrows on its spine. For example, this: --@@ -208,7 +237,7 @@ -- @ -- ([a, b], [a -> b, Char, ()]) -- @-uncurryTy :: Type -> ([TyVarBndr], [Type])+uncurryTy :: Type -> ([TyVarBndrSpec], [Type]) uncurryTy (AppT (AppT ArrowT t1) t2) =   let (tvbs, tys) = uncurryTy t2   in (tvbs, t1:tys)@@ -219,7 +248,7 @@ uncurryTy t = ([], [t])  -- | Like uncurryType, except on a kind level.-uncurryKind :: Kind -> ([TyVarBndr], [Kind])+uncurryKind :: Kind -> ([TyVarBndrSpec], [Kind]) #if MIN_VERSION_template_haskell(2,8,0) uncurryKind = uncurryTy #else@@ -229,9 +258,8 @@ uncurryKind k = ([], [k]) #endif -tyVarBndrToType :: TyVarBndr -> Type-tyVarBndrToType (PlainTV n)    = VarT n-tyVarBndrToType (KindedTV n k) = SigT (VarT n) k+tyVarBndrToType :: TyVarBndr_ flag -> Type+tyVarBndrToType = elimTV VarT (\n k -> SigT (VarT n) k)  -- | Generate a list of fresh names with a common prefix, and numbered suffixes. newNameList :: String -> Int -> Q [Name]@@ -294,9 +322,8 @@ unSigT t          = t  -- | Peel off a kind signature from a TyVarBndr (if it has one).-unKindedTV :: TyVarBndr -> TyVarBndr-unKindedTV (KindedTV n _) = PlainTV n-unKindedTV tvb            = tvb+unKindedTV :: TyVarBndrUnit -> TyVarBndrUnit+unKindedTV tvb = elimTV (\_ -> tvb) (\n _ -> plainTV n) tvb  -- | Does the given type mention any of the Names in the list? mentionsName :: Type -> [Name] -> Bool@@ -361,7 +388,7 @@ -- Determines the universally quantified type variables (possibly after -- substituting * in the case of Generic1) and the last type parameter name -- (if there is one).-genericKind :: GenericClass -> [Type] -> ([TyVarBndr], GenericKind)+genericKind :: GenericClass -> [Type] -> ([TyVarBndrUnit], GenericKind) genericKind gClass tySynVars =   case gClass of     Generic  -> (freeVariablesWellScoped tySynVars, Gen0)@@ -437,9 +464,13 @@   . showString "‘\n\tClass Generic1 expects an argument of kind * -> *"   $ "" +-- | The data type mentions the last type variable in a place other+-- than the last position of a data type in a constructor's field. outOfPlaceTyVarError :: Q a outOfPlaceTyVarError = fail-    "Type applied to an argument involving the last parameter is not of kind * -> *"+  . showString "Constructor must only use its last type variable as"+  . showString " the last argument of a data type"+  $ ""  -- | Cannot have a constructor argument of form (forall a1 ... an. <type>) -- when deriving Generic(1)@@ -486,7 +517,7 @@   nameBase dataName ++ " must not have a datatype context"  -- | Deriving Generic(1) doesn't work with ExistentialQuantification or GADTs.-checkExistentialContext :: Name -> [TyVarBndr] -> Cxt -> Q ()+checkExistentialContext :: Name -> [TyVarBndrUnit] -> Cxt -> Q () checkExistentialContext conName vars ctxt =   unless (null vars && null ctxt) $ fail $     nameBase conName ++ " must be a vanilla data constructor"@@ -820,9 +851,6 @@  undefinedValName :: Name undefinedValName = mkNameG_v "base" "GHC.Err" "undefined"--starKindName :: Name-starKindName = mkGHCPrimName_tc "GHC.Prim" "*"  decidedLazyDataName :: Name decidedLazyDataName = mkGD4'9_d "DecidedLazy"
src/Generics/Deriving/Traversable.hs view
@@ -70,7 +70,7 @@ import qualified Data.Functor.Sum as Functor (Sum) import           Data.List.NonEmpty (NonEmpty) import qualified Data.Semigroup as Semigroup (First, Last)-import           Data.Semigroup (Arg, Max, Min, Option, WrappedMonoid)+import           Data.Semigroup (Arg, Max, Min, WrappedMonoid) #endif  --------------------------------------------------------------------------------@@ -213,9 +213,6 @@   gtraverse = gtraversedefault  instance GTraversable NonEmpty where-  gtraverse = gtraversedefault--instance GTraversable Option where   gtraverse = gtraversedefault #endif 
tests/DefaultSpec.hs view
@@ -28,7 +28,7 @@ #if __GLASGOW_HASKELL__ >= 806 import Test.Hspec.QuickCheck -import Data.Semigroup (First(..), Option(..))+import Data.Semigroup (First(..)) import Data.Foldable (sequenceA_) import Generics.Deriving hiding (universe) import Generics.Deriving.Default ()@@ -132,7 +132,7 @@   deriving (GSemigroup) via (First Bool)  newtype TestFoldable a = TestFoldable (Maybe a)-  deriving (GFoldable) via (Default1 Option)+  deriving (GFoldable) via (Default1 Maybe)  newtype TestFunctor a = TestFunctor (Maybe a)   deriving stock (Eq, Show, Functor)
+ tests/T68Spec.hs view
@@ -0,0 +1,23 @@+{-# LANGUAGE CPP #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}++#if __GLASGOW_HASKELL__ >= 706+{-# LANGUAGE DataKinds #-}+#endif++module T68Spec (main, spec) where++import Generics.Deriving.TH+import Test.Hspec++main :: IO ()+main = hspec spec++spec :: Spec+spec = return ()++type family F68 :: * -> *+type instance F68 = Maybe+data T68 a = MkT68 (F68 a)+$(deriveAll1 ''T68)