Add traverseMonotonic, etc.
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
Research direction
Start by locating the existing mapMonotonic implementations and related APIs in Data.Set and Data.Map. Add the proposed Set and Map traversal functions as analogous operations, then check the surrounding tests and documentation for expected exports and invariant-preserving behavior.
Written by the indexing model from the issue text.
Description
import Data.Set.Internal
traverseMonotonic :: Applicative t => (a -> t b) -> Set a -> t (Set b)
traverseMonotonic _ Tip = pure Tip
traverseMonotonic f (Bin sz x l r) = flip (Bin sz) <$> traverseMonotonic f l <*> f x <*> traverseMonotonic f r
import Data.Map.Internal
traverseKeysMonotonic :: Applicative t => (k1 -> t k2) -> Map k1 a -> t (Map k2 a)
traverseKeysMonotonic _ Tip = pure Tip
traverseKeysMonotonic f (Bin sz k x l r) = (\l' k' -> Bin sz k' x l') <$> traverseKeysMonotonic f l <*> f k <*> traverseKeysMonotonic f r
bitraverseMonotonic :: Applicative t => (k1 -> t k2) -> (v1 -> t v2) -> Map k1 v1 -> t (Map k2 v2)
bitraverseMonotonic _ _ Tip = pure Tip
bitraverseMonotonic f g (Bin sz k x l r) = (\l' k' x' -> Bin sz k' x' l') <$> bitraverseMonotonic f g l <*> f k <*> g x <*> bitraverseMonotonic f g r
I think we should add these to Data.Set and Data.Map, respectively, as analogues of mapMonotonic, etc. Note that these are unsafe just like they are, and require the exact same care to avoid breaking invariants.
- Dominant language
- Haskell
- Stars
- 356
- Forks
- 195
- Avg merge
- 3d 42m
- Merged PRs (30d)
- 5
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from haskell/containers
-
major-release strictness Tree
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
haskell/containers#1260 ·
-
Map performance Set
Difficulty 5/5 Over a week Newbie friendliness 35/100
haskell/containers#1263 · 4 comments ·
-
low-hanging-fruit performance Seq
Difficulty 4/5 3-5 days Newbie friendliness 43/100
haskell/containers#1262 · 2 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
haskell/containers#1261 · 11 comments ·
-
IntSet low-hanging-fruit performance
Difficulty 3/5 1-2 days Newbie friendliness 58/100
haskell/containers#1251 ·
All issues in haskell/containers
Similar issues
-
bug core-libs
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
content good first issue
Difficulty 2/5 Under an hour Newbie friendliness 88/100
StudentSuite/awesome-skills-plugins-for-students#312 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
fmidue/prolog-programming-task#62 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
objectionary/phino#1951 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day