Ticket #5162 (closed feature request: wontfix)
Add Int index functions to Data.Set
Description
Data.Map has some functions that allow a Map's entries to be accessed through Int indexes:
lookupIndex :: Ord k => k -> Map k a -> Maybe Int findIndex :: Ord k => k -> Map k a -> Int elemAt :: Int -> Map k a -> (k, a) updateAt :: (k -> a -> Maybe a) -> Int -> Map k a -> Map k a deleteAt :: Int -> Map k a -> Map k a
With the exception of updateAt, these functions are trivially adaptable to Data.Set.
I attach a patch to this ticket that does that. My Data.Set implementations of the functions are modeled on the ones from Data.Map. Functions implemented:
lookupIndex :: Ord a => a -> Set a -> Maybe Int findIndex :: Ord a => a -> Set a -> Int elemAt :: Int -> Set a -> a deleteAt :: Int -> Set a -> Set a
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

