Proposal: containers: add indexing operations for Set

Jon Fairbairn jon.fairbairn at cl.cam.ac.uk
Wed Jul 4 10:39:07 CEST 2012


Patrick Palka <patrick at parcs.ath.cx> writes:

> I'd like to add the following indexing operations for
> Data.Set.Set, to complement the existing functions for
> Data.Map.Map:
>
> findIndex :: Ord a => a -> Set a -> Int
> lookupIndex :: Ord a => a -> Set a -> Maybe Int
> elemAt :: Int -> Set a -> a
> deleteAt :: Int -> Set a -> Set a

These seem to be abstraction-breaking. And what do we expect
from

  let i = findIndex a s1
  in deleteAt i (s1 `union` s2)

and similar?

-- 
Jón Fairbairn                                 Jon.Fairbairn at cl.cam.ac.uk




More information about the Libraries mailing list