generic-deriving: Generic programming library for generalised deriving.
This package provides functionality for generalising the deriving mechanism in Haskell to arbitrary classes. It was first described in the paper:
A generic deriving mechanism for Haskell. Jose Pedro Magalhaes, Atze Dijkstra, Johan Jeuring, and Andres Loeh. Haskell'10.
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 frombase
. On older versions of GHC, this module backports parts of GHC.Generics that were not included at the time, includingGeneric(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
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.
[Skip to Readme]
Modules
[Index] [Quick Jump]
- Generics
- Generics.Deriving
- Generics.Deriving.Base
- Generics.Deriving.ConNames
- Generics.Deriving.Copoint
- Generics.Deriving.Default
- Generics.Deriving.Enum
- Generics.Deriving.Eq
- Generics.Deriving.Foldable
- Generics.Deriving.Functor
- Generics.Deriving.Instances
- Generics.Deriving.Monoid
- Generics.Deriving.Semigroup
- Generics.Deriving.Show
- Generics.Deriving.TH
- Generics.Deriving.Traversable
- Generics.Deriving.Uniplate
- Generics.Deriving
Downloads
- generic-deriving-1.14.6.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
- No Candidates
Versions [RSS] | 0.3, 0.3.1, 0.4, 1.0.1, 1.0.2, 1.0.3, 1.2.1, 1.2.2, 1.3.0, 1.3.1, 1.4.0, 1.5.0, 1.6, 1.6.1, 1.6.2, 1.6.3, 1.7.0, 1.8.0, 1.9.0, 1.10.0, 1.10.1, 1.10.2, 1.10.3, 1.10.4, 1.10.4.1, 1.10.5, 1.10.6, 1.10.7, 1.11, 1.11.1, 1.11.2, 1.12, 1.12.1, 1.12.2, 1.12.3, 1.12.4, 1.13, 1.13.1, 1.14, 1.14.1, 1.14.2, 1.14.3, 1.14.4, 1.14.5, 1.14.6 (info) |
---|---|
Change log | CHANGELOG.md |
Dependencies | base (>=4.9 && <5), containers (>=0.1 && <0.8), ghc-prim (<1), template-haskell (>=2.11 && <2.24), th-abstraction (>=0.4 && <0.8) [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 | 2011-2013 Universiteit Utrecht, University of Oxford |
Author | José Pedro Magalhães |
Maintainer | generics@haskell.org |
Category | Generics |
Home page | https://github.com/dreixel/generic-deriving |
Bug tracker | https://github.com/dreixel/generic-deriving/issues |
Source repo | head: git clone https://github.com/dreixel/generic-deriving |
Uploaded | by ryanglscott at 2024-12-05T12:04:23Z |
Distributions | Arch:1.14.5, Debian:1.13.1, Fedora:1.14.4, FreeBSD:1.8.0, LTSHaskell:1.14.6, NixOS:1.14.5, Stackage:1.14.6 |
Reverse Dependencies | 56 direct, 14882 indirect [details] |
Downloads | 146181 total (417 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-05 [all 1 reports] |