Conversation
Streams don't have size estimation so they don't need any complicated machinery for that.
lehins
approved these changes
Oct 3, 2025
Contributor
lehins
left a comment
There was a problem hiding this comment.
Nice simplification and it is good to finally have some tests for it.
|
|
||
| "enumFromTo<Float> [Stream]" | ||
| enumFromTo = enumFromTo_double :: Monad m => Float -> Float -> Stream m Float #-} | ||
| "Stream.enumFromTo[Int]" enumFromTo @Int = enumFromTo_integral |
Contributor
There was a problem hiding this comment.
Do we need to add SPECIALIZE pragma on enumFromTo_integral in order for such specialization to actually work?
Contributor
Author
There was a problem hiding this comment.
In my understanding RHS of rewrite rule will get inlined afterward. But it's always better to measure than to guess. Speaking of which I only test rewrite rules from Bundle and not ones from vector-stream. I need to think how to write them
Contributor
Author
There was a problem hiding this comment.
Ive checked. With these rewrite rules GHC can produce nonallocating loop and fails to do so if they're disabled.
vector-stream rewrite rules are not reused in Bundle.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We provide handwritten specializations for
enumFromTobut don't test that they work same as standardenumFromTo. This PR adds tests and simplifies rewrite rules invector-streaming.Rewrite rules in
Bundlecould be improved but that's quite a bit of work so I submitting first part as a PR