More Data.Set and Data.Map operations

Edward Kmett ekmett at gmail.com
Sun Aug 7 05:45:12 UTC 2016


When the predicate is monotone then all of those operations have the same
semantics as filter.

-Edward

On Sun, Aug 7, 2016 at 1:34 AM, Ivan Lazar Miljenovic <
ivan.miljenovic at gmail.com> wrote:

> On 7 August 2016 at 15:04, David Feuer <david.feuer at gmail.com> wrote:
> > Sorry about that. filterIncreasing and filterDecreasing filter assuming a
> > predicate that is increasing or decreasing on the key values. So instead
> of
> > an O(n) pass over the whole set/map, they simply perform an O(log n)
> split.
>
> So it's more like a takeWhile, (dropWhile . not) and span than filter
> and predicate for lists?
>
> >
> >
> > On Aug 6, 2016 11:31 PM, "Ivan Lazar Miljenovic" <
> ivan.miljenovic at gmail.com>
> > wrote:
> >>
> >> On 7 August 2016 at 13:15, David Feuer <david.feuer at gmail.com> wrote:
> >> > Cale Gibbard and Ryan Trinkle are interested in adding some more
> >> > operations they say will be useful in their work. Note that
> >> > unionWithMapping is intended to enable an efficient implementation of
> >> > alignWith in Data.Align in the `these` package.
> >> >
> >> > Set:
> >> >
> >> > filterIncreasing :: Ord a => (a -> Bool) -> Set a -> Set a
> >> > filterDecreasing :: Ord a => (a -> Bool) -> Set a -> Set a
> >> > partitionIncreasing :: Ord a => (a -> Bool) -> Set a -> (Set a, Set a)
> >>
> >> I'm not sure what the difference between the first two functions are,
> >> or even how they differ from a generic filter function.
> >>
> >> >
> >> > Map:
> >> >
> >> > filterKeysIncreasing :: Ord k => (k -> Bool) -> Map k a -> Map k a
> >> > filterKeysDecreasing :: Ord k => (k -> Bool) -> Map k a -> Map k a
> >> > partitionKeysIncreasing :: Ord k => (k -> Bool) -> Map k a -> (Map k
> a,
> >> > Map k a)
> >> >
> >> > traverseMaybe :: Applicative f => (a -> f (Maybe b)) -> Map k a -> f
> >> > (Map k b)
> >> >
> >> > alterMany :: Ord k => (a -> Maybe b -> Maybe b) -> Map k a -> Map k b
> ->
> >> > Map k b
> >> >
> >> > alterManyA :: (Applicative f, Ord k) => (a -> Maybe b -> f (Maybe b))
> >> > -> Map k a -> Map k b -> f (Map k b)
> >> >
> >> > unionWithMapping :: Ord k => (a -> c) -> (b -> c) -> (a -> b -> c) ->
> >> > Map k a -> Map k b -> Map k c
> >> >
> >> > unionWithKeyMapping :: Ord k => (k -> a -> c) -> (k -> b -> c) -> (k
> >> > -> a -> b -> c)
> >> > -> Map k a -> Map k b -> Map k c
> >> > _______________________________________________
> >> > Libraries mailing list
> >> > Libraries at haskell.org
> >> > http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
> >>
> >>
> >>
> >> --
> >> Ivan Lazar Miljenovic
> >> Ivan.Miljenovic at gmail.com
> >> http://IvanMiljenovic.wordpress.com
>
>
>
> --
> Ivan Lazar Miljenovic
> Ivan.Miljenovic at gmail.com
> http://IvanMiljenovic.wordpress.com
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20160807/95c87187/attachment.html>


More information about the Libraries mailing list