Affiliation:
1. Yale University, New Haven, CT, USA
Abstract
Functional reactive programming (FRP) is a useful model for programming real-time and reactive systems in which one defines a
signal function
to process a stream of input values into a stream of output values. However, performing side effects (e.g. memory mutation or input/output) in this model is tricky and typically unsafe. In previous work, Winograd-Cort et al. [2012] introduced
resource types
and
wormholes
to address this problem.
This paper better motivates, expands upon, and formalizes the notion of a wormhole to fully unlock its potential. We show, for example, that wormholes can be used to define the concept of causality. This in turn allows us to provide behaviors such as looping, a core component of most languages, without building it directly into the language. We also improve upon our previous design by making wormholes less verbose and easier to use.
To formalize the notion of a wormhole, we define an extension to the simply typed lambda calculus, complete with typing rules and operational semantics. In addition, we present a new form of semantic transition that we call a
temporal
transition to specify how an FRP program behaves over time and to allow us to better reason about causality. As our model is designed for a Haskell implementation, the semantics are lazy. Finally, with the language defined, we prove that our wormholes indeed allow side effects to be performed safely in an FRP framework.
Publisher
Association for Computing Machinery (ACM)
Subject
Computer Graphics and Computer-Aided Design,Software
Cited by
3 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Rhine: FRP with type-level clocks;Proceedings of the 11th ACM SIGPLAN International Symposium on Haskell;2018-09-17
2. Toward automatic update from callbacks to promises;Proceedings of the 1st Workshop on All-Web Real-Time Systems;2015-04-21
3. Settable and non-interfering signal functions for FRP;Proceedings of the 19th ACM SIGPLAN international conference on Functional programming;2014-08-19