Nested newtype wrapper vs Stream/StreamK Applicative and Monad instances
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
Research direction
Read the Stream and StreamK newtype wrappers and their Applicative, Monad, Semigroup, and MonadPlus instances in streamly-core. Compare the performance implications of bind association and append, and assess whether adding these instances or using explicit concatFor operations best addresses the concerns in the issue; the issue does not name files or tests, so first locate the relevant definitions.
Written by the indexing model from the issue text.
Description
Do we want MonadState, MonadReader etc instances in future for this type? If so we will need to depend on mtl - streamly-core currently does not depend on mtl. Or we will have to move these types to streamly instead of streamly-core.
Another option is - instead of using newtype wrappers we can merge these instances with the Stream and StreamK types. We can use the concatFor (bind) operations directly instead of Monad instance, but a Monad instance could be useful where it is used implicitly - e.g. MonadComprehensions. We did not add a Monad instance earlier to avoid the misuse of the monad instance. What are the potential misuses?
- We must not have Semigroup and MonadPlus instances for Stream type so it cannot be appended, append has quadratic complexity for Stream, though we can have it for StreamK which has a linear append.
- Left associating the binds in a chain could hurt performance - they should be explicitly right associated
- Applicative should be preferred as it would be much faster - maybe we can just provide an Applicative and leave the monad type composition to explicit concatFor (bind) operations.
- Dominant language
- Haskell
- Stars
- 926
- Forks
- 71
- Avg merge
- 6h 49m
- Merged PRs (30d)
- 3
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 composewell/streamly
-
takeInterval yields nothing, dropInterval drops nothingPossibly taken @GuillaumedeVolpiano claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
composewell/streamly#3271 ·
-
Parser: many accepts input that ends inside an elementPossibly taken @GuillaumedeVolpiano claimed this 1 day ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 52/100
composewell/streamly#3270 ·
-
aspect:api
Difficulty 4/5 1-2 days Newbie friendliness 48/100
composewell/streamly#3206 ·
-
api:breaking aspect:api aspect:filesystem
Difficulty 4/5 1-2 days Newbie friendliness 35/100
composewell/streamly#3203 ·
-
type:performance
Difficulty 4/5 3-5 days Newbie friendliness 32/100
composewell/streamly#3200 · 2 comments ·
All issues in composewell/streamly
Similar issues
-
bug desktop
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
simplex-chat/simplex-chat#8291 ·
Maintainers usually reply within 1 day
-
[BUG]: C# programs with top-level statements fail to compilePossibly taken @AsyncNigam claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
compiler-explorer/compiler-explorer#9625 · 1 comment ·
Maintainers usually reply within 1 day
-
needs triage type: enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 3 days
-
reflex-0.10Open
Difficulty 1/5 Under an hour Newbie friendliness 62/100
commercialhaskell/stackage#8180 ·
Maintainers usually reply within 1 day
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
OpenZeppelin/canton-contracts#140 ·
Maintainers usually reply within 1 day