Skip to main content

An Ode to Arrows

  • Conference paper

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 5937))

Abstract

We study a number of embedded DSLs for autonomous ordinary differential equations (autonomous ODEs) in Haskell. A naive implementation based on the lazy tower of derivatives is straightforward but has serious time and space leaks due to the loss of sharing when handling cyclic and infinite data structures. In seeking a solution to fix this problem, we explore a number of DSLs ranging from shallow to deep embeddings, and middle-grounds in between. We advocate a solution based on arrows, an abstract notion of computation that offers both a succinct representation and an effective implementation. Arrows are ubiquitous in their combinator style that happens to capture both sharing and recursion elegantly. We further relate our arrow-based DSL to a more constrained form of arrows called causal commutative arrows, the normalization of which leads to a staged compilation technique improving ODE performance by orders of magnitude.

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Bird, R.S., Paterson, R.: de Bruijn notation as a nested datatype. J. Funct. Program. 9(1), 77–91 (1999)

    Article  MATH  MathSciNet  Google Scholar 

  2. Bjesse, P., Claessen, K., Sheeran, M., Singh, S.: Lava: Hardware design in haskell. In: ICFP 1998: International Conference on Functional Programming, pp. 174–184. ACM, New York (1998)

    Chapter  Google Scholar 

  3. Claessen, K., Sands, D.: Observable sharing for functional circuit description. In: Thiagarajan, P.S., Yap, R.H.C. (eds.) ASIAN 1999. LNCS, vol. 1742, pp. 62–73. Springer, Heidelberg (1999)

    Chapter  Google Scholar 

  4. Courtney, A., Elliott, C.: Genuinely functional user interfaces. In: Proc. of the 2001 ACM SIGPLAN Haskell Workshop. ACM, New York (2001)

    Google Scholar 

  5. Elliott, C.M.: Beautiful differentiation. In: ICFP 2009: International Conference on Functional Programming, pp. 191–202. ACM, New York (2009)

    Chapter  Google Scholar 

  6. Fegaras, L., Sheard, T.: Revisiting catamorphisms over datatypes with embedded functions (or, programs from outer space). In: POPL 1996: the 23th symposium on Principles of Programming Languages, pp. 284–294. ACM, New York (1996)

    Chapter  Google Scholar 

  7. Ghani, N., Hamana, M., Uustalu, T., Vene, V.: Representing cyclic structures as nested datatypes. In: Proc. of 7th Symposium on Trends in Functional Programming (TFP 2006), pp. 173–188 (2006)

    Google Scholar 

  8. Gill, A.: Type-safe observable sharing in Haskell. In: Proc. of the 2009 ACM SIGPLAN Haskell Symposium. ACM, New York (2009)

    Google Scholar 

  9. Hughes, J.: Generalising monads to arrows. Science of Computer Programming 37, 67–111 (2000)

    Article  MATH  MathSciNet  Google Scholar 

  10. Karczmarczuk, J.: Functional differentiation of computer programs. In: ICFP 1998: International Conference on Functional Programming, pp. 195–203 (1998)

    Google Scholar 

  11. Liu, H., Hudak, P.: Plugging a space leak with an arrow. Electronic Notes in Theoretical Computer Science 193, 29–45 (2007)

    Article  Google Scholar 

  12. Liu, H., Cheng, E., Hudak, P.: Causal commutative arrows and their optimization. In: ICFP 2009: International Conference on Functional Programming, pp. 35–46. ACM, New York (2009)

    Chapter  Google Scholar 

  13. Michie, D.: Memo functions and machine learning. Nature 218(5136), 19–22 (1968)

    Article  Google Scholar 

  14. Nilsson, H., Courtney, A., Peterson, J.: Functional Reactive Programming, continued. In: Proc. of ACM SIGPLAN 2002 Haskell Workshop. ACM, New York (2002)

    Google Scholar 

  15. O’Donnell, J.T.: Generating netlists from executable circuit specifications in a pure functional language. In: Functional Programming Workshops in Computing, pp. 178–194. Springer, Heidelberg (1992)

    Google Scholar 

  16. Paterson, R.: A new notation for arrows. In: ICFP 2001: International Conference on Functional Programming, pp. 229–240. ACM, New York (2001)

    Chapter  Google Scholar 

  17. Turner, D.A.: A new implementation technique for applicative languages. Software-Practice and Experience 9, 31–49 (1979)

    Article  MATH  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2010 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Liu, H., Hudak, P. (2010). An Ode to Arrows. In: Carro, M., Peña, R. (eds) Practical Aspects of Declarative Languages. PADL 2010. Lecture Notes in Computer Science, vol 5937. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-11503-5_14

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-11503-5_14

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-11502-8

  • Online ISBN: 978-3-642-11503-5

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics