Data.IntMap/IntSet inconsistencies

View: New views
2 Messages — Rating Filter:   Alert me  

Data.IntMap/IntSet inconsistencies

by Arkleseizure :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2) the types are not general enough : like zip you should be able to
take functions f : a->b->c instead of what intersectionWith forces you
to do (f: a->b->a).

According to my documentation, the type of intersectionWith is (f :: a -> b -> c). 
 
On another note, with respect to my proposed change:  I concede that it might be too general for some people.  Here's a simpler change that I'd like: to be able to project information out of a value and modify it simultaneously, so simply

alterProject :: (Maybe a -> (z, Maybe a)) -> k -> Map k a -> (z, Map k a )

for a specific key.

and perhaps something similar for the min/max operations.  I'd very much like to be able to do more general things than just min/max operations with this sort of generality -- hence the Alternative approach in my original proposal.

Louis Wasserman
wasserman.louis@...
http://profiles.google.com/wasserman.louis

_______________________________________________
Libraries mailing list
Libraries@...
http://www.haskell.org/mailman/listinfo/libraries

Re: Data.IntMap/IntSet inconsistencies

by Ben-145 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, Nov 4, 2009 at 11:57 AM, Louis Wasserman
<wasserman.louis@...> wrote:
>
> According to my documentation, the type of intersectionWith is (f :: a -> b
> -> c).

apologies, i'm using 6.10 so apparently my containers library is out
of date.  i guess this is another reason to upgrade to 6.12:

http://www.haskell.org/ghc/dist/current/docs/html/users_guide/release-6-12-1.html

1.5.9.5. containers

Version number 0.3.0.0 (was 0.2.0.1)

mapAccumRWithKey has been added to Data.IntMap.

A Traversable instance has been added to Data.IntMap.IntMap.

The types of Data.IntMap.intersectionWith and
Data.IntMap.intersectionWithKey have been changed from

intersectionWith :: (a -> b -> a) -> IntMap a -> IntMap b -> IntMap a
intersectionWithKey :: (Key -> a -> b -> a) -> IntMap a -> IntMap b -> IntMap a
to

intersectionWith :: (a -> b -> c) -> IntMap a -> IntMap b -> IntMap c
intersectionWithKey :: (Key -> a -> b -> c) -> IntMap a -> IntMap b -> IntMap c

b
_______________________________________________
Libraries mailing list
Libraries@...
http://www.haskell.org/mailman/listinfo/libraries