Feature request: `traverseKeys` and `traverseKeysWith`
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
Start by reading the existing mapKeys, traverse, assocs, fromList, and fromListWith entry points in the containers implementation. Compare the proposed traverseKeys and traverseKeysWith behavior with those APIs, then verify duplicate-key handling and complexity before adding tests that establish the requested types and results.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Currently there are functions
mapKeys :: (Ord k) => (j -> k) -> Map j a -> Map k a
traverse :: (Applicative f) => (a -> f b) -> Map k a -> f (Map k b)
but nothing of the type (Applicative f, Ord k) => (j -> f k) -> Map j a -> f (Map k a).
A sample implementation:
traverseKeys :: (Applicative f, Ord k) => (j -> f k) -> Map j a -> f (Map k a)
traverseKeys f = fmap fromList . traverse (\(j, a) -> (,a) <$> f j) . assocs
traverseKeysWith :: (Applicative f, Ord k) => (a -> a -> a) -> (j -> f k) -> Map j a -> f (Map k a)
traverseKeysWith c f = fmap (fromListWith c) . traverse (\(j, a) -> (,a) <$> f j) . assocs
which is O(n log n), if I'm not mistaken; though I haven't looked through the internals of the implementation to dig for further optimizations.
- Lingua principale
- Haskell
- Stelle
- 355
- Fork
- 194
- Merge medio
- 3g 4h
- PR unite (30g)
- 7
Preparare l'ambiente
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di haskell/containers
-
unfoldTree is too lazyApertamajor-release strictness Tree
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
haskell/containers#1260 ·
I maintainer di solito rispondono entro 1 giorno
-
IntSet low-hanging-fruit performance
Difficoltà 3/5 1-2 giorni Idoneità per principianti 58/100
haskell/containers#1251 ·
I maintainer di solito rispondono entro 1 giorno
-
maintainability major-release
Difficoltà 3/5 1-2 giorni Idoneità per principianti 70/100
haskell/containers#1250 ·
I maintainer di solito rispondono entro 1 giorno
-
PostOrder: foldl and foldr'Apertaperformance Tree
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
haskell/containers#1247 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 50/100
haskell/containers#1242 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di haskell/containers
Issue simili
-
infrastructure
Difficoltà 1/5 1-3 ore Idoneità per principianti 65/100
alunduil/siren-json.hs#232 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
jgm/asciidoc-hs#14 ·
-
brick-3.0Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
commercialhaskell/stackage#8129 · 2 commenti ·
-
Add DataHaskell ?Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 76/100
severo/awesome-parquet#50 ·