Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Suspension: the magic behind composability (or:...

Avatar for Flavio Brasil Flavio Brasil
June 14, 2025
1.2k

Suspension: the magic behind composability (or: "The Kyo Monad")

Avatar for Flavio Brasil

Flavio Brasil

June 14, 2025
Tweet

Transcript

  1. Who am I? Principal Engineer @ Nubank Open Source Developer

    @ getkyo.io Just moved back to Brazil!
  2. Who am I? Principal Engineer @ Nubank Open Source Developer

    @ getkyo.io Just moved back to Brazil! An engineer, not a mathematician
  3. • A monadic effect system based on algebraic effects •

    Leverages Scala 3's advanced type system to provide seamless effect tracking What is Kyo?
  4. • A monadic effect system based on algebraic effects •

    Leverages Scala 3's advanced type system to provide seamless effect tracking • Properly suspends side effects and supports multi-shot continuations What is Kyo?
  5. What is Kyo? • A monadic effect system based on

    algebraic effects • Leverages Scala 3's advanced type system to provide seamless effect tracking • Properly suspends side effects and supports multi-shot continuations • Provides a separate direct syntax dialect module and an advanced combinators module
  6. What is Kyo? • A monadic effect system based on

    algebraic effects • Leverages Scala 3's advanced type system to provide seamless effect tracking • Properly suspends side effects and supports multi-shot continuations • Provides a separate direct syntax dialect module and an advanced combinators module • A real-world engineering project. Not experimental!
  7. • 3 years in development (first year in private) •

    Evolving quickly with 22 releases so far Project Status
  8. • 3 years in development (first year in private) •

    Evolving quickly with 22 releases so far • An active core developers team Project Status
  9. Project Status • 3 years in development (first year in

    private) • Evolving quickly with 22 releases so far • An active core developers team • Comprehensive set of primitives
  10. Project Status • 3 years in development (first year in

    private) • Evolving quickly with 22 releases so far • An active core developers team • Comprehensive set of primitives • Close to the 1.0-RC1 release
  11. • Continuations are first-class values • Can resume with arbitrary

    values. For example, injecting or transforming values The power of suspension
  12. • Continuations are first-class values • Can resume with arbitrary

    values. For example, injecting or transforming values • Can resume zero, one, or n times The power of suspension
  13. • Continuations are first-class values • Can resume with arbitrary

    values. For example, injecting or transforming values • Can resume zero, one, or n times • Unlocks next-level expressivity without language changes The power of suspension
  14. • Stack safety is handled by safepoints before each transformation

    • Unboxed representation of plain pure values Bridging the real-world gap
  15. • Stack safety is handled by safepoints before each transformation

    • Unboxed representation of plain pure values • Inlining as computation staging Bridging the real-world gap
  16. • Stack safety is handled by safepoints before each transformation

    • Unboxed representation of plain pure values • Inlining as computation staging • Two kinds of effect: ContextEffect and ArrowEffect for performance + forking Bridging the real-world gap
  17. • Stack safety is handled by safepoints before each transformation

    • Unboxed representation of plain pure values • Inlining as computation staging • Two kinds of effect: ContextEffect and ArrowEffect for performance + forking • Isolates to enable forking with effects Bridging the real-world gap
  18. • Thank you to all contributors, in special Adam Hearn

    and John Hungerford for the long-time steady contributions! Conclusion
  19. • Thank you to all contributors, in special Adam Hearn

    and John Hungerford for the long-time steady contributions! • Feedback is appreciated, even if negative :) Conclusion
  20. • Thank you to all contributors, in special Adam Hearn

    and John Hungerford for the long-time steady contributions! • Feedback is appreciated, even if negative :) • We'd love to collaborate on a formal proof Conclusion
  21. • Thank you to all contributors, in special Adam Hearn

    and John Hungerford for the long-time steady contributions! • Feedback is appreciated, even if negative :) • We'd love to collaborate on a formal proof • Keep an eye out for the 1.0-RC1! Conclusion