Structural assertions on generic type representations.

Stackage Nightly 2024-06-22:0.3.0
Latest on Hackage:0.3.0

See all snapshots generic-type-asserts appears in

MIT licensed by Ben Orchard
Maintained by Ben Orchard
This version can be pinned in stack with:generic-type-asserts-0.3.0@sha256:02835db89f8a77bfcc5a06b7f0fb3274e7c249a1f71f15e07bd4857353fb9559,1740

Module documentation for 0.3.0

Depends on 1 package(full list with versions):


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.


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


0.3.0 (2024-04-10)

Rename package from generic-data-asserts to generic-type-asserts. This package only does type-level work, so it’s more appropriate.

  • don’t expose util type families

0.2.0 (2024-04-05)

  • split errors out into own module

0.1.1 (2024-04-04)

Initial release.

  • extracted from generic-data-functions