name: linear-generics
version: 0.2
synopsis: Generic programming library for generalised deriving.
description:
This package offers a version of
<https://hackage.haskell.org/package/base/docs/GHC-Generics.html GHC.Generics>
with two important improvements:
.
1. The @to@, @from@, @to1@, and @from1@ methods have multiplicity-polymorphic
types, allowing them to be used with either traditional Haskell code or
linearly typed code.
.
2. The representations used for @Generic1@ are modified slightly. As a result,
@to1@ and @from1@ never need to use @fmap@. This can
<https://gitlab.haskell.org/ghc/ghc/-/issues/15969 greatly improve performance>,
and it is
<https://github.com/tweag/linear-base/pull/316 necessary to support multiplicity polymorphism>.
A smaller change, approximately
<https://gitlab.haskell.org/ghc/ghc/-/issues/7492 as proposed by spl>,
reduces the number of instances that must be written to actually use @Generic1@
for deriving instances of other classes.
.
For more details, see the "Generics.Linear" documentation.
.
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
derive @Generic@ and @Generic1@ instances from
@"GHC.Generics".'GHC.Generics.Generic'@. Because these instances necessarily
use unsafe coercions, their use will likely inhibit full optimization of
code using them.
.
Educational code: the educational modules exported by
<https://hackage.haskell.org/package/generic-deriving 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@.
homepage: https://github.com/linear-generics/linear-generics
bug-reports: https://github.com/linear-generics/linear-generics/issues
category: Generics
copyright: 2011-2013 Universiteit Utrecht,
University of Oxford,
Ryan Scott,
2021 David Feuer
license: BSD3
license-file: LICENSE
author: José Pedro Magalhães
maintainer: David.Feuer@gmail.com
stability: experimental
build-type: Simple
cabal-version: >= 1.10
tested-with: GHC == 9.0.1
, GHC == 9.2.1
extra-source-files: CHANGELOG.md
, README.md
source-repository head
type: git
location: https://github.com/linear-generics/linear-generics
library
hs-source-dirs: src
exposed-modules:
Generics.Linear
Generics.Linear.Unsafe.ViaGHCGenerics
Generics.Linear.TH
Generics.Linear.TH.Insertions
other-modules:
Generics.Linear.Instances
Generics.Linear.Class
Generics.Linear.TH.Internal
Generics.Linear.TH.MetaData
Generics.Linear.Instances.Base
Generics.Linear.Instances.Containers
Generics.Linear.Instances.Linear_generics
Generics.Linear.Instances.Template_haskell
build-depends: base >= 4.15 && < 5
, containers >= 0.5.9 && < 0.7
, ghc-prim < 1
, template-haskell >= 2.16 && < 2.19
, th-abstraction >= 0.4 && < 0.5
default-language: Haskell2010
default-extensions: KindSignatures
, TypeFamilies
, DataKinds
ghc-options: -Wall
test-suite spec
type: exitcode-stdio-1.0
main-is: Spec.hs
other-modules:
DataFamilyKindsSpec
DefaultSpec
EmptyCaseSpec
ExampleSpec
T68Spec
TypeInTypeSpec
Examples
Generics.Deriving.ConNames
Generics.Deriving.Copoint
Generics.Deriving.Default
Generics.Deriving.Enum
Generics.Deriving.Eq
Generics.Deriving.Foldable
Generics.Deriving.Functor
Generics.Deriving.Monoid
Generics.Deriving.Monoid.Internal
Generics.Deriving.Semigroup
Generics.Deriving.Semigroup.Internal
Generics.Deriving.Show
Generics.Deriving.Traversable
Generics.Deriving.TraversableConf
Generics.Deriving.Uniplate
build-depends: base >= 4.15 && < 5
, linear-generics
, hspec >= 2 && < 3
, template-haskell >= 2.16 && < 2.19
build-tool-depends: hspec-discover:hspec-discover
hs-source-dirs: tests
default-language: Haskell2010
ghc-options: -Wall -threaded -rtsopts