Ticket #5242 (closed feature request: wontfix)

Opened 2 years ago

Last modified 15 months ago

IntMap.differenceKeysSet for removing an IntSet of keys

Reported by: liyang Owned by: fox@…
Priority: normal Milestone: 7.6.1
Component: libraries (other) Version: 7.1
Keywords: containers Cc: hackage.haskell.org@…, johan.tibell@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty:
Test Case: Blocked By:
Blocking: Related Tickets:

Description

Currently, IntMap.difference ma mb removes all the keys in mb from ma, where the elements of the two IntMaps can be of different types; the elements of mb are not used.

There is no efficient way to remove an IntSet of keys, however. These patches adds the IntMap.differenceKeysSet function—essentially a copy/paste of difference—that satisfies the following property:

prop_DiffKeysSet :: Map Int -> Map () -> Bool
prop_DiffKeysSet t1 t2
  = difference t1 t2 == differenceKeysSet t1 (keysSet t2)

Attachments

Change History

Changed 2 years ago by liyang

Changed 2 years ago by liyang

Changed 2 years ago by liyang

  • cc hackage.haskell.org@… added
  • status changed from new to patch

Changed 2 years ago by liyang

forgot to export differenceKeysSet

Changed 2 years ago by igloo

  • owner set to fox@…

Changed 2 years ago by igloo

  • cc johan.tibell@… added
  • owner changed from fox@… to fox@…

Changed 23 months ago by igloo

  • milestone set to 7.4.1

Changed 16 months ago by igloo

  • milestone changed from 7.4.1 to 7.6.1

Changed 15 months ago by milan

  • status changed from patch to closed
  • resolution set to wontfix

Hi,

I am closing the proposal. The representation of IntSet? has changed in the development version of containers and no longer corresponds 1:1 to IntMap?. The patch could be modified to reflect this, but I do not believe the differenceKeysSet method is worth fiddling with IntSet? internals in IntMap? module.

FYI, Data.IntMap?.fromSet will be provided in the new version of containers. So it will be possible to do IntMap?.difference map (fromSet (const ()) set).

Cheers, Milan

Note: See TracTickets for help on using tickets.