75,080 research outputs found

    Functional reactive programming, refactored

    Get PDF
    Functional Reactive Programming (FRP) has come to mean many things. Yet, scratch the surface of the multitude of realisations, and there is great commonality between them. This paper investigates this commonality, turning it into a mathematically coherent and practical FRP realisation that allows us to express the functionality of many existing FRP systems and beyond by providing a minimal FRP core parameterised on a monad. We give proofs for our theoretical claims and we have verified the practical side by benchmarking a set of existing, non-trivial Yampa applications running on top of our new system with very good results

    Monadic Functional Reactive Programming

    Get PDF
    Functional Reactive Programming (FRP) is a way to program reactive systems in functional style, eliminating many of the problems that arise from imperative techniques. In this paper, we present an alternative FRP formulation that is based on the notion of a reactive computation: a monadic computation which may require the occurrence of external events to continue. A signal computation is a reactive computation that may also emit values. In contrast to signals in other FRP formulations, signal computations can end, leading to a monadic interface for sequencing signal phases. This interface has several advantages: routing is implicit, sequencing signal phases is easier and more intuitive than when using the switching combinators found in other FRP approaches, and dynamic lists require much less boilerplate code. In other FRP approaches, either the entire FRP expression is re-evaluated on each external stimulus, or impure techniques are used to prevent redundant re-computations. We show how Monadic FRP can be implemented straightforwardly in a purely functional way while preventing redundant re-computations

    Reactamole: Functional Reactive Molecular Programming

    Get PDF
    Chemical reaction networks (CRNs) are an important tool for molecular programming, a field that is rapidly expanding our ability to deploy computer programs into biological systems for a variety of applications. However, CRNs are also difficult to work with due to their massively parallel nature, leading to the need for higher-level languages that allow for easier computation with CRNs. Recently, research has been conducted into a variety of higher-level languages for deterministic CRNs but modeling CRN parallelism, managing error accumulation, and finding natural CRN representations are ongoing challenges. We introduce Reactamole, a higher-level language for deterministic CRNs that utilizes the functional reactive programming (FRP) paradigm to represent CRNs as a reactive dataflow network. Reactamole equates a CRN with a functional reactive program, implementing the key primitives of the FRP paradigm directly as CRNs. The functional nature of Reactamole makes reasoning about molecular programs easier, and its strong static typing allows us to ensure that a CRN is well-formed by virtue of being well-typed. In this paper, we describe the design of Reactamole and how we use CRNs to represent the common datatypes and operations found in FRP. We also demonstrate the potential of this functional reactive approach to molecular programming by giving an extended example where a CRN is constructed using FRP to modulate and demodulate an amplitude modulated signal

    Functional Reactive Programming For Games

    Get PDF
    We investigate the effectiveness of functional reactive programming for games. To accomplish this, we clone aa, an existing game, in Elm, a purely functional programming language. We find that functional reactive programming offers an excellent alternative to event driven programming in purely functional languages. Elm still needs more work if it aims to compete with JavaScript libraries. Games, which typically need several inputs at the same time, benefit from the first class status of Signals, which allow them to be combined

    Functional Reactive Programming Sebagai Paradigma untuk Perancangan Game

    Get PDF
    ABSTRAKSI: Game adalah contoh sistem yang lazim dikembangkan dengan menggunakan paradigma imperative programming. Meskipun diketahui punya banyak keunggulan, sudut pandang functional programming relatif jarang digunakan. Fungsional reactive programming merupakan paradigma turunan functional programming yang bersifat domain-specific untuk sistem yang bersifat reaktif. Pada tugas Akhir ini dirancang beberapa game sederhana sebagai representasi sistem reaktif apabila dilihat dari sudut pandang functional reactive programming dan kelayakan dari pendekatan paradigma ini akan dianalisis.Kata Kunci : Lambda Calculus, Functional Programming, FRP, Game DevelopmentABSTRACT: Game is an example of reactive system that is commonly built upon imperative programming paradigm. Although it is known to have several advantages, functional programming on game development world is relatively at large. Functional reactive programming is domain-specific paradigm derived from functional programming that targets reactive system. This paper covers the development of simple arcade games as examples of reactive systems using the viewpoint of functional reactive programming and the merits of this approach will be examined.Keyword: Lambda Calculus, Functional Programming, FRP, Game Developmen

    Testing and debugging functional reactive programming

    Get PDF
    Many types of interactive applications, including video games, raise particular challenges when it comes to testing and debugging. Reasons include de-facto lack of reproducibility and difficulties of automatically generating suitable test data. This paper demonstrates that certain variants of Functional Reactive Programming (FRP) implemented in pure functional languages can mitigate such difficulties by offering referential transparency at the level of whole programs. This opens up for a multi-pronged approach for assisting with testing and debugging that works across platforms, including assertions based on temporal logic, recording and replaying of runs (also from deployed code), and automated random testing using QuickCheck. The approach has been validated on real, non-trivial games implemented in the FRP system Yampa through a tool providing a convenient Graphical User Interface that allows the execution of the code under scrutiny to be controlled, moving along the execution time line, and pin-pointing of violations of assertions on PCs as well as mobile platforms

    Expressing functional reactive programming in C++

    Get PDF
    Abstract. Most C++ programs are written in a straight-forward imperative style. While e.g. callbacks are employed either directly or through the observer pattern, the mental overhead of keeping program state congruent is high and increases with program size. This paper presents a translation of functional reactive programming into C++ terms. This paradigm originates from the Haskell language community and seeks to express easily how programs should react to new input. Concretely, an implementation of a reactive property class is presented, where property in this context is a class holding a value of a user-specified type. The property class provides a mechanism to bind to it an expression that takes an arbitrary number of inputs, some of which can be other instances of property classes. When any of these dependent properties is updated the expression is re-evaluated, so that a dataflow graph may be built using this type. The automatic re-evaluation reduces the boilerplate code necessary to update variables, which can lead to fewer programming errors and more concise programs. The implementation demonstrates that the core principles of functional reactive programming can be expressed in modern C++. Further, the implementation can be done in an idiomatic manner which appears familiar to C++ developers. At the same time, the implementation’s complexity highlights how much further the C++ meta-programming facilities must be developed to properly support facilities such as a functional reactive programming library implementation. A number of compile-time template metaprogramming utilities used in the implementation are also introduced
    • …
    corecore