Proposal: Add filterM or filterA to Data.Sequence

Johan Tibell johan.tibell at gmail.com
Tue Dec 30 17:05:56 UTC 2014


We should check that `filterM . toList` isn't as fast. That was the case
for bytestring and we rejected adding filterM there for that reason.

On Mon, Dec 29, 2014 at 6:13 AM, Edward Kmett <ekmett at gmail.com> wrote:

> +1 to just generalizing filterM in Data.Sequence
>
> On Sun, Dec 28, 2014 at 12:22 AM, David Feuer <david.feuer at gmail.com>
> wrote:
>
>> This can be given exactly the same implementation as the one for lists:
>>
>> filterM :: (Applicative f) => (a -> f Bool) -> Seq a -> f (Seq a)
>> filterM p = foldr go (pure empty)
>>   where
>>     go x r = f <$> p x <*> r
>>       where
>>         f flg ys = if flg then x <| ys else ys
>>
>>
>> Bikeshed all you like over the name.
>> _______________________________________________
>> Libraries mailing list
>> Libraries at haskell.org
>> http://www.haskell.org/mailman/listinfo/libraries
>>
>
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20141230/cd7b165e/attachment.html>


More information about the Libraries mailing list