Generalize filterM to Applicative

David Feuer david.feuer at gmail.com
Tue Dec 30 17:34:16 UTC 2014


I realized just now that we can actually make the type a little bit
more general still, interpreting `filterM` for lists as being an
applicative filter *producing* lists:

filterM :: (Applicative f, Foldable t) => (a -> f Bool) -> t a -> f [a]



On Mon, Dec 29, 2014 at 3:17 PM, Edward Kmett <ekmett at gmail.com> wrote:
> I think this is the interpretation I think we're probably best left with.
>
> I agree that names matter and that anachronistic labels confuse, but I think
> it is the lesser of evils to widen the definition of the 'M' suffix than it
> is to double up on almost all the names taken in the environment and force
> the entire community to go through a positively gigantic deprecation cycle.
>
> -Edward
>
> On Mon, Dec 29, 2014 at 1:31 PM, Andreas Abel <andreas.abel at ifi.lmu.de>
> wrote:
>>
>> Or you can widen the interpretation of suffix ...M as "effectful", which
>> could be a monadic or applicative effect.
>>
>> On 29.12.2014 16:50, Kim-Ee Yeoh wrote:
>>>
>>>
>>> On Mon, Dec 29, 2014 at 7:58 PM, Edward Kmett <ekmett at gmail.com
>>> <mailto:ekmett at gmail.com>> wrote:
>>>
>>>     Is it "madness" to want to avoid namespace proliferation and
>>>     maximize the usefulness of an existing combinator now that the
>>>     constraints that forged it have changed to allow it to be slightly
>>>     more permissive?
>>>
>>>
>>> Madness is such strong language for this august list.
>>>
>>> May I speak on behalf of haskell newcomers for a time?
>>>
>>> Haskell places such an emphasis on uniformity and regularity. Functions
>>> with names that end with M once meant they were monadic variants of
>>> those that don't. That's no longer uniformly the case, because of the
>>> FAM restructuring.
>>>
>>> The names of functions matter.
>>>
>>> Anachronistic labels confuse.
>>>
>>> Leaving filterM with a type signature of Applicative cannot be the
>>> long-term solution.
>>>
>>> -- Kim-Ee
>>>
>>>
>>> _______________________________________________
>>> Libraries mailing list
>>> Libraries at haskell.org
>>> http://www.haskell.org/mailman/listinfo/libraries
>>>
>>
>>
>> --
>> Andreas Abel  <><      Du bist der geliebte Mensch.
>>
>> Department of Computer Science and Engineering
>> Chalmers and Gothenburg University, Sweden
>>
>> andreas.abel at gu.se
>> http://www2.tcs.ifi.lmu.de/~abel/
>
>
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries
>


More information about the Libraries mailing list