Abstract
Modern challenges led to a design of a wide range of programming models for reactive, parallel and concurrent programming, but these are often difficult to encode in general purpose languages. We present an abstract type of computations called joinads together with a syntactic language extension that aims to make it easier to use joinads in modern functional languages.
Our extension generalizes pattern matching to work on abstract computations. It keeps a familiar syntax and semantics of pattern matching making it easy to reason about code, even in a non-standard programming model. We demonstrate our extension using three important programming models – a reactive model based on events; a concurrent model based on join calculus and a parallel model using futures. All three models are implemented as libraries that benefit from our syntactic extension. This makes them easier to use and also opens space for exploring new useful programming models.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
Syme, D., Granicz, A., Cisternino, A.: Expert F#, ch. 9. Apress (2007)
Wadler, P.: Monads for functional programming. In: Jeuring, J., Meijer, E. (eds.) AFP 1995. LNCS, vol. 925. Springer, Heidelberg (1995)
Syme, D.: F# Language Specification, http://tinyurl.com/fsspec
Petricek, T.: Reactive Programming with Events (Master thesis), Charles University (2010)
Fournet, C., Gonthier, G.: The reflexive CHAM and the join-calculus. In: POPL 1996 (1996)
Fournet, C., Le Fessant, F., Maranget, L., Schmitt, A.: JoCaml: A language for concurrent distributed and mobile programming. In: Jeuring, J., Jones, S.L.P. (eds.) AFP 2002. LNCS, vol. 2638, pp. 129–158. Springer, Heidelberg (2003)
Benton, N., Cardelli, L., Fournet, C.: Modern concurrency abstractions for C#. ACM Trans. Program. Lang. Syst 26(5), 769–804 (2004)
Russo, C.: The Joins concurrency library. In: Hanus, M. (ed.) PADL 2007. LNCS, vol. 4354, pp. 260–274. Springer, Heidelberg (2006)
Yorgey, B.: The Typeclassopedia. The Monad.Reader Issue 13, http://tinyurl.com/tycls
Haller, P., Van Cutsem, T.: Implementing Joins Using Extensible Pattern Matching. In: Wang, A.H., Tennenholtz, M. (eds.) COORDINATION 2008. LNCS, vol. 5052, pp. 135–152. Springer, Heidelberg (2008)
Tullsen, M.: First class patterns. In: Pontelli, E., Santos Costa, V. (eds.) PADL 2000. LNCS, vol. 1753, p. 1. Springer, Heidelberg (2000)
Fluet, M., Rainey, M., Reppy, J., Shaw, A.: Implicitly-threaded parallelism in Manticore. In: Proceedings of ICFP 2008 (2008)
Syme, D., Neverov, G., Margetson, J.: Extensible Pattern Matching via a Lightweight Language Extension. In: ICFP (2007)
Wadler, P: Views: A way for pattern matching to cohabit with data abstraction. In: POPL 1987 (1987)
Peyton Jones, S.: Wearing the hair shirt - A retrospective on Haskell. Invited talk POPL (2003), Slides available online at http://tinyurl.com/haskellretro
McBride, C., Paterson, R.: Applicative programming with effects. Journal of Func. Programming 18 (2008)
Scholz, E.: Imperative streams - a monadic combinator library for synchronous programming. In: Proc. ICFP (1998)
Peyton Jones, S. (ed.): Haskell 98 Language and Libraries—The Revised Report. Cambridge University Press, Cambridge (2003)
Emir, B., Odersky, M., Williams, J.: Matching Objects with Patterns. In: Bateni, M. (ed.) ECOOP 2007. LNCS, vol. 4609, pp. 273–298. Springer, Heidelberg (2007)
King, D., Wadler, P.: Combining Monads. In: Proceedings of Glasgow Workshop on Functional Programming (1992)
Okasaki, C.: Views for Standard ML. In: Proc. of Workshop on ML, pp. 14–23 (1998)
Hughes, J.: Generalising Monads to Arrows. Sci. of Comput. Prog. 37, 67–111 (2000)
Elliott, C.: Declarative event-oriented programming. In: Proceedings of PPDP 2000 (2000)
Liu, H., Cheng, E., Hudak, P.: Causal commutative arrows and their optimization. In: ICFP 2009 (2009)
Bierman, G.M., Meijer, E., Torgersen, M.: Lost In Translation: Formalizing Proposed Extensions to C#. In: Proc. of OOPSLA 2007 (2007)
Lindley, S., Wadler, P., Yallop, J.: The arrow calculus, Technical Report EDI-INF-RR-1258, School of Informatics, University of Edinburgh (2008)
Petricek, T., Syme, D.: Joinads (Extended version), http://tinyurl.com/joinads
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2011 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Petricek, T., Syme, D. (2011). Joinads: A Retargetable Control-Flow Construct for Reactive, Parallel and Concurrent Programming. In: Rocha, R., Launchbury, J. (eds) Practical Aspects of Declarative Languages. PADL 2011. Lecture Notes in Computer Science, vol 6539. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-18378-2_17
Download citation
DOI: https://doi.org/10.1007/978-3-642-18378-2_17
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-18377-5
Online ISBN: 978-3-642-18378-2
eBook Packages: Computer ScienceComputer Science (R0)