Skip to main content

Virtualizing Real-World Objects in FRP

  • Conference paper
Practical Aspects of Declarative Languages (PADL 2012)

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

Included in the following conference series:

Abstract

We begin with a functional reactive programming (FRP) model in which every program is viewed as a signal function that converts a stream of input values into a stream of output values. We observe that objects in the real world – such as a keyboard or sound card – can be thought of as signal functions as well. This leads us to a radically different approach to I/O: instead of treating real-world objects as being external to the program, we expand the sphere of influence of program execution to include them within. We call this virtualizing real-world objects. We explore how virtual objects (such as GUI widgets) and even non-local effects (such as debugging and random number generation) can be handled in the same way.

The key to our approach is the notion of a resource type that assures that a virtualized object cannot be duplicated, and is safe. Resource types also provide a deeper level of transparency: by inspecting the type, one can see exactly what resources are being used. We use arrows, type classes, and type families to implement our ideas in Haskell, and the result is a safe, effective, and transparent approach to stream-based I/O.

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

Access this chapter

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

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Courtney, A.: Modelling User Interfaces in a Functional Language. Ph.D. thesis, Department of Computer Science, Yale University (May 2004)

    Google Scholar 

  2. Courtney, A., Elliott, C.: Genuinely functional user interfaces. In: 2001 Haskell Workshop (September 2001)

    Google Scholar 

  3. Courtney, A., Nilsson, H., Peterson, J.: The Yampa arcade. In: Proceedings of the 2003 ACM SIGPLAN Haskell Workshop (Haskell 2003), pp. 7–18. ACM Press, Uppsala (2003)

    Google Scholar 

  4. Elliott, C.: Tangible functional programming. In: International Conference on Functional Programming (2007), http://conal.net/papers/Eros/

  5. Elliott, C., Hudak, P.: Functional reactive animation. In: International Conference on Functional Programming, pp. 263–273 (June 1997)

    Google Scholar 

  6. Elliott, C., Schechter, G., Yeung, R., Abi-Ezzi, S.: Tbag: A high level framework for interactive, animated 3d graphics applications. In: Proceedings of SIGGRAPH 1994, pp. 421–434. ACM SIGGRAPH (July 1994)

    Google Scholar 

  7. Girard, J.Y.: Linear logic. Theoretical Computer Science 50, 1–102 (1987)

    Article  MathSciNet  MATH  Google Scholar 

  8. Hawblitzel, C.: Linear types for aliased resources (extended version). Tech. Rep. MSR-TR-2005-141, Microsoft Research, Redmond, WA (October 2005)

    Google Scholar 

  9. Hudak, P.: The Haskell School of Expression – Learning Functional Programming through Multimedia. Cambridge University Press, New York (2000)

    Google Scholar 

  10. Hudak, P.: Describing and interpreting music in Haskell. In: The Fun of Programming, ch. 4. Palgrave (2003)

    Google Scholar 

  11. Hudak, P.: The Haskell School of Music – from Signals to Symphonies (Version 2.0) (January 2011), http://haskell.cs.yale.edu/?post_type=publication&p=112

  12. Hudak, P., Courtney, A., Nilsson, H., Peterson, J.: Arrows, Robots, and Functional Reactive Programming. In: Jeuring, J., Jones, S.L.P. (eds.) AFP 2002. LNCS, vol. 2638, pp. 159–187. Springer, Heidelberg (2003)

    Chapter  Google Scholar 

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

    Article  MathSciNet  MATH  Google Scholar 

  14. Kiselyov, O., Lämmel, R., Schupke, K.: Strongly typed heterogeneous collections. In: Haskell 2004: Proceedings of the ACM SIGPLAN Workshop on Haskell, pp. 96–107. ACM Press (2004)

    Google Scholar 

  15. Nilsson, H., Courtney, A., Peterson, J.: Functional Reactive Programming, continued. In: ACM SIGPLAN 2002 Haskell Workshop (October 2002)

    Google Scholar 

  16. Norell, U.: Dependently Typed Programming in Agda. In: Koopman, P., Plasmeijer, R., Swierstra, D. (eds.) AFP 2008. LNCS, vol. 5832, pp. 230–266. Springer, Heidelberg (2009)

    Chapter  Google Scholar 

  17. OHearn, P., Reynolds, J., Yang, H.: Local reasoning about programs that alter data structures. Computer Science Logic, p. 1

    Google Scholar 

  18. Paterson, R.: A new notation for arrows. In: ICFP 2001: International Conference on Functional Programming, Firenze, Italy, pp. 229–240 (2001)

    Google Scholar 

  19. Peyton Jones, S., Wadler, P.: Imperative functional programming. In: Proceedings 20th Symposium on Principles of Programming Languages, pp. 71–84. ACM (January 1993)

    Google Scholar 

  20. Peyton Jones, S., et al.: The Haskell 98 language and libraries: The revised report. Journal of Functional Programming 13(1), 0–255 (January 2003)

    Google Scholar 

  21. Plasmeijer, R., van Eekelen, M.: Clean – version 2.1 language report. Tech. rep., Department of Software Technology, University of Nijmegen (November 2002)

    Google Scholar 

  22. Reynolds, J.: Separation logic: A logic for shared mutable data structures. In: Proc. Logic in Computer Science (LICS 2002), pp. 55–74 (July 2002)

    Google Scholar 

  23. Voellmy, A., Hudak, P.: Nettle: Taking the Sting Out of Programming Network Routers. In: Rocha, R., Launchbury, J. (eds.) PADL 2011. LNCS, vol. 6539, pp. 235–249. Springer, Heidelberg (2011)

    Chapter  Google Scholar 

  24. Wadler, P.: Is there a use for linear logic? In: Symposium on Partial Evaluation and Semantics Based Program Manipulation, pp. 255–273. ACM/IFIP (1991)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2012 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Winograd-Cort, D., Liu, H., Hudak, P. (2012). Virtualizing Real-World Objects in FRP. In: Russo, C., Zhou, NF. (eds) Practical Aspects of Declarative Languages. PADL 2012. Lecture Notes in Computer Science, vol 7149. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-27694-1_17

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-27694-1_17

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-27693-4

  • Online ISBN: 978-3-642-27694-1

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics