superconstraints: Access an instance's constraints

[ bsd3, constraints, library ] [ Propose Tags ]

Constraint manipulation


[Skip to Readme]

Modules

[Last Documentation]

  • Data
    • Constraint
      • Data.Constraint.Super

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.0.1, 0.0.2
Dependencies base (>=4.9.1 && <4.10), constraints (>=0.9.1 && <0.10), containers (>=0.5.7.1 && <0.6), haskell-src-meta (>=0.7.0.1 && <0.8), mtl (>=2.2.1 && <2.3), tagged (>=0.8.5 && <0.9), template-haskell (>=2.11.1 && <2.12), type-eq (>=0.5 && <0.6) [details]
License BSD-3-Clause
Copyright Copyright (C) 2013 Ryan Trinkle
Author Ryan Trinkle
Maintainer Ryan Trinkle <ryan.trinkle@gmail.com>
Category Constraints
Home page http://github.com/ryantrinkle/superconstraints
Bug tracker http://github.com/ryantrinkle/superconstraints/issues
Source repo head: git clone https://github.com/ryantrinkle/superconstraints
Uploaded by RyanTrinkle at 2017-05-28T21:08:00Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 1520 total (2 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2017-05-28 [all 3 reports]

Readme for superconstraints-0.0.2

[back to package description]

superconstraints

A way of inferring instance constraints given an instance.

Suppose you have a class like this:

class C a

instance C a => C [a]

Normally, given C [a], you cannot obtain C a; however, superconstraints allows you to add that capability:

class HasSuper (C a) => C a

instance C a => C [a]
makeSuper "C [a]"

Then, you can retrieve the superconstraint by doing:

case super (Proxy :: Proxy (C [a])) of
  Dict -> ...

The superconstraint dictionary will include all of the constraints required by the instance.

Future Improvements

  • Replace the crazy string argument to makeSuper with something more sensible