sanctuary-adt-matrix
v1.0.1
Published
Matrix that shows which Sanctuary ADT's implements which Type Classes
Downloads
6
Readme
Sanctuary ADT Matrix
Usage:
$ npx sanctuary-adt-matrix
| Type Class | Pair | Maybe | Either | Future | | ------------- | ---- | ----- | ------ | ------ | | Setoid | ✅ | ✅ | ✅ | ❌ | | Ord | ✅ | ✅ | ✅ | ❌ | | Semigroupoid | ✅ | ❌ | ❌ | ❌ | | Category | ❌ | ❌ | ❌ | ❌ | | Semigroup | ✅ | ✅ | ✅ | ❌ | | Monoid | ❌ | ✅ | ❌ | ❌ | | Group | ❌ | ❌ | ❌ | ❌ | | Filterable | ❌ | ✅ | ❌ | ❌ | | Functor | ✅ | ✅ | ✅ | ✅ | | Bifunctor | ✅ | ❌ | ✅ | ✅ | | Profunctor | ❌ | ❌ | ❌ | ❌ | | Apply | ✅ | ✅ | ✅ | ✅ | | Applicative | ❌ | ✅ | ✅ | ✅ | | Chain | ✅ | ✅ | ✅ | ✅ | | ChainRec | ❌ | ✅ | ✅ | ✅ | | Monad | ❌ | ✅ | ✅ | ✅ | | Alt | ❌ | ✅ | ✅ | ✅ | | Plus | ❌ | ✅ | ❌ | ❌ | | Alternative | ❌ | ✅ | ❌ | ❌ | | Foldable | ✅ | ✅ | ✅ | ❌ | | Traversable | ✅ | ✅ | ✅ | ❌ | | Extend | ✅ | ✅ | ✅ | ❌ | | Comonad | ✅ | ❌ | ❌ | ❌ | | Contravariant | ❌ | ❌ | ❌ | ❌ |
Using the matrix API
Test Sanctuary's Algebraic Data Types (ADT) for Type Class support.
The API is unstable and will probably change between minor versions.
const { adts, typeClassTests } = require ('sanctuary-adt-matrix');
// adts :: Array (Array (String Adt))
[
['Pair' , Adt],
['Maybe' , Adt],
['Either', Adt],
['Future', Adt]
]
// typeClassTests :: Array (Array (String Adt) -> Array (String))
typeClassTests [0] (adts) // -> [ 'Setoid', '✅', '✅', '✅', '❌' ]