Replies: 1 comment 1 reply
-
released as Changed from the original description: a context type is not a CpsMonadContext[F] but a new type CpsDirect[F], which use exactly for this purpose. A few current issues before going to production:
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Let's introduce context encoding for monadic operations, allowing programming in a colorless direct style.
We will represent M[X] as a context function:
The compiler plugin can transform types of functions that use CpsMonadContext[X] arguments (and functions that return such functions and … ), and in such a way, we can move all machinery with the monad brackets from the user code.
What's interesting is that runtime monadic reflection( which is mainstream in EPFL) uses the same encoding, so - a kind of transformation (runtime or compile-time cps transform) becomes an implementation detail that can depend on the monad type on platforms when it's supported.
Some problems:
val
and then pass it into other functions byusing
clause.-- Using new capacity tracking functionality to make this impossible on type level (yet unclear how to do this)
-- Check and block the assignment of monad-context in our compiler plugin.
-- Extend the encoding to any function, not only the context function. (I.e., transform each function which will accept monad context).
Some possibilities:
The branch (unstable yet not working) is a
compiler-plugin
.What are your thoughts in this direction?
Beta Was this translation helpful? Give feedback.
All reactions