Ticket #1250 (closed proposal: duplicate)

Opened 6 years ago

Last modified 4 years ago

Data.Map.map should be deprecated/removed

Reported by: ajb@… Owned by:
Priority: normal Milestone:
Component: libraries/base Version: 6.6
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Difficulty: Easy (less than 1 hour)
Test Case: Blocked By:
Blocking: Related Tickets:

Description

(Note: Every claim here referring to Data.Map.map applies equally well to Data.IntMap?.map.)

I believe that Data.Map.map is a misfeature and should be deprecated or removed.

1. Its name clashes with an extremely commonly-used Prelude function. This makes the first import of Data.Map into an existing module very expensive. Either all existing instances of "map" need to be qualified, or the import of Data.Map needs to be qualified (which works, but makes (!) and (\\) unnecessarily inelegant), or the import must hide map.

2. There is an easy way to get at the functionality which is already implemented: use fmap.

Data.Set.map and Data.IntSet?.map have similar problems, however you can't just "use fmap" in that case. I don't have a good solution except to rename these.

Data.Map.null also clashes with the Prelude, and should be reconsidered. However, again, there isn't a simple workaround, and there are many more overloadings of null (e.g. Data.ByteString?). It's also likely that null is used far less than map, so the cost of a clash is much lower.

Change History

Changed 6 years ago by guest

  • status changed from new to closed
  • resolution set to duplicate

Accidental duplicate of #1249.

Changed 5 years ago by simonmar

  • architecture changed from Multiple to Unknown/Multiple

Changed 5 years ago by simonmar

  • os changed from Multiple to Unknown/Multiple

Changed 4 years ago by simonmar

  • difficulty changed from Easy (1 hr) to Easy (less than 1 hour)
Note: See TracTickets for help on using tickets.