diff --git a/docs/spec.md b/docs/spec.md index 49f67e7..7207d98 100644 --- a/docs/spec.md +++ b/docs/spec.md @@ -130,6 +130,7 @@ equivalent to that of the derivation (or derivations). * [Group](#group) * [Semigroupoid](#semigroupoid) * [Category](#category) +* [Filterable](#filterable) * [Functor](#functor) * [Bifunctor](#bifunctor) * [Contravariant](#contravariant) @@ -250,6 +251,21 @@ support `Semigroupoid` algebra for the same `T`, and obey following laws: 1. Left identity: `M.compose(M.id(), a) ≡ a` +### Filterable + +```js +Filterable { + filter: (a => boolean, T) => T +} +``` + +Module must match the `Filterable` signature for some type `T`, and obey following laws: + + 1. Distributivity: `F.filter(x => f(x) && g(x), a) ≡ F.filter(g, F.filter(f, a))` + 1. Identity: `F.filter(x => true, a) ≡ a` + 1. Annihilation: `F.filter(x => false, a) ≡ F.filter(x => false, b)` + + ### Functor ```js