Giter VIP home page Giter VIP logo

Comments (3)

kalistace avatar kalistace commented on June 10, 2024 1

Thanks for the answer ! Very happy to hear it is on the roadmap :) Looking forward to seeing it being rolled out. Great work.

from arrow-core.

raulraja avatar raulraja commented on June 10, 2024

@kalistace we agree and this is coming up for all data types that provide Monad around October https://github.com/47deg/arrow-meta-prototype/blob/rr-typeclasses-plugin/compiler-plugin/src/main/kotlin/arrow/meta/comprehensions/ComprehensionsPlugin.kt we are already working in a prototype that rewrites binds as flatMap because that is leaner than suspension. It will still use suspension for the code as it is today but will rewrite it to a nested flatMap

from arrow-core.

nomisRev avatar nomisRev commented on June 10, 2024

Hey @kalistace,

The overhead is neglectable of using suspend with the new planned encoding. It's a similar penalty as using a simple handwritten DSL, the compiler is leveraged to wire nested fold code together, and uses a cheap ControlThrowable to break out of the suspension.

(See Roman's example on using suspend for stack safe functions or the sequence builder for similar low-cost implementations for suspend.)

This also works in a suspended way by leveraging a small state-machine to keep track of the internal state, which can be done by simple Int flags. #112

You're correct that the current encoding in 0.10.x and before it is more expensive, but this will be changed with the new encoding. And can later be solved in a generic way with the compiler plugin.

I hope that answers your questions, and what the current state is :)
I'm going to close this issue since it can be tracked in #115 & #116.

Thanks for the feedback! And if you have any questions feel free to ask questions here or on the Kotlin Slack in the #arrow channel ;)

from arrow-core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.