background preloader

FRP

Facebook Twitter

WxHaskell/Windows. 1 wxWidgets 3.0 and wxHaskell >= 0.92 1.1 Installing the easy way The easiest way to install wxHaskell on Windows, is to use a wxInstall package. wxInstall Achelanne contains wxWidgets 3.0, compiled with GCC 5.2.0, the necessary DLLs, and an installation script to install wxHaskell.

WxHaskell/Windows

It is available in 32 bit and in 64 bit and can be used for GHC 7.10.3 and later. Reactive-banana anti-tutorial. This is not a tutorial.

reactive-banana anti-tutorial

I have never used reactive-banana nor any other FRP library. And that's the point: in this post, once again1, I will reveal my thought process as I learn this library. Motivation A recent tutorial called The introduction to Reactive Programming you've been missing made me realize that FRP is no longer a niche technique used by a subset of the functional programming community. Apparently, there's now a manifesto, a javascript library involving Microsoft, a conference... As a member of the functional programming community, I feel like I ought to at least have an opinion on FRP. Why not <name-of-alternate-frp-library>? Because I began by writing the graphics in gloss, whose play interface is based on pure functions. Forall t. I suspect that it's still IO under the hood, and that a similar sodium or elerea wrapper could easily be written, but I'm not yet in a position to write such a wrapper.

Versions Goal First steps: Why so polymorphic? First :: f a b → f (a, s) (b, s) FRP explanation using reactive-banana. This is an attempt to explain Functional Reactive Programming (FRP) enough to give a reader with no previous exposure to FRP an intuition what FRP is about.

FRP explanation using reactive-banana

After reading this you should hopefully understand enough of FRP to understand the reactive-banana examples. FRP has certain terms such as behavior, event and time-varying that can be confusing for people unfamiliar with it. I'll avoid these terms at first and will focus on spreadsheets and a generalization of spreadsheet cells (which I will call boxes). Later, once the most important concepts are explained, reactive-banana syntax will be introduced along with an example that demonstrates how to work with behaviors and events in reactive-banana.

Finally some theory about time-varying functions and how events and behaviors can be implemented using pure functions by making time explicit should provide the necessary background to understand reactive-banana's haddock comments. Composing Reactive Animations. Conal Elliott Microsoft Research Graphics Group Copyright 1998 We have all seen a lot of wonderful looking computer graphics, and many of us have spent time playing video games or watching our kids (or their kids) play them.

Composing Reactive Animations

It is clear that computer graphics, especially interactive graphics, is an incredibly expressive medium, with potential beyond our current imagination. Affordable personal computers are capable of very impressive 2D animation and multi-media. Interactive 3D graphics is already available, and soon it will be standard for new personal computers. That's the good news. The bad news is that very few people are able to create their own interactive graphics, and so what might otherwise be a widely shared medium of communication is instead a tool for specialists.

One approach to solving this problem is to avoid programming altogether, and instead use a visual authoring tool. I do not assume familiarity with Haskell, and have tried to make this article mostly self-contained. Reactive-banana/Animation.hs at master · HeinrichApfelmus/reactive-banana. Reactive/Tutorial/A FPS display. Being the game programmer I am, it's vitally important for me to know the FPS my code is running at, even if there is no code yet.

Reactive/Tutorial/A FPS display

Some knowledge of Haskell, particularly not being scared of overly-general type signatures and browsing haddock docs, is assumed. Experience with point-free style will come in handy, too. Let's dive in, bottom to top: fpsE :: UI -> Event TimeT fpsE = fmap ((1/) . uncurry (-)) . withPrevE . withTimeE_ . framePass is a function that maps from , defined in FRP.Reactive.GLUT.Adapter and representing the outside world as known to GLUT, to a stream of Events, each event occurrence carrying the current frames per seconds. is , for all you care, with a whole number increment representing a second passing in the real world. Reading the above backwards, we get the following: