BSD-3-Clause licensed by Ryan Scott
Maintained by Ryan Scott
This version can be pinned in stack with:deriving-compat-0.3.1@sha256:9524f452a4a084b40c4388316de90564320a03f0ea6e2253d28ec1dfc40cec45,6797

Module documentation for 0.3.1

deriving-compat

Hackage Hackage Dependencies Haskell Programming Language BSD3 License Build

Provides Template Haskell functions that mimic deriving extensions that were introduced or modified in recent versions of GHC. Currently, the following extensions are covered:

  • DeriveFoldable
  • DeriveFunctor
  • DeriveTraversable

The following changes have been backported:

  • In GHC 8.0, DeriveFoldable was changed to allow folding over data types with existential constraints.
  • In GHC 8.0, DeriveFoldable and DeriveTraversable were changed so as not to generate superfluous mempty or pure expressions in generated code. As a result, this allows deriving Traversable instances for datatypes with unlifted argument types.
  • In GHC 8.0, deriving Show was changed so that constructor fields with unlifted types are no longer shown with parentheses, and the output of showing an unlifted type is suffixed with the same number of hash signs as the corresponding primitive literals.
  • In GHC 8.2, deriving Ord was changed so that it generates concrete if-expressions that are not subject to RebindableSyntax.

Note that some recent GHC extensions are not covered by this package:

  • 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 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 th-lift to derive Lift using Template Haskell.

Changes

0.3.1

  • Allow deriving Functor and Foldable instances for datatypes containing unboxed tuples
  • Microoptimization in derived instances of higher-order versions of Eq, Ord, Read, and Show

0.3

  • Added Data.Eq.Deriving, which allows deriving Eq, Eq1, and Eq2 with TH.
  • Added Data.Ord.Deriving, which allows deriving Ord, Ord1, and Ord2 with TH.
  • Added Data.Read.Deriving, which allows deriving Read, Read1, and Eq2 with TH.
  • Renamed Text.Show.Deriving.Options to ShowOptions so as to disambiguate it from the options datatypes in other deriving-compat modules.

0.2.2

  • Fixed a bug in Text.Show.Deriving’s treatment of unlifted types

0.2.1

  • Added Text.Show.Deriving, which allows deriving Show, Show1, and Show2 with TH.

0.2

  • Added support for GHC 8.0
  • Added Data.Functor.Deriving and Data.Traversable.Deriving, which allow deriving Functor and Traversable with TH.
  • Added Data.Deriving, which reexports all other modules

0.1

  • Initial commit