-
Couldn't load subscription status.
- Fork 186
Write custom foldl' and foldr' methods #113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
2c4ed33 to
3e85228
Compare
|
One possible way to reduce confusion would be to stop making |
|
Hang on with this for a bit. I just realized some things can safely be made stricter, which could help GHC make better code. For example, we can safely make |
Additionally, use coercions to speed up folds.
If this PR already is an improvement on the status quo, I'd advocate merging it and leaving the other ideas for future work. In general, I think we should try not letting the perfect stand in the way of good. |
|
Fair.
…On Wed, Jul 15, 2020, 9:48 AM Simon Jakobi ***@***.***> wrote:
@treeowl <https://github.com/treeowl>
Hang on with this for a bit. I just realized some things can safely be
made stricter, which could help GHC make better code. For example, we can
safely make foldr' and foldl' for Node strict in the initial value of the
accumulator, and we may be able to play some similar tricks with
FingerTree. I'm going to need to run some benchmarks and pore over some
Core to figure out just how to do this right. Separating the first layer of
the FingerTree from the rest (which will likely help with this) may also
avoid the need for at least some of the coercions.
If this PR already is an improvement on the status quo, I'd advocate
merging it and leaving the other ideas for future work.
In general, I think we should try not letting the perfect stand in the way
of good.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#113 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAOOF7I22SPJG45MR42KPV3R3WXUJANCNFSM4AZQDBCA>
.
|
|
Sure, you can ping me to have a look at this. |
|
Custom foldl' and foldr' were added in #281. |
Additionally, use coercions to speed up folds.