packages feed

deriving-compat-0.6: deriving-compat.cabal

name:                deriving-compat
version:             0.6
synopsis:            Backports of GHC deriving extensions
description:         Provides Template Haskell functions that mimic deriving
                     extensions that were introduced or modified in recent versions
                     of GHC. Currently, the following typeclasses/extensions are covered:
                     .
                     * Deriving @Bounded@
                     .
                     * Deriving @Enum@
                     .
                     * Deriving @Ix@
                     .
                     * Deriving @Eq@, @Eq1@, and @Eq2@
                     .
                     * Deriving @Ord@, @Ord1@, and @Ord2@
                     .
                     * Deriving @Read@, @Read1@, and @Read2@
                     .
                     * Deriving @Show@, @Show1@, and @Show2@
                     .
                     * @DeriveFoldable@
                     .
                     * @DeriveFunctor@
                     .
                     * @DeriveTraversable@
                     .
                     * @GeneralizedNewtypeDeriving@ (with GHC 8.2 or later)
                     .
                     * @DerivingVia@ (with GHC 8.2 or later)
                     .
                     See the "Data.Deriving" module for a full list of backported changes.
                     .
                     Note that some recent GHC typeclasses/extensions are not covered by this package:
                     .
                     * @DeriveDataTypeable@
                     .
                     * @DeriveGeneric@, which was introducted in GHC 7.2 for deriving
                       @Generic@ instances, and modified in GHC 7.6 to allow derivation
                       of @Generic1@ instances. Use @Generics.Deriving.TH@ from
                       @<http://hackage.haskell.org/package/generic-deriving generic-deriving>@
                       to derive @Generic(1)@ using Template Haskell.
                     .
                     * @DeriveLift@, which was introduced in GHC 8.0 for deriving
                       @Lift@ instances. Use @Language.Haskell.TH.Lift@ from
                       @<http://hackage.haskell.org/package/th-lift th-lift>@
                       to derive @Lift@ using Template Haskell.
                     .
                     * The @Bifunctor@ typeclass, which was introduced in GHC 7.10,
                       as well as the @Bifoldable@ and @Bitraversable@ typeclasses, which
                       were introduced in GHC 8.2. Use @Data.Bifunctor.TH@ from
                       @<http://hackage.haskell.org/package/bifunctors bifunctors>@
                       to derive these typeclasses using Template Haskell.
homepage:            https://github.com/haskell-compat/deriving-compat
bug-reports:         https://github.com/haskell-compat/deriving-compat/issues
license:             BSD3
license-file:        LICENSE
author:              Ryan Scott
maintainer:          Ryan Scott <ryan.gl.scott@gmail.com>
stability:           Experimental
copyright:           (C) 2015-2017 Ryan Scott
category:            Compatibility
build-type:          Simple
extra-source-files:  CHANGELOG.md, README.md
tested-with:         GHC == 7.0.4
                   , GHC == 7.2.2
                   , GHC == 7.4.2
                   , GHC == 7.6.3
                   , GHC == 7.8.4
                   , GHC == 7.10.3
                   , GHC == 8.0.2
                   , GHC == 8.2.2
                   , GHC == 8.4.4
                   , GHC == 8.6.5
                   , GHC == 8.8.4
                   , GHC == 8.10.7
                   , GHC == 9.0.1
                   , GHC == 9.2.*
cabal-version:       >=1.10

source-repository head
  type:                git
  location:            https://github.com/haskell-compat/deriving-compat

flag base-4-9
  description:         Use base-4.9 or later.
  default:             True

flag template-haskell-2-11
  description:         Use template-haskell-2.11.0.0 or later.
  default:             True

flag new-functor-classes
  description:         Use a version of transformers or transformers-compat with a
                       modern-style Data.Functor.Classes module. This flag cannot be
                       used when building with transformers-0.4, since it comes with
                       a different version of Data.Functor.Classes.
  default:             True

library
  exposed-modules:     Data.Deriving
                       Data.Deriving.Internal

                       Data.Bounded.Deriving
                       Data.Bounded.Deriving.Internal
                       Data.Deriving.Via
                       Data.Deriving.Via.Internal
                       Data.Enum.Deriving
                       Data.Enum.Deriving.Internal
                       Data.Eq.Deriving
                       Data.Eq.Deriving.Internal
                       Data.Foldable.Deriving
                       Data.Functor.Deriving.Internal
                       Data.Functor.Deriving
                       Data.Ix.Deriving
                       Data.Ix.Deriving.Internal
                       Data.Ord.Deriving
                       Data.Ord.Deriving.Internal
                       Data.Traversable.Deriving
                       Text.Read.Deriving
                       Text.Read.Deriving.Internal
                       Text.Show.Deriving
                       Text.Show.Deriving.Internal
  other-modules:       Paths_deriving_compat
  build-depends:       containers          >= 0.1   && < 0.7
                     , ghc-prim
                     , th-abstraction      >= 0.4   && < 0.5

  if flag(base-4-9)
    build-depends:     base                >= 4.9   && < 5
    cpp-options:       "-DNEW_FUNCTOR_CLASSES"
  else
    build-depends:     base                >= 4.3   && < 4.9

  if flag(template-haskell-2-11)
    build-depends:     template-haskell    >= 2.11  && < 2.19
                     , ghc-boot-th
  else
    build-depends:     template-haskell    >= 2.5   && < 2.11

  if flag(new-functor-classes)
    build-depends:     transformers        (>= 0.2  && < 0.4) || >= 0.5
                     , transformers-compat >= 0.5
    cpp-options:       "-DNEW_FUNCTOR_CLASSES"
  else
    build-depends:     transformers        == 0.4.*

  hs-source-dirs:      src
  default-language:    Haskell2010
  ghc-options:         -Wall

test-suite spec
  type:                exitcode-stdio-1.0
  main-is:             Spec.hs
  other-modules:       BoundedEnumIxSpec
                       DerivingViaSpec
                       EqSpec
                       FunctorSpec
                       OrdSpec
                       ReadSpec
                       ShowSpec
                       GH6Spec
                       GH24Spec
                       GH27Spec
                       GH31Spec

                       Types.EqOrd
                       Types.ReadShow
  build-depends:       base-compat         >= 0.8.1  && < 1
                     , base-orphans        >= 0.5    && < 1
                     , deriving-compat
                     , hspec               >= 1.8
                     , QuickCheck          >= 2      && < 3
                     , tagged              >= 0.7    && < 1
                     , template-haskell    >= 2.5    && < 2.19
                     , void                >= 0.5.10 && < 1
  build-tool-depends:  hspec-discover:hspec-discover >= 1.8

  if flag(base-4-9)
    build-depends:     base                >= 4.9 && < 5
    cpp-options:       "-DNEW_FUNCTOR_CLASSES"
  else
    build-depends:     base                >= 4.3 && < 4.9

  if flag(new-functor-classes)
    build-depends:     transformers        (>= 0.2 && < 0.4) || (>= 0.5 && < 0.6)
                     , transformers-compat >= 0.5
    cpp-options:       "-DNEW_FUNCTOR_CLASSES"
  else
    build-depends:     transformers        == 0.4.*

  hs-source-dirs:      tests
  default-language:    Haskell2010
  ghc-options:         -Wall -threaded -rtsopts
  if impl(ghc >= 8.6)
    ghc-options:       -Wno-star-is-type