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
Combinator inference #935 #981
Combinator inference #935 #981
Conversation
@djspiewak After this PR is merged, I think we should make another RC. |
@@ -310,8 +310,8 @@ lazy val lawsJS = laws.js | |||
|
|||
lazy val FullTracingTest = config("fulltracing").extend(Test) | |||
|
|||
lazy val tracingTests = project | |||
.in(file("tracing-tests")) | |||
lazy val runtimeTests = project |
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.
runtimeTests
or systemTests
or something else was what I had in mind
import cats.effect.IO | ||
import cats.effect.internals.TracingPlatform.{isCachedStackTracing, isFullStackTracing} | ||
|
||
private[effect] object IOAsync { |
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.
We can probably move this into IO
companion object, but I'm not sure what to name it
…ct into combinator-inference
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.
This is exceptionally cool! Also I think we can probably just do unmangling even in this PR, since it's directly available in scala.reflect.NameTransformer.decode
:-)
This PR brings the next tracing addition to Cats Effect 2, combinator inference. In the current tracing implementation, only a particular set of primitive operations were traced and rendered. However, there is a large collection of derived combinators we should print out instead because we have that information via the stack trace.
Example
A sample program:
The trace we would see before this PR:
The trace we would see after this PR:
We now see a much richer trace that more accurately reflects the operation that was performed. Some observations:
parMapN
, but the corresponding code locations are the exact same. This is another limitation of the cached tracing mode in conjunction with the implementation ofparMapN
. Other derived combinators likeparTraverse
andas
will exhibit this behavior as well. However, in full tracing mode, the appropriate code location will be printed.*>
are rendered a textual form, but we should be able to recover the original name. We should fix this in future PRs.(...)
appear. This usually appears when some operation is traced after shifting thread pools, likebracket
. We might be able to address this by explicitly not tracing those internal functions.Note that the specific set of derived combinators that we can trace are currently restricted to those under the
cats.
package. This may be customizable in the future.Closes #935.