Nothing Special   »   [go: up one dir, main page]

skip to main content
10.1145/2804302.2804311acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
research-article

The remote monad design pattern

Published: 30 August 2015 Publication History

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.

References

[1]
H. Apfelmus. Hackage package threepenny-gui-0.6.0.2, 2015.
[2]
R. Bird. Using circular programs to eliminate multiple traversals of data. Acta Informatica, 21(3):239–250, 1984.
[3]
A. D. Birrell and B. J. Nelson. Implementing remote procedure calls. Transactions on Computer Systems, 2(1):39–59, 1984.
[4]
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.
[5]
D. Burke. Hackage package mcpi-0.0.1.2, 2014.
[6]
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.
[7]
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.
[8]
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.
[9]
A. Courtney, H. Nilsson, and J. Peterson. The Yampa arcade. In Haskell Workshop, pages 7–18. ACM, 2003.
[10]
A. Ekblad. Hackage package haste-compiler-0.4.4.4, 2015.
[11]
A. Ekblad and K. Claessen. A seamless, client-centric programming model for type safe web applications. In Haskell Symposium, pages 79–89. ACM, 2014.
[12]
C. Elliott, S. Finne, and O. de Moor. Compiling embedded languages. Journal of Functional Programming, 13(3):455–481, 2003.
[13]
J. Epstein, A. P. Black, and S. Peyton Jones. Towards Haskell in the cloud. In Haskell Symposium, pages 118–129, 2011.
[14]
L. Erkok. Hackage package hArduino-0.9, 2014.
[15]
L. Erkok. Hackage package sbv-4.4, 2015.
[16]
L. Erkök and J. Launchbury. Recursive monadic bindings. In International Conference on Functional Programming, pages 174–185. ACM, 2000.
[17]
L. Erkök and J. Launchbury. A recursive do for Haskell. In Haskell Workshop, pages 29–37. ACM, 2002.
[18]
B. Gamari. Hackage package bus-pirate-0.6.2, 2015.
[19]
E. Gamma, R. Helm, R. Johnson, and J. Vlissides. Design Patterns: Elements of Reusable Object-Oriented Software. Addison Wesley, 1994.
[20]
A. Gill and J. Bracker. Hackage package sunroof-server-0.2.1, 2014.
[21]
A. Gill and A. Farmer. Hackage package kansas-comet-0.3.1, 2014.
[22]
A. Gill and R. Paterson. Hackage package transformers-0.4.3.0, 2015.
[23]
T. Hannan. Hackage package mongoDB-2.0.5, 2015.
[24]
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.
[25]
P. Hudak. Modular domain specific languages and tools. In International Conference on Software Reuse, pages 134–142. IEEE Press, 1998.
[26]
D. Leijen and E. Meijer. Domain specific embedded compilers. In Conference on Domain-Specific Languages, pages 109–122. ACM, 1999.
[27]
S. Liang, P. Hudak, and M. Jones. Monad transformers and modular interpreters. In Symposium on Principles of Programming Languages, pages 333–343. ACM, 1995.
[28]
R. Love. Get on the D-BUS. Linux Journal, 2005(130):3, 2005.
[29]
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.
[30]
C. McBride and R. Paterson. Applicative programming with effects. Journal of Functional Programming, 18:1–13, 2008.
[31]
S. Microsystems. RPC: Remote procedure call protocol specification. Technical report, RFC 1050, Apr. 1988.
[32]
S. Microsystems. RPC: Remote procedure call protocol specification: Version 2. Technical report, RFC 1057, June 1988.
[33]
J. Millikin. Hackage package ncurses-0.2.11, 2014.
[34]
E. Moggi. Computational lambda-calculus and monads. In Symposium on Logic in Computer Science, pages 14–23. IEEE Press, 1989.
[35]
OpenCores Organization. Wishbone B4: WISHBONE System-on-Chip (SoC) Interconnection Architecture for Portable IP Cores, 2010. URL http://opencores.org/opencores,wishbone.
[36]
B. O’Sullivan. Hackage package criterion-1.1.0.0, 2015.
[37]
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.
[38]
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.
[39]
N. Sculthorpe. Hackage package yampa-canvas-0.2, 2014.
[40]
N. Sculthorpe, J. Bracker, G. Giorgidze, and A. Gill. The constrainedmonad problem. In International Conference on Functional Programming, pages 287–298. ACM, 2013.
[41]
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.
[42]
P. Wadler. Comprehending monads. In Conference on LISP and Functional Programming, pages 61–78. ACM, 1990.

Cited By

View all

Recommendations

Comments

Please enable JavaScript to view thecomments powered by Disqus.

Information & Contributors

Information

Published In

cover image ACM Conferences
Haskell '15: Proceedings of the 2015 ACM SIGPLAN Symposium on Haskell
August 2015
212 pages
ISBN:9781450338080
DOI:10.1145/2804302
  • cover image ACM SIGPLAN Notices
    ACM SIGPLAN Notices  Volume 50, Issue 12
    Haskell '15
    December 2015
    212 pages
    ISSN:0362-1340
    EISSN:1558-1160
    DOI:10.1145/2887747
    Issue’s Table of Contents
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 30 August 2015

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. Design Pattern
  2. FFI
  3. Monads
  4. Remote Procedure Call

Qualifiers

  • Research-article

Funding Sources

Conference

ICFP'15
Sponsor:

Acceptance Rates

Overall Acceptance Rate 57 of 143 submissions, 40%

Upcoming Conference

ICFP '25
ACM SIGPLAN International Conference on Functional Programming
October 12 - 18, 2025
Singapore , Singapore

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)10
  • Downloads (Last 6 weeks)1
Reflects downloads up to 13 Nov 2024

Other Metrics

Citations

Cited By

View all

View Options

Get Access

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media