constraint-classes alternatives and similar packages
Based on the "Unclassified" category
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest. Visit our partner's website for more details.
Do you think we are missing an alternative of constraint-classes or a related project?
This package reimplements various type classes for types that have constraints.
Constraints are represented using
ConstraintKinds and the classes are
constructed in a way that is supposed to not clash with the regular ones.
Many types constructors have fundamental constraints in their domains. For
example, storable vectors can only contain elements that are
these cases, no class instances can be done and overloading is completely lost.
This package tries to solve this problem while:
- being compatible with
- being as seamless to use as possible
- preserving type inference
These constraints make a more general,
subhask-like solution not desirable.
The domain of a type function
f is represented by a type family
Dom f a of
Constraint. The domain can be cartesian or closed, represented by
DomClosed containing the appropriate constraint
The class functions use the domain:
_fmap :: (CFunctor f, Dom f a, Dom f b) => (a -> b) -> f a -> f b
and the domain classifiers:
_zipA :: (CApply f, DomCartesian f, Dom f a, Dom f b) => f a -> f b -> f (a, b)
The general rule of translation from standard classes is:
- classes are prefixed with a
- functions are prefixed with a
- operators are suffixed with
Currently the implemented classes are, approximately from
base, which some
An instance for
Apply for a functor whose domain is not cartesian closed
needs to have
_ap = undefined. This is not a problem since any use of
will not compile due to the lack of
DomClosed instance, but it's ugly.
Monads are supposed to be endofunctors, which is not the case here, I'm not sure how to interpret that.
Improve the architecture, better choice of classes, more classes, more instances.