Minor containers API changes
Felipe Almeida Lessa
felipe.lessa at gmail.com
Wed Nov 30 13:51:20 CET 2011
On Wed, Nov 30, 2011 at 4:54 AM, Liyang HU <haskell.org at liyang.hu> wrote:
> Evan Laforge <qdunkan <at> gmail.com> writes:
>> > 5) `toDescList` exists in Map, but not in IntMap, Set or IntSet.
>> Without this function
>> there's no way to (efficiently) iterate over a map backwards, which is
>> pretty essential for an ordered collection!
> How about using the Down/Dual/Desc/Converse/Opposite/Reverse newtype discussed
> in another recent thread, and providing for Data.Map:
> reverse :: Map k a -> Map (Reverse k) a
> reverse Tip = Tip
> reverse (Bin n k a l r) = Bin n (Reverse k) a (reverse r) (reverse l)
> (Arguably we also need reverse' :: Map (Reverse k) a -> Map k a. Hmm...)
reverse' :: Map (Reverse k) a -> Map k a
reverse' = unsafeCoerce . reverse
Sorry, couldn't resist =).
More information about the Libraries