Arrows, Robots, and Functional Reactive Programming
Arrows, Robots, and Functional Reactive Programming
复制标题
箭头、机器人和函数式反应式编程
DOI:
10.1007/978-3-540-44833-4_6
复制
发表时间:
2002
期刊:
影响因子:
--
通讯作者:
J. Peterson
中科院分区:
文献类型:
--
作者:
P. Hudak;A. Courtney;H. Nilsson;J. Peterson
Functional reactive programming, or FRP, is a paradigm for programming hybrid systems – i.e., systems containing a combination of both continuous and discrete components – in a high-level, declarative way. The key ideas in FRP are its notions of continuous, time-varying values, and time-ordered sequences of discrete events. Yampa is an instantiation of FRP as a domain-specific language embedded in Haskell. This paper describes Yampa in detail, and shows how it can be used to program a particular kind of hybrid system: a mobile robot. Because performance is critical in robotic programming, Yampa uses arrows (a generalization of monads) to create a disciplined style of programming with time-varying values that helps ensure that common kinds of timeand space-leaks do not occur. No previous experience with robots is expected of the reader, although a basic understanding of physics and calculus is assumed. No knowledge of arrows is required either, although we assume a good working knowledge of Haskell. This paper is dedicated in memory of Edsger W. Dijkstra for his influential insight that mathematical logic is and must be the basis for sensible computer program construction.