Abstract
Remote Procedure Calls are expensive. This paper demonstrates how to reduce the cost of calling remote procedures from Haskell by using the remote monad design pattern, which amortizes the cost of remote calls. This gives the Haskell community access to remote capabilities that are not directly supported, at a surprisingly inexpensive cost. We explore the remote monad design pattern through six models of remote execution patterns, using a simulated Internet of Things toaster as a running example. We consider the expressiveness and optimizations enabled by each remote execution model, and assess the feasibility of our approach. We then present a full-scale case study: a Haskell library that provides a Foreign Function Interface to the JavaScript Canvas API. Finally, we discuss existing instances of the remote monad design pattern found in Haskell libraries.
- H. Apfelmus. Hackage package threepenny-gui-0.6.0.2, 2015.Google Scholar
- R. Bird. Using circular programs to eliminate multiple traversals of data. Acta Informatica, 21(3):239–250, 1984. Google Scholar
Digital Library
- A. D. Birrell and B. J. Nelson. Implementing remote procedure calls. Transactions on Computer Systems, 2(1):39–59, 1984. Google Scholar
Digital Library
- J. Bracker and A. Gill. Sunroof: A monadic DSL for generating JavaScript. In International Symposium on Practical Aspects of Declarative Languages, volume 8324 of LNCS, pages 65–80. Springer, 2014. Google Scholar
Digital Library
- D. Burke. Hackage package mcpi-0.0.1.2, 2014.Google Scholar
- J. Carette, O. Kiselyov, and C. Shan. Finally tagless, partially evaluated: Tagless staged interpreters for simpler typed languages. Journal of Functional Programming, 19(05):509–543, 2009. Google Scholar
Digital Library
- M. M. T. Chakravarty, R. Clifton-Everest, G. Keller, S. Lee, B. Lever, T. L. McDonell, R. Newtown, and S. Seefried. Hackage package accelerate-0.15.1.0, 2015.Google Scholar
- K. Claessen, M. Sheeran, and B. J. Svensson. Expressive array constructs in an embedded GPU kernel programming language. In Workshop on Declarative Aspects and Applications of Multicore Programming, pages 21–30. ACM, 2012. Google Scholar
Digital Library
- A. Courtney, H. Nilsson, and J. Peterson. The Yampa arcade. In Haskell Workshop, pages 7–18. ACM, 2003. Google Scholar
Digital Library
- A. Ekblad. Hackage package haste-compiler-0.4.4.4, 2015.Google Scholar
- A. Ekblad and K. Claessen. A seamless, client-centric programming model for type safe web applications. In Haskell Symposium, pages 79–89. ACM, 2014. Google Scholar
Digital Library
- C. Elliott, S. Finne, and O. de Moor. Compiling embedded languages. Journal of Functional Programming, 13(3):455–481, 2003. Google Scholar
Digital Library
- J. Epstein, A. P. Black, and S. Peyton Jones. Towards Haskell in the cloud. In Haskell Symposium, pages 118–129, 2011. Google Scholar
Digital Library
- L. Erkok. Hackage package hArduino-0.9, 2014.Google Scholar
- L. Erkok. Hackage package sbv-4.4, 2015.Google Scholar
- L. Erkök and J. Launchbury. Recursive monadic bindings. In International Conference on Functional Programming, pages 174–185. ACM, 2000. Google Scholar
Digital Library
- L. Erkök and J. Launchbury. A recursive do for Haskell. In Haskell Workshop, pages 29–37. ACM, 2002. Google Scholar
Digital Library
- B. Gamari. Hackage package bus-pirate-0.6.2, 2015.Google Scholar
- E. Gamma, R. Helm, R. Johnson, and J. Vlissides. Design Patterns: Elements of Reusable Object-Oriented Software. Addison Wesley, 1994. Google Scholar
Digital Library
- A. Gill and J. Bracker. Hackage package sunroof-server-0.2.1, 2014.Google Scholar
- A. Gill and A. Farmer. Hackage package kansas-comet-0.3.1, 2014.Google Scholar
- A. Gill and R. Paterson. Hackage package transformers-0.4.3.0, 2015.Google Scholar
- T. Hannan. Hackage package mongoDB-2.0.5, 2015.Google Scholar
- P. C. Hickey, L. Pike, T. Elliott, J. Bielman, and J. Launchbury. Building embedded systems with embedded DSLs. In International Conference on Functional Programming, pages 3–9. ACM, 2014. Google Scholar
Digital Library
- P. Hudak. Modular domain specific languages and tools. In International Conference on Software Reuse, pages 134–142. IEEE Press, 1998. Google Scholar
Digital Library
- D. Leijen and E. Meijer. Domain specific embedded compilers. In Conference on Domain-Specific Languages, pages 109–122. ACM, 1999. Google Scholar
Digital Library
- S. Liang, P. Hudak, and M. Jones. Monad transformers and modular interpreters. In Symposium on Principles of Programming Languages, pages 333–343. ACM, 1995. Google Scholar
Digital Library
- R. Love. Get on the D-BUS. Linux Journal, 2005(130):3, 2005. Google Scholar
Digital Library
- S. Marlow, L. Brandy, J. Coens, and J. Purdy. There is no fork: An abstraction for efficient, concurrent, and concise data access. In International Conference on Functional Programming, pages 325– 337. ACM, 2014. Google Scholar
Digital Library
- C. McBride and R. Paterson. Applicative programming with effects. Journal of Functional Programming, 18:1–13, 2008. Google Scholar
Digital Library
- S. Microsystems. RPC: Remote procedure call protocol specification. Technical report, RFC 1050, Apr. 1988.Google Scholar
- S. Microsystems. RPC: Remote procedure call protocol specification: Version 2. Technical report, RFC 1057, June 1988.Google Scholar
- J. Millikin. Hackage package ncurses-0.2.11, 2014.Google Scholar
- E. Moggi. Computational lambda-calculus and monads. In Symposium on Logic in Computer Science, pages 14–23. IEEE Press, 1989. Google Scholar
Digital Library
- OpenCores Organization. Wishbone B4: WISHBONE System-on-Chip (SoC) Interconnection Architecture for Portable IP Cores, 2010. URL http://opencores.org/opencores,wishbone.Google Scholar
- B. O’Sullivan. Hackage package criterion-1.1.0.0, 2015.Google Scholar
- A. Persson, E. Axelsson, and J. Svenningsson. Generic monadic constructs for embedded languages. In Symposium on Implementation and Application of Functional Languages, volume 7257 of LNCS, pages 85–99. Springer, 2012. Google Scholar
Digital Library
- L. Pike, N. Wegmann, S. Niller, and A. Goodloe. A do-it-yourself high-assurance compiler. In International Conference on Functional Programming, pages 335–340. ACM, 2012. Google Scholar
Digital Library
- N. Sculthorpe. Hackage package yampa-canvas-0.2, 2014.Google Scholar
- N. Sculthorpe, J. Bracker, G. Giorgidze, and A. Gill. The constrainedmonad problem. In International Conference on Functional Programming, pages 287–298. ACM, 2013. Google Scholar
Digital Library
- J. Svenningsson and B. J. Svensson. Simple and compositional reification of monadic embedded languages. In International Conference on Functional Programming, pages 299–304. ACM, 2013. Google Scholar
Digital Library
- P. Wadler. Comprehending monads. In Conference on LISP and Functional Programming, pages 61–78. ACM, 1990. Google Scholar
Digital Library
Index Terms
The remote monad design pattern
Recommendations
The remote monad design pattern
Haskell '15: Proceedings of the 2015 ACM SIGPLAN Symposium on HaskellRemote Procedure Calls are expensive. This paper demonstrates how to reduce the cost of calling remote procedures from Haskell by using the remote monad design pattern, which amortizes the cost of remote calls. This gives the Haskell community access ...
Composable network stacks and remote monads
Haskell 2017: Proceedings of the 10th ACM SIGPLAN International Symposium on HaskellMonads and applicative functors are two ways that Haskell programmers bundle effectful primitives into effectful program fragments. In this paper, we investigate using monads and applicative functors to bundle remote effectful primitives, specifically ...
Modular Compilers Based on Monad Transformers
ICCL '98: Proceedings of the 1998 International Conference on Computer LanguagesThe monadic style of language specification has the advantages of modularity and extensibility: it is simple to add or change features in an interpreter to reflect modifications in the source language. It has proven difficult to extend the method to ...






Comments