Skip to content

ryantrinkle/superconstraints

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published