Description
Background
I've just finished going through all of the open issues and pull requests and I've noticed a bunch of them are of the form "Consider adding x to the Y api", and the discussion usually ends with, "I like this idea, but this is a somewhat special and the api is already huge, so probably not."
See below for a list of open issues that request that things be added to containers. Many of these are reasonable requests and things that not everyone should need to write themselves, but also don't quite belong in the core containers
API. By creating an official containers-extra
package we can provide the "extra" API functions to reduce code duplication in other libraries, (potentially) user more efficient implementations using the Internal
s, and use it as a test bed to see which operations are widely used to give us data for what should be included in the core api.
Open API Requests
- Add Data.Set.catMaybes and Data.Set.mapMaybe? (Add Data.Set.catMaybes and Data.Set.mapMaybe? #346)
mapMaybe :: Ord b => (a -> Maybe b) -> Set a -> Set b
catMaybes :: Ord a => Set (Maybe a) -> Set a
- Note: No real desire for
catMaybes
- Unfold for Maps and Easier Conversion from Foldable (Unfold for Maps and Easier Conversion from Foldable #338)
fromFoldable :: (Ord k, Foldable f) => (a -> (k,v)) -> f a -> Map k v
- Applicative/monadic versions of adjust/update/alter functions (Consider adding applicative/monadic versions of adjust/update/alter functions #278)
- Note:
alterF
already added, no real desire for the others
- Note:
- Data.Sequence.{splitAtR, takeR, dropR} (Consider adding Data.Sequence.{splitAtR, takeR, dropR} #159)
splitAtR :: Int -> Seq a -> (Seq a, Seq a)
takeR :: Int -> Seq a -> Seq a
drop :: Int -> Seq a -> Seq a
- Map.differenceSet (add Map.differenceSet #158)
differenceSet :: Ord k => Map k a -> Set k -> Map k a
- Map.fromListWithDefault (fromListWithDefault #386)
fromListWithDefault :: Ord k => b -> (a -> b -> b) -> [(k, a)] -> Map k b
- Add Data.Sequence.filterM (Add filterM #120)
filterM :: Applicative f => (a -> f Bool) -> Seq a -> f (Seq a)
- Unicode 2d drawing for Data.Tree (Unicode 2d drawing for Data.Tree #344)
- Add Data.Map.toSet (association set conversions for Data.Map types #391)
toSet :: Map k v -> Set (k, v)
- add Data.Set.unionIntersection (Data.Set: add unionIntersection #162)
unionIntersection :: (Ord a) => Set a -> Set a -> (Set a, Set a)
- Data.Map lacks unionsWithKey (Data.Map lacks unionsWithKey #137)
unionsWithKey :: Ord k => (k -> a -> a -> a) -> [Map k a] -> Map k a
Add foldMapWithIndex and traverseWithIndex (Add foldMapWithIndex and traverseWithIndex #89)Consider adding fromFunction to Data.IntMap (Consider adding fromFunction to Data.IntMap #96)fromFunction :: Int -> Int -> (Int -> a) -> IntMap a
- Map.traverseWithKey_? (traverseWithKey_? #422)
traverseWithKey :: Applicative t => (k -> a -> t b) -> Map k a -> t (Map k b)
already exists, what would the type oftraverseWithKey_
be?
- add ordNub somewhere in containers (add ordNub somewhere in containers #439)
ordNub :: Ord a => [a] -> [a]
(usesSet
under the hood)- possibly going into containers proper(?)
- Add intersections, intersectionsWith (Add intersections, intersectionsWith #359)
intersections :: NonEmpty (IntMap a) -> IntMap a
intersectionsWith :: (a -> a -> a) -> NonEmpty (IntMap a) -> IntMap a
- somewhat controversial