generic-type-asserts: Structural assertions on generic type representations.

[ data, generics, library, mit, type ] [ Propose Tags ] [ Report a vulnerability ]

Please see README.md.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.3.0
Change log CHANGELOG.md
Dependencies base (>=4.14 && <5) [details]
License MIT
Author Ben Orchard
Maintainer Ben Orchard <thefirstmuffinman@gmail.com>
Category Data, Generics, Type
Home page https://github.com/raehik/generic-type-asserts#readme
Bug tracker https://github.com/raehik/generic-type-asserts/issues
Source repo head: git clone https://github.com/raehik/generic-type-asserts
Uploaded by raehik at 2024-04-10T22:16:00Z
Distributions LTSHaskell:0.3.0, NixOS:0.3.0, Stackage:0.3.0
Reverse Dependencies 1 direct, 2 indirect [details]
Downloads 74 total (7 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

Readme for generic-type-asserts-0.3.0

[back to package description]

generic-data-asserts

Structural assertions on the generic data representations (GHC.Generic.Rep a).

Sometimes, we want to write generics that only work on certain data types with a certain shape e.g. non-sum types (single constructor). Achieving this is fairly straightforward if we add a TypeError constraint on the relevant generic representation unwrapping instance (here, the (:+:) constructor sum type).

This library effectively pulls those checks out of generic code and runs them by separately. This way, we can simplify our generics, and make them more flexible (e.g. a user may choose whether to permit void types at compile time or not).

This began as a minor feature in my generic-data-functions library.

License

Provided under the MIT license. See LICENSE for license text.