Photo of Ivan Perez

Ivan Perez

Email:

I am a programmer and entrepreneur. I like Game Programming, GUIs, Multimedia, Reactivity and Functional Languages. I currently work as a research contractor with NASA Langley Research Center. In 2017, I finished my PhD, under the supervision of Henrik Nilsson and Graham Hutton.

Selected Publications

Rhine: FRP with Type-Level Clocks


Haskell Symposium 2018 - Co-located with ICFP 2018 (St Louis, USA)
Authors: Manuel Bärenz and Ivan Perez

Processing data at different rates is generally a hard problem in reactive programming. Buffering problems, lags, and concurrency issues often occur. Many of these problems are clock errors, where data at different rates is combined incorrectly. Techniques to avoid clock errors, such as type-level clocks and deterministic scheduling, exist in the field of synchronous programming, but are not implemented in general-purpose languages like Haskell. Rhine is a clock-safe library for synchronous and asynchronous Functional Reactive Programming (FRP). It separates the aspects of clocking, scheduling and resampling from each other, and ensures clock-safety at the type level. Concurrent communication is encapsulated safely. Diverse reactive subsystems can be combined in a coherent, declarative data-flow framework, while correct interoperability of data at different rates is guaranteed by type-level clocks. This provides a general-purpose framework that simplifies multi-rate FRP systems and can be used for game development, media applications, GUIs and embedded systems, through a flexible API with many reusable components.


Fault Tolerant Functional Reactive Programming


ICFP 2018 (St Louis, USA)
Authors: Ivan Perez
(official)
Highly critical application domains, like medicine and aerospace, require the use of strict design, implementation and validation techniques. Functional languages have been used in these domains to develop synchronous dataflow programming languages for reactive systems. Causal stream functions and Functional Reactive Programming capture the essence of those languages in a way that is both elegant and robust. To guarantee that critical systems can operate under high stress over long periods of time, these applications require clear specifications of possible faults and hazards, and how they are being handled. Modeling failure is straightforward in functional languages, and many Functional Reactive abstractions incorporate support for failure or termination. However, handling unknown types of faults, and incorporating fault tolerance into Functional Reactive Programming, requires a different construction and remains an open problem. This work presents extensions to an existing functional reactive abstraction to facilitate tagging reactive transformations with hazard tags or confidence levels. We present a prototype framework to quantify the reliability of a reactive construction, by means of numeric factors or probability distributions, and demonstrate how to aid the design of fault-tolerant systems, by constraining the allowed reliability to required boundaries. By applying type-level programming, we show that it is possible to improve static analysis and have compile-time guarantees of key aspects of fault tolerance. Our approach is powerful enough to be used in systems with realistic complexity, and flexible enough to be used to guide their analysis and design, to test system properties, to verify fault tolerance properties, to perform runtime monitoring, to implement fault tolerance during execution and to address faults during runtime. We present implementations in Haskell and in Idris.


GALE: a functional Graphic Adventure Library and Engine


FARM 2017 - Colocated with ICFP 2017 (Accepted)
Authors: Ivan Perez
(official)
Functional Programming brings a promise of highly-declarative code, efficient, parallelisable execution, modularity and reusability. In spite of these advantages, the use of pure Functional Languages in commercial games is still rare. This is partially caused lack of backends for multimedia, lack of production tools, and the demon- stration that functional abstractions work for other than non-trivial examples. In this paper we present GALE, a Graphic Adventure Library and Engine implemented in Haskell. Our engine implements the basic common features available in similar commercial engines for graphic adventures. We show a high-level abstract definition of game descriptions that allows us not only to run them, but also to analyse them in compile time. We also demonstrate how this description allows us to provide novel features not available in traditional engines. Our system works on iOS, Android and desktop, and is accompanied by a development environment to compose the games with no prior programming skills.


Back to the Future: Time Travel in FRP


Haskell Symposium 2017 - Colocated with ICFP 2017
Authors: Ivan Perez
(official)
Functional Reactive Programming (FRP) allows interactive applications to be modelled in a declarative manner using time-varying values. For practical reasons, however, operational constraints are often imposed, such as having a fixed time domain, time always flowing forward, and limiting the exploration of the past. In this paper we show how these constraints can be overcome, giving local control over the time domain, the direction of time and the sampling step. We study the behaviour of FRP expressions when time flows backwards, and demonstrate how to synchronize subsystems running asynchronously and at different sampling rates. We have verified the practicality of our approach with two non-trivial games in which time control is central to the gameplay.


Testing and Debugging Functional Reactive Programming


ICFP 2017 (Oxford, UK)
Authors: Ivan Perez and Henrik Nilsson
(official)
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.


