cluss: simple alternative to type classes
A cluss enables you to achieve function overloading, or ad-hoc polymorphism, without creating a new type class.
In order to give ad-hoc polymorphism to a type variable a
,
you simply use In
with a list of "type patterns" like In [Type T, ...] a
,
which indicates that the type matches some of the patterns;
which is analogous to a type class indicating that a type matches some of its "instances".
The constraint In [Type T, ...] a
is what we call a "cluss".
Cluss instances are closed and cluss methods are open, unlike type classes, whose instances are open and whose methods are closed.
Clusses can easily be used in a nested way, and can even be recursive, just like recursive type classes, and therefore clusses are expressive enough to imitate Haskell-98-style type classes.
More information can be found in the Haddock or the comments in the source code. The updated haddock is here: http://kinokkory.github.io/cluss/.
Downloads
- cluss-0.1.tar.gz [browse] (Cabal source package)
- Package description (revised from the package)
Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
- No Candidates
Versions [RSS] | 0.1, 0.2, 0.3 |
---|---|
Dependencies | base (>=4 && <5) [details] |
Tested with | ghc ==7.8.3 |
License | BSD-3-Clause |
Copyright | Copyright (C) 2014 Yusuke Matsushita |
Author | Yusuke Matsushita |
Maintainer | Yusuke Matsushita <y.skm24t@gmail.com> |
Revised | Revision 4 made by Kinokkory at 2014-10-05T12:05:45Z |
Category | type system, constraints |
Home page | https://github.com/Kinokkory/cluss |
Bug tracker | https://github.com/Kinokkory/cluss/issues |
Source repo | head: git clone git@github.com:Kinokkory/cluss.git |
Uploaded | by Kinokkory at 2014-10-03T14:01:20Z |
Distributions | |
Reverse Dependencies | 2 direct, 0 indirect [details] |
Downloads | 3538 total (3 in the last 30 days) |
Rating | (no votes yet) [estimated by Bayesian average] |
Your Rating | |
Status | Docs uploaded by user Build status unknown [no reports yet] |