subcategories alternatives and similar packages
Based on the "Data" category
Do you think we are missing an alternative of subcategories or a related project?
This package provides variants of functor-like structures, with domain types are constrained. In particular, this package provides an abstraction for functorial containers, which can be expressed as a functor from a full-subcategory of Hask to Hask itself 1.
- We can treat
Setas if it is a
Applicative, with their domain restricted to full-subcategory Ord of
Ordinstances of Hask.
mono-traversablepackage), we provide
WrapMonowrapper with zero-cost coercion. Such
monos can be regarded as a functorial structure from the full subcategory consisting of just a single object, say
This library is designed to keep the abstraction runtime overhead as minimum as possible.
- If a constrained term such as
czipWithhas concrete type, it must have exactly the same representation as the corresponding operation modulo (zero-cost) coercion.
- The same still holds if the set of required constraints coincides.
- Although the constructor of
WrapMono mono ais hidden, its just a
mono; hence, constrained operators must have the same representations as the corresponding combinators in
- OTOH, for a polymorphic term, like
cmap :: (Ord a, Ord b) => (a -> b) Set a -> Set band
Set.map, they can have different representations; indeed,
Ord-instance and therefore the implementation of
cmapdiscards the dictionary for
Ord ato call
CFoldable, a constrained counterpart of
Foldable, doesn't require a functoriality as with the original