Functional Reactive Programming, Refactored


Haskell Symposium 2016 - Colocated with ICFP 2016 (Nara, Japan)
Authors: Ivan Perez, Manuel Bärenz and Henrik Nilsson
(official) (corrected submission) (implementation)
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 parametrised 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.


On the Mathematical Properties of Monadic Stream Functions (draft)


Authors: Manuel Bärenz, Ivan Perez, and Henrik Nilsson
(paper)
Monadic Stream Functions are CPS functions parameterised over a monadic context. They form a suitable abstraction to describe reactive processes, but what properties do they fulfill? In this technical report we explore some of the properties of Monadic Stream Functions, in particular those related to Arrows and Causal Commutative Arrows.


Bridging the GUI Gap with Reactive Values and Relations


Haskell Symposium 2015 - Colocated with ICFP 2015 (Vancouver, Canada)
Authors: Ivan Perez and Henrik Nilsson
(official) (mirror) (bibtex) (abstract)
Reactive Values are an abstraction for mutable elements with a change-propagation or notification mechanism. They enable abstract reactive programming by hiding details on how to access particular values, how to deal with concurrency, etc. They provide a uniform interface for GUI widget properties, application models (in MVC terminology), hardware, files, etc. Reactive Values can be connected to one another forming uni- or bi-directional Reactive Relations. For an implementation, see: Keera Hails


1st year PhD Report

University of Nottingham
(paper) (bibtex)

Includes an overview of GUI programming in Haskell and FRP, Reactive Values and Relations. Recommended for those who want to know more about the current state of FRP.

Declarative Game Programming: Distilled Tutorial


PPDP '14: International Symposium on Principles and Practice of Declarative Programming
Authors: Henrik Nilsson and Ivan Perez
(abstract) (bibtex) (exdended abstract)

Bridging the GUI Gap with Reactive Values and Relations (superceeded)

Trends in Functional Programming 2014 - The Netherlands
Authors: Ivan Perez and Henrik Nilsson
(paper) (bibtex)

Other Talks
  • Functional Abstractions for Robust and Fault Tolerant Reactive Systems. Informal Sandwich Seminar Series at National Institute of Aerospace. May 2018.
  • Reactive Programming with Monadic Stream Functions. Informal Friday Lunch Meeting at NASA Langley Research Center Formal Methods Group. May 2018.
  • Keynote: Extensible Functional Reactive Programming Applied to iOS and Android Game Programming. Haskell in Leipzig. October 2017.
  • Our Tools for Mobile Haskell Games and Apps. At Haskell eXchange (as Keera Studios). October 2017.
  • Haskell Games and Apps for Android and iOS. At Commercial Users of Functional Programming (co-located with ICFP 2017, (as Keera Studios). September 2017.
  • Game Programming in Haskell - Baby steps. At University of Bamberg (as Keera Studios). February 2016.
  • Game Programming in Haskell. At Haskell eXchange (as Keera Studios). October 2015.
  • London Haskell Meetup Group. June 2015.
  • Game Programming made simple. At Technical University of Madrid. April 2015.
  • FP Days London (as Keera Studios). November 2014.
  • London Haskell Meetup Group. September 2014.
  • FPLAD 2014
  • University of Twente. March 2013.
  • Technical University of Madrid. December 2011.
Open Source Software

Haskanoid

(github) (video)

A Haskell game that uses the wiimote and the kinect.


Keera Hails

(github)

A reactive programming framework that scales well for GUIs.


Yampa

(maintainer) (github)

A Functional Reactive Programming Domain-Specific Language.


Hcwiid

(maintainer) (github)

Haskell bindings for a library to access wiimotes on Linux.


Awards

Finalist and winner

Hacknotts - 2014

MLH Finalist and winner of the best project award (to call it something; it was the only non-sponsored prize) at Nottingham Hackathon, together with Manuel Bärenz. We created a custom keyboard on a breadboard with 11 buttons to control a Parrot Drone. The signal was processed by a Haskell Yampa program that sent out commands to the parrot via wifi. The drone was recognised by a separate Haskell game using Kinect and became the player of a sideways Flappy-bird-like Haskell game in which the sizes of the pipes were determined by IBM's stock prize over the last six years (gathered in runtime using Bloomberg's API). We later demonstrated this by playing Breakout with the same drone (using Haskell to control it).

Teaching

Teaching Assistant

University of Nottingham - UK
Other activities

Founder of Keera Studios

Founder of Keera Studios Ltd. (Facebook page), a game programming company that uses Functional Languages to deliver games for Android, iOS and desktop.