-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
MonadRec instances for Eval and StateT. #1076
Conversation
Current coverage is 88.34%
@@ master #1076 diff @@
==========================================
Files 221 221
Lines 2798 2804 +6
Methods 2743 2749 +6
Messages 0 0
Branches 50 50
==========================================
+ Hits 2472 2477 +5
- Misses 326 327 +1
Partials 0 0
|
👍 thanks! |
@TomasMikula it's outside of the scope of this PR, but do you have an intuition for whether the introduction of |
👍 Looks good, thanks! |
@ceedubs |
@ceedubs Here is an alternative representation of As a bonus, it allows to weaken constraints on Although this allowed to add one more stack-safety test which would fail before, in general, this new representation still guarantees stack-safety of long chains of I haven't done any benchmarks. The benefit of this is purely aesthetic/didactic. |
@TomasMikula that's really interesting. I'd be interested in seeing how benchmarks compare (and I think @travisbrown would too if the benchmark results are good). |
I'm actually curious, too, how this compares performance-wise. Do you know of any pre-existing |
@ceedubs Thanks, I will try to put something together. |
So I created 2 tests ("iterated flatMap" and "recursive flatMap") and ran each with both strict and trampolined monad (
So the new representation performs worse for strict monads and better for trampolined monads. |
I might be able to eliminate one allocation per step of evaluation by using |
It did improve performance. I was actually able to get away with a single
This is the commit TomasMikula@ff7af34 |
No description provided.