Virtualizing Real-World Objects in FRP

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.

[1]  Henrik Nilsson,et al.  Functional reactive programming, continued , 2002, Haskell '02.

[2]  Paul Hudak The Haskell School of Expression: Learning Functional Programming through Multimedia , 1999 .

[3]  M. Nivat Fiftieth volume of theoretical computer science , 1988 .

[4]  John C. Reynolds,et al.  Separation logic: a logic for shared mutable data structures , 2002, Proceedings 17th Annual IEEE Symposium on Logic in Computer Science.

[5]  Roger B. Dannenberg The Canon Score Language , 1989 .

[6]  Ulf Norell,et al.  Dependently typed programming in Agda , 2009, TLDI '09.

[7]  Paul Hudak Haskore Music Tutorial , 1996, Advanced Functional Programming.

[8]  Philip Wadler XQuery: A Typed Functional Language for Querying XML , 2002, Advanced Functional Programming.

[9]  Ricky Yeung,et al.  TBAG: a high level framework for interactive, animated 3D graphics applications , 1994, SIGGRAPH.

[10]  John Hughes,et al.  Generalising monads to arrows , 2000, Sci. Comput. Program..

[11]  Peyton Jones,et al.  Haskell 98 language and libraries : the revised report , 2003 .

[12]  James McCartney,et al.  SuperCollider, a New Real Time Synthesis Language , 1996, ICMC.

[13]  WadlerPhilip Is there a use for linear logic , 1991 .

[14]  Simon L. Peyton Jones,et al.  Imperative functional programming , 1993, POPL '93.

[15]  C. Hawblitzel Linear Types for Aliased Resources (Extended Version) , 2005 .

[16]  M. F.,et al.  Bibliography , 1985, Experimental Gerontology.

[17]  Erik Barendsen,et al.  Uniqueness Typing for Functional Languages with Graph Rewriting Semantics , 1996, Math. Struct. Comput. Sci..

[18]  Marko C. J. D. van Eekelen,et al.  CLEAN: A language for functional graph writing , 1987, FPCA.

[19]  Paul Hudak,et al.  Functional reactive animation , 1997, ICFP '97.

[20]  Peter W. O'Hearn,et al.  Local Reasoning about Programs that Alter Data Structures , 2001, CSL.

[21]  Riccardo Pucella,et al.  Practical affine types , 2011, POPL '11.

[22]  Ross Paterson,et al.  A new notation for arrows , 2001, ICFP '01.

[23]  Conal Elliott Tangible functional programming , 2007, ICFP '07.

[24]  Ralf Lämmel,et al.  Strongly typed heterogeneous collections , 2004, Haskell '04.

[25]  Xavier Leroy,et al.  Computer Security from a Programming Language and Static Analysis Perspective , 2003, ESOP.

[26]  Paul Hudak,et al.  Modeling user interfaces in a functional language , 2004 .

[27]  Paul Hudak,et al.  Audio Processing and Sound Synthesis in Haskell , 2009 .

[28]  Perry R. Cook,et al.  Combining Analysis and synthesis in the Chuck Programming Language , 2007, ICMC.

[29]  Henrik Nilsson,et al.  Switched-On Yampa , 2008, PADL.

[30]  Paul Hudak,et al.  Causal commutative arrows and their optimization , 2009, ICFP.

[31]  Patrick Lincoln,et al.  Linear logic , 1992, SIGA.

[32]  Philip Wadler,et al.  Is there a use for linear logic? , 1991, PEPM '91.

[33]  Henrik Nilsson,et al.  The Yampa arcade , 2003, Haskell '03.

[34]  Paul Hudak,et al.  Describing and interpreting music in Haskell , 2003 .

[35]  Philip Wadler,et al.  Linear Types can Change the World! , 1990, Programming Concepts and Methods.

[36]  Roger B. Dannenberg,et al.  The Implementation of Nyquist, A Sound Synthesis Language , 1997, ICMC.

[37]  Paul Hudak,et al.  Nettle: Taking the Sting Out of Programming Network Routers , 2011, PADL.

[38]  Antony Courtney,et al.  Genuinely Functional User Interfaces , 2001 .

[39]  Paul Hudak,et al.  Arrows, Robots, and Functional Reactive Programming , 2002, Advanced Functional Programming.

[40]  Conal Elliott,et al.  Functional Implementations of Continuos Modeled Animation , 1998, PLILP/ALP.