generic-constraints: Constraints via Generic

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

Standalone deriving without boiler-plate


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 1.0.0, 1.1.0, 1.1.1, 1.1.1.1
Change log CHANGELOG
Dependencies base (>=4.9 && <5), template-haskell, th-abstraction [details]
License BSD-3-Clause
Author Sjoerd Visscher, Xia Li-yao, Yair Chuchem
Maintainer yairchu@gmail.com
Category Generics
Home page https://github.com/yairchu/generic-constraints
Bug tracker https://github.com/yairchu/generic-constraints/issues
Source repo head: git clone git://github.com/yairchu/generic-constraints.git
Uploaded by YairChuchem at 2019-08-29T07:08:40Z
Distributions LTSHaskell:1.1.1.1, NixOS:1.1.1.1, Stackage:1.1.1.1
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 1997 total (20 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2019-08-29 [all 1 reports]

Readme for generic-constraints-1.1.1.1

[back to package description]

Standalone deriving without boiler-plate

Write short and concise contexts based on generics.

Instead of writing boiler-plate standalone deriving clauses in the form of

deriving instance [Various Eq Constraints Here] => Instance Eq MyType

With generic-constraints you can use

deriving instance Constraints MyType Eq => Eq MyType

Or, using TH, simply

makeDeriving ''Eq ''MyType

And for several classes and types:

makeDerivings [''Eq, ''Ord, ''Show] [''MyType, ''MyOtherType]

Credits

This library was extracted from the one-liner library by Sjoerd Visscher and Xia Li-yao.