deriving-compat: Backports of GHC deriving extensions

[ bsd3, compatibility, library ] [ Propose Tags ] [ Report a vulnerability ]

deriving-compat 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

  • Deriving Ord

  • Deriving Read

  • Deriving Show

  • 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.

In addition, deriving-compat also provides some additional deriving functionality that has not yet been merged into upstream GHC. Aside from the GHC deriving extensions mentioned above, deriving-compat also permits deriving instances of classes in the Data.Functor.Classes module, covering the Eq1, Eq2, Ord1, Ord2, Read1, Read2, Show1, and Show2 classes. This extra functionality is outside of the main scope of deriving-compat, as it does not backport extensions that exist in today's GHC. Nevertheless, the underlying Template Haskell machinery needed to derive Eq and friends extends very naturally to Eq1 and friends, so this extra functionality is included in deriving-compat as a convenience.

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 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.

  • 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 bifunctors to derive these typeclasses using Template Haskell.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1, 0.2, 0.2.1, 0.2.2, 0.3, 0.3.1, 0.3.2, 0.3.3, 0.3.4, 0.3.5, 0.3.6, 0.4, 0.4.1, 0.4.2, 0.4.3, 0.5, 0.5.1, 0.5.2, 0.5.3, 0.5.4, 0.5.5, 0.5.6, 0.5.7, 0.5.8, 0.5.9, 0.5.10, 0.6, 0.6.1, 0.6.2, 0.6.3, 0.6.4, 0.6.5, 0.6.6, 0.6.7 (info)
Change log CHANGELOG.md
Dependencies base (>=4.9 && <5), containers (>=0.1 && <0.8), ghc-boot-th, ghc-prim, template-haskell (>=2.11 && <2.24), th-abstraction (>=0.5 && <0.8), transformers (>=0.5 && <0.7), transformers-compat (>=0.5) [details]
Tested with 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.2, ghc ==9.2.8, ghc ==9.4.8, ghc ==9.6.6, ghc ==9.8.4, ghc ==9.10.1, ghc ==9.12.1
License BSD-3-Clause
Copyright (C) 2015-2017 Ryan Scott
Author Ryan Scott
Maintainer Ryan Scott <ryan.gl.scott@gmail.com>
Category Compatibility
Home page https://github.com/haskell-compat/deriving-compat
Bug tracker https://github.com/haskell-compat/deriving-compat/issues
Source repo head: git clone https://github.com/haskell-compat/deriving-compat
Uploaded by ryanglscott at 2024-12-06T00:37:12Z
Distributions Arch:0.6.6, Debian:0.5.9, LTSHaskell:0.6.7, NixOS:0.6.6, Stackage:0.6.7
Reverse Dependencies 24 direct, 49 indirect [details]
Downloads 47269 total (249 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2024-12-06 [all 1 reports]

Readme for deriving-compat-0.6.7

[back to package description]

deriving-compat

Hackage Hackage Dependencies Haskell Programming Language BSD3 License Build Status

deriving-compat 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
  • Deriving Ord
  • Deriving Read
  • Deriving Show
  • 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.

In addition, deriving-compat also provides some additional deriving functionality that has not yet been merged into upstream GHC. Aside from the GHC deriving extensions mentioned above, deriving-compat also permits deriving instances of classes in the Data.Functor.Classes module, covering the Eq1, Eq2, Ord1, Ord2, Read1, Read2, Show1, and Show2 classes. This extra functionality is outside of the main scope of deriving-compat, as it does not backport extensions that exist in today's GHC. Nevertheless, the underlying Template Haskell machinery needed to derive Eq and friends extends very naturally to Eq1 and friends, so this extra functionality is included in deriving-compat as a convenience.

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 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.
  • 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 bifunctors to derive these typeclasses using Template Haskell.