Abstract
Dotty-cps-async is an open-source package that consists of scala macro, which implements generic async/await via monadic cps transform, and library, which provides monadic substitutions for higher-order functions from the standard library. It allows developers to use direct control flow constructions of the base language instead of monadic DSL for various applications. Behind well-known async/await operations, the package provides options for transforming higher-order function applications, generating call-chain proxies, and automatic coloring.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
References
Adam, Ghahramani, Z., Gordon, A.D.: Practical probabilistic programming with monads. SIGPLAN Not. 50(12), 165–176 (2015). https://doi.org/10.1145/2887747.2804317
Brachthäuser, J.I., Schuster, P., Ostermann, K.: Effekt: capability-passing style for type- and effect-safe, extensible effect handlers in scala. J. Funct. Program. 30, e8 (2020). https://doi.org/10.1017/S0956796820000027
Brachthäuser, J., Boruch-Gruszecki, A., Odersky, M.: Representing monads with capabilities. Technical report, Higher-Order Programming with Effects (HOPE) (2021). https://github.com/lampepfl/monadic-reflection
Claessen, K.: A poor man’s concurrency monad. J. Funct. Program. 9(3), 313–323 (1999). https://doi.org/10.1017/S0956796899003342
Erwig, M., Ren, D.: Monadification of functional programs. Sci. Comput. Program. 52(1–3), 101–129 (2004). https://doi.org/10.1016/j.scico.2004.03.004
Filinski, A.: Representing monads. In: Proceedings of the 21st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 1994, Association for Computing Machinery, New York, pp. 446–457 (1994). https://doi.org/10.1145/174675.178047
Haller, P., Lightbend: scala-async (2013). https://github.com/scala-async/scala-async
Haller, P., Miller, H.: A formal model for direct-style asynchronous observables. CoRR abs/1511.00511 (2015). http://arxiv.org/abs/1511.00511
Hatcliff, J., Danvy, O.: A generic account of continuation-passing styles. In: Proceedings of the 21st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 1994, Association for Computing Machinery, New York, pp. 458–471 (1994). https://doi.org/10.1145/174675.178053
Hoare, C.: Communicating Sequential Processes. Prentice-Hall International Series in Computer Science, Prentice Hall (1985). http://www.usingcsp.com/cspbook.pdf
Hudak, P.: Building domain-specific embedded languages. ACM Comput. Surv. 28(4es), 196-es (1996). https://doi.org/10.1145/242224.242477
Kiselyov, O., Shan, C.c., Friedman, D.P., Sabry, A.: Backtracking, interleaving, and terminating monad transformers: (functional pearl). SIGPLAN Not. 40(9), 192–203 (2005). https://doi.org/10.1145/1090189.1086390
Oracle: Project loom (2018–2022). https://openjdk.java.net/projects/loom/
Petricek, T., Syme, D.: The F# computation expression zoo. In: Proceedings of Practical Aspects of Declarative Languages. PADL 2014 (2014)
Prokopec, A., Liu, F.: Theory and practice of coroutines with snapshots. In: Millstein, T. (ed.) 32nd European Conference on Object-Oriented Programming (ECOOP 2018). Leibniz International Proceedings in Informatics (LIPIcs), vol. 109, pp. 3:1–3:32. Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik, Dagstuhl, Germany (2018). https://doi.org/10.4230/LIPIcs.ECOOP.2018.3, http://drops.dagstuhl.de/opus/volltexte/2018/9208
Rompf, T., Amin, N., Moors, A., Haller, P., Odersky, M.: Scala-virtualized: linguistic reuse for deep embeddings. High.-Order Symbolic Comput. 25(1), 165–207 (2013). https://doi.org/10.1007/s10990-013-9096-9
Rompf, T., Maier, I., Odersky, M.: Implementing first-class polymorphic delimited continuations by a type-directed selective CPS-transform. In: Hutton, G., Tolmach, A.P. (eds.) Proceeding of the 14th ACM SIGPLAN International Conference on Functional programming, ICFP 2009, Edinburgh, Scotland, UK, 31 August–2 September, 2009, pp. 317–328. ACM (2009). https://doi.org/10.1145/1596550.1596596
Syme, D.: The early history of F#. Proc. ACM Program. Lang. 4(HOPL) (2020). https://doi.org/10.1145/3386325
Wadler, P., Thiemann, P.: The marriage of effects and monads. ACM Trans. Comput. Logic 4(1), 1–32 (Jan 2003). https://doi.org/10.1145/601775.601776
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2022 Springer Nature Switzerland AG
About this paper
Cite this paper
Shevchenko, R. (2022). Project Paper: Embedding Generic Monadic Transformer into Scala. In: Swierstra, W., Wu, N. (eds) Trends in Functional Programming. TFP 2022. Lecture Notes in Computer Science, vol 13401. Springer, Cham. https://doi.org/10.1007/978-3-031-21314-4_1
Download citation
DOI: https://doi.org/10.1007/978-3-031-21314-4_1
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-031-21313-7
Online ISBN: 978-3-031-21314-4
eBook Packages: Computer ScienceComputer Science (R0)