It turns out that there’s a certain class of event transformers (Event a -> Event b) in Reactive that have some really neat and convenient properties. We’ll call this class synchronous event transformers.
Read the rest of this entry »
December 10th, 2008 in
Haskell |
No Comments
In the last post, Reactive’s Events were examined. While Events cover a lot of ground, Reactive’s Behaviors allow programmers to think beyond sampling when writing games and other interactive programs. This post introduces Behaviors and the functions that make them useful.
Read the rest of this entry »
Writing the event tutorial brought out the need for several basic functions in Reactive, especially switchE. The behavior tutorial is also bringing with it a slew of necessary functions. The most surprisingly difficult to implement has been splitB.
-- |At every event occurrence, produce a behavior that is a combination of the
-- first and second where it acts like the first up to the event occurrence
-- and then acts like the second.
splitB :: Behavior a ->
Behavior a ->
Event b ->
Event (b,Behavior a)
This post describes how this function was implemented. In doing so, we’ll explore internals of the Reactive library and come into contact with the tricky laziness issues that often come up when working with Reactive.
Read the rest of this entry »
November 24th, 2008 in
Haskell | tags:
frp,
Haskell,
reactive |
1 Comment
Reactive is Conal Elliott’s newest FRP (functional reactive programming) framework. In this series of blog posts, I’m going to introduce a set of examples by concept. These articles are intended to serve as tutorials and motivation for writing interactive programs using Reactive instead of the IO monad.
A basic knowledge of Haskell and the prelude functions, especially higher order functions like id and const, is all that is required.
Read the rest of this entry »
freeglut is a version of glut that is vastly superior to the one typically used with windows. Aside from being Open Source, it interacts well with ghci (see leaveMainLoop) and provides a rhombic dodecahedron primitive. This post walks through the somewhat complicated process of getting Freeglut and the haskell OpenGL and GLUT bindings installed and working on windows. This feat is accomplished using the brand new ghc 6.10.1.
Read the rest of this entry »
What’s the difference between the following two functions, a and b:
import Control.Monad.Instances
import Control.Arrow
a, b :: (Int->Int) -> (Int,Int) -> (Int,Int)
a = fmap
b = second
Can you figure it out? Read the rest of this entry »
October 23rd, 2008 in
Haskell |
4 Comments