| CARVIEW |
Select Language
HTTP/1.1 200 OK
Connection: keep-alive
Server: nginx/1.24.0 (Ubuntu)
Content-Type: text/html; charset=utf-8
Cache-Control: public, max-age=300
Content-Encoding: gzip
Via: 1.1 varnish, 1.1 varnish
Accept-Ranges: bytes
Age: 0
Date: Sun, 18 Jan 2026 00:32:59 GMT
X-Served-By: cache-dfw-kdfw8210142-DFW, cache-bom-vanm7210034-BOM
X-Cache: MISS, MISS
X-Cache-Hits: 0, 0
X-Timer: S1768696378.385332,VS0,VE863
Vary: Accept, Accept-Encoding
transfer-encoding: chunked
subcategories: Subcategories induced by class constraints
The
subcategories: Subcategories induced by class constraints
Modules
[Index] [Quick Jump]
Downloads
- subcategories-0.2.1.2.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
- No Candidates
| Versions [RSS] | 0.1.0.0, 0.1.1.0, 0.2.0.0, 0.2.0.1, 0.2.1.0, 0.2.1.1, 0.2.1.2 |
|---|---|
| Change log | ChangeLog.md |
| Dependencies | base (>=4.7 && <5), containers, data-default, foldl, hashable, mono-traversable, pointed, primitive, reflection, semialign, template-haskell, text, these, unordered-containers, vector, vector-algorithms, vector-builder [details] |
| Tested with | ghc ==9.6.7 || ==9.8.4 || ==9.10.2 || ==9.12.2 |
| License | BSD-3-Clause |
| Copyright | 2023 (c) Hiromi ISHII |
| Author | Hiromi ISHII |
| Maintainer | konn.jinro _at_ gmail.com |
| Uploaded | by HiromiIshii at 2025-07-20T08:41:42Z |
| Category | Data |
| Home page | https://github.com/konn/subcategories#readme |
| Bug tracker | https://github.com/konn/subcategories/issues |
| Source repo | head: git clone https://github.com/konn/subcategories |
| Distributions | LTSHaskell:0.2.1.2, NixOS:0.2.1.2, Stackage:0.2.1.2 |
| Reverse Dependencies | 1 direct, 3 indirect [details] |
| Downloads | 1846 total (24 in the last 30 days) |
| Rating | (no votes yet) [estimated by Bayesian average] |
| Your Rating |
|
| Status | Docs available [build log] Last success reported on 2025-07-20 [all 1 reports] |
Readme for subcategories-0.2.1.2
[back to package description]The subcategories package
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.
For example:
- We can treat
Setas if it is aFuctor,Foldable,Applicative, with their domain restricted to full-subcategory Ord ofOrdinstances of Hask. - For
MonoFoldableorMonoTraversabletypes (frommono-traversablepackage), we provideWrapMonowrapper with zero-cost coercion. Suchmonos can be regarded as a functorial structure from the full subcategory consisting of just a single object, sayElement mono.
Optimisation
This library is designed to keep the abstraction runtime overhead as minimum as possible.
Some notes:
- If a constrained term such as
cmaporczipWithhas 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 anewtype-wrapper aroundmono; hence, constrained operators must have the same representations as the corresponding combinators inmono-traversablepackage.
- OTOH, for a polymorphic term, like
cmap :: (Ord a, Ord b) => (a -> b) Set a -> Set bandSet.map, they can have different representations; indeed,Set.mapdoesn't requireato beOrd-instance and therefore the implementation ofcmapdiscards the dictionary forOrd ato callSet.map.
Strictly speaking, CFoldable, a constrained counterpart of Foldable, doesn't require a functoriality as with the original Foldable.