A. Gill, N. Sculthorpe, J. Dawson, A. Eskilson, A. Farmer, M. Grebe, J. Rosenbluth, R. Scott, and J. Stanton, “The remote monad design pattern,” in Proceedings of the 8th ACM SIGPLAN Symposium on Haskell, (New York, NY, USA), pp. 59–70, ACM, 2015.



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.


  author = {Andy Gill and Neil Sculthorpe and Justin Dawson and
                  Aleksander Eskilson and Andrew Farmer and Mark Grebe
                  and Jeffrey Rosenbluth and Ryan Scott and James
  title = {The Remote Monad Design Pattern},
  booktitle = {Proceedings of the 8th ACM SIGPLAN Symposium on Haskell},
  location = {Vancouver, BC, Canada},
  publisher = {ACM},
  year = {2015},
  pages = {59--70},
  numpages = {12},
  doi = {10.1145/2804302.2804311},
  publisher = {ACM},
  address = {New York, NY, USA},
  keywords = {Design Pattern, FFI, Monads, Remote Procedure Call},


This is the author’s version of the work. It is posted here for your personal use. Not for redistribution. The definitive version was published in Haskell 2015, and is available in the ACM Digital Library.