Comments (1)
Thanks very much for raising this issue, @danr. :)
Until recently Fantasy Land did not define a Filterable type class, so it was necessary to cobble together a filter function from the type classes available at the time. In #2 we introduced two filter functions:
filter :: (Applicative f, Foldable f, Monoid (f a)) => (a -> Boolean, f a) -> f a
filterM :: (Monad m, Monoid (m a)) => (a -> Boolean, m a) -> m a
The goal was to support as many filterable types as possible by providing two different derivations. The functions were necessarily given different names, with the M
suffix hinting at the Monad m
constraint. Although the M
suffix may have been added for the same reason as in Haskell, Sanctuary's filterM
was never intended to mirror its Haskell namesake.
In #37 the type of filterM
was changed to permit Z.filterM(odd, Just(4))
:
-filterM :: (Monad m, Monoid (m a)) => (a -> Boolean, m a) -> m a
+filterM :: (Alternative m, Monad m) => (a -> Boolean, m a) -> m a
Recently, in #80, the two filter functions were replaced with a single unified function:
filter :: Filterable f => (a -> Boolean, f a) -> f a
Now that the name is available we could provide the Sanctuary equivalent of Haskell's filterM
. I find your powerset
example extremely compelling! If you're interested in working on a pull request for this addition, please say so. :)
from sanctuary-type-classes.
Related Issues (20)
- Defining instances for "native" JS values (that are not Fantasy-Land compatible) HOT 2
- `test` methods should respect constraints HOT 2
- Improve TypeError messages HOT 1
- Consider providing the sanctuary-type-classes API as curried functions
- traverse not stack safe HOT 3
- Z.toString behaves incorrectly in Internet Explorer 9 HOT 1
- Z.toString cannot handle NodeJS Buffer HOT 3
- Add Object#ap and Object#of HOT 10
- Add support for Keyed Collections HOT 13
- [email protected] HOT 3
- handling of duplicate keys in Object$prototype$concat HOT 9
- Add Object$prototype$traverse HOT 1
- test lawfulness of implementations for built-in types
- [email protected]
- Derive flip from map HOT 10
- consider ignoring inherited properties in StrMap implementations HOT 9
- Add `reduceMap` (aka `foldMap`) HOT 3
- define Array$prototype$bimap for two-element arrays HOT 10
- `is` can be fooled
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sanctuary-type-classes.