Lazy List's mapWithIndex is not lazy
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Domain
- backend
Research direction
Start in src/Data/List/Lazy/Types.purs at the linked FunctorWithIndex instance around line 116. Compare its folding implementation with the lazy Functor implementation, then check how the proposed recursive mapping handles the list one step at a time. Done means mapWithIndex preserves laziness while supplying each element’s index; the issue provides no test file to run.
Written by the indexing model from the issue text.
Description
The implementation of FunctorWithIndex for Lazy List uses folding, which, unlike Functor, is not lazy.
It should be:
instance functorWithIndexList :: FunctorWithIndex Int List where
mapWithIndex f xs = List (go 0 <$> unwrap xs)
where
go i = \step -> case step of
Nil -> Nil
Cons x xs' -> Cons (f i x) (List (go (i + 1) <$> unwrap xs'))
- Dominant language
- PureScript
- Stars
- 61
- Forks
- 50
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 1
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No 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 purescript/purescript-lists
-
ZipList is BindOpen
Difficulty 4/5 3-5 days Newbie friendliness 35/100
purescript/purescript-lists#219 · 1 comment · 1 reaction ·
-
Data.List.NonEmpty.intersect and Data.List.NonEmpty.intersectBy throw when intersection emptyPossibly taken @evaogbe claimed this 1066 days ago. Opengood first issue type: bug
Difficulty 4/5 3-5 days Newbie friendliness 1/100
purescript/purescript-lists#216 · 2 comments ·
-
type: enhancement
Difficulty 4/5 3-5 days Newbie friendliness 25/100
purescript/purescript-lists#197 · 1 comment ·
-
type: enhancement
Difficulty 5/5 Over a week Newbie friendliness 24/100
purescript/purescript-lists#194 · 5 comments ·
-
type: enhancement
Difficulty 4/5 3-5 days Newbie friendliness 35/100
purescript/purescript-lists#192 · 4 comments · 1 reaction ·
All issues in purescript/purescript-lists
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
Maintainers usually reply within 1 day
-
bug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
milind-soni/OpenMausBot#5829 ·
Maintainers usually reply within 1 day