-
Notifications
You must be signed in to change notification settings - Fork 53
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
Rewrite Control.Effect.Interpret in terms of reflection #193
Conversation
Something seems up with the Cabal configuration, but if I build the benchmarks with Afterbenchmarking InterpretC vs InterpretStateC vs StateC/InterpretC/100 time 71.27 ns (71.13 ns .. 71.45 ns) 1.000 R² (1.000 R² .. 1.000 R²) mean 71.53 ns (71.33 ns .. 71.99 ns) std dev 959.5 ps (450.8 ps .. 1.699 ns) variance introduced by outliers: 15% (moderately inflated) Beforebenchmarking InterpretC vs InterpretStateC vs StateC/InterpretC/100 time 6.719 μs (6.569 μs .. 6.860 μs) 0.997 R² (0.995 R² .. 0.999 R²) mean 6.630 μs (6.566 μs .. 6.727 μs) std dev 265.0 ns (192.1 ns .. 401.7 ns) variance introduced by outliers: 50% (severely inflated) The important result is here: With this PR:
Before this PR:
I can't reproduce this using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ocharles: Thank you so much for submitting this PR! This is superb work, and has held up very nicely in my explorations this morning. I’m excited to see what more we can do with it!
Regarding the benchmarks, I’ll take a look at it today/tomorrow and see if I can help figure that out.
I’ve left a bunch of comments, mostly stylistic nitpicks but also a couple of things about what we’re going to need to export.
Note to self: this is going to be a major version bump due to the removal of InterpretStateC
and the changed signatures.
src/Control/Effect/Interpret.hs
Outdated
eff ( L eff ) = | ||
runHandler ( unTag ( reflect @s ) ) eff | ||
eff ( R other ) = | ||
InterpretC ( eff ( handleCoercible other ) ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we’re going to want an INLINE
pragma on this (might be relevant to the benchmarking stuff, I’m not sure).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't seen a need for it yet. Should I add it or leave it until benchmarking shows it necessary? Note the benchmarks in my above comment didn't have it, unless you can't reproduce them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, let’s not then!
Thanks for the extensive feedback! I admit I just dumped it into a file and forgot about it, I wasn't quite intending it to be in a mergeable state, but more as a conversation point. But I guess there's not much more to do! Let me blast through all the stylistic stuff, and we'll see what we're left with. |
I found the Cabal oddity - your |
Ok, I think I've addressed all your review points. Bring on round two! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fantastic work @ocharles!
See #191.