linear-generics: Generic programming library for generalised deriving.
This package offers a version of GHC.Generics with two important improvements:
The
to
,from
,to1
, andfrom1
methods have multiplicity-polymorphic types, allowing them to be used with either traditional Haskell code or linearly typed code.The representations used for
Generic1
are modified slightly. As a result,to1
andfrom1
never need to usefmap
. This can greatly improve performance, and it is necessary to support multiplicity polymorphism. A smaller change, approximately as proposed by spl, reduces the number of instances that must be written to actually useGeneric1
for deriving instances of other classes.
For more details, see the Generics.Linear documentation.
The implementation is based on the generic-deriving
package, first described in the paper
A generic deriving mechanism for Haskell. Jose Pedro Magalhaes, Atze Dijkstra, Johan Jeuring, and Andres Loeh. Haskell'10.
This library is organized as follows:
Generics.Linear defines the core functionality for generics, including the multiplicity-polymorphic
Generic(1)
classes and a replacement for the:.:
composition type.Generics.Linear.TH implements Template Haskell functionality for deriving instances of
Generic(1)
.Generics.Linear.Unsafe.ViaGHCGenerics offers
DerivingVia
targets to deriveGeneric
andGeneric1
instances fromGHC.Generics.
. Because these instances necessarily use unsafe coercions, their use will likely inhibit full optimization of code using them.GHC.Generics.Generic
Educational code: the educational modules exported by
generic-deriving
have been copied into the tests/Generic/Deriving
directory
in this repository, with the very few modifications required to
accommodate the differences between the Generic1
representations
here and in base
. All the same caveats apply as in the originals;
see that package's README
.
[Skip to Readme]
Modules
[Index] [Quick Jump]
- Generics
- Generics.Linear
- Generics.Linear.TH
- Generics.Linear.TH.Insertions
- Unsafe
- Generics.Linear.TH
- Generics.Linear
Downloads
- linear-generics-0.2.3.tar.gz [browse] (Cabal source package)
- Package description (revised from the package)
Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
- No Candidates
Versions [RSS] | 0.1.0.0, 0.1.0.1, 0.2, 0.2.1, 0.2.2, 0.2.3 (info) |
---|---|
Change log | CHANGELOG.md |
Dependencies | base (>=4.15 && <5), containers (>=0.5.9 && <0.8), ghc-prim (<1), template-haskell (>=2.16 && <2.23), th-abstraction (>=0.5 && <0.8) [details] |
Tested with | ghc ==9.0.2, ghc ==9.2.7, ghc ==9.4.4, ghc ==9.6.1, ghc ==9.8.1 |
License | BSD-3-Clause |
Copyright | 2011-2013 Universiteit Utrecht, University of Oxford, Ryan Scott, 2021 David Feuer |
Author | José Pedro Magalhães |
Maintainer | David.Feuer@gmail.com |
Revised | Revision 2 made by aspiwack at 2024-05-23T13:41:47Z |
Category | Generics |
Home page | https://github.com/linear-generics/linear-generics |
Bug tracker | https://github.com/linear-generics/linear-generics/issues |
Source repo | head: git clone https://github.com/linear-generics/linear-generics |
Uploaded | by aspiwack at 2024-01-09T13:27:10Z |
Distributions | Arch:0.2.1, LTSHaskell:0.2.3, NixOS:0.2.3, Stackage:0.2.3 |
Reverse Dependencies | 2 direct, 15 indirect [details] |
Downloads | 1854 total (49 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-01-09 [all 1 reports] |