Dotty-cps-async 0.9.19 ( GitHub - rssh/dotty-cps-async: experimental CPS transformer for dotty ) is on Maven Central.
New in this release:
- Optional loom support for JDK-21. With the help of Loom, we can transform arguments of high-order functions without requiring a shifted variant of this function to be available.
def topScored[A](c:Iterable[A], n: Int)(score: A=>Double) = c.map(a=>(a,score(a)).sortBy(- _._2).take(n) ... val top100 = topScore(c,100)(a => await(fetchScore(a.id))
Note that this also works for effect monads.
- Direct context encoding: it’s still under experimental annotation but much closer to full functionality. Now we can call a direct-encoded function over G in the context of F if the inclusion of G in F. This can be a foundation for the natural encoding of monadic effect stacks: