[Haskell-cafe] ANNOUCE: monad-task-0.1.0, GLFW-task-0.1.0 and a tutorial on invert the inversion of control
ninegua at gmail.com
Fri Aug 31 09:11:58 CEST 2012
Graphics program often relies on system frameworks such as GLUT or
GLFW to handle window and user input. But such frameworks often impose
a rigid style of callback programming, or inversion of control. It is
no secret that continuation monad can deal with this issue . It is
also known that concurrency can be naturally expressed as continuation
monads , and a hybrid model of event and threads  brings the
best of both worlds.
But then I'm a bit surprised to find no single library on HackageDB
that can deal with this issue. Further more, I wanted something that
can escape the IO monad imposed by callbacks (and FFI) and be
flexible. (no, monad-control is not a solution here).
So I wrote a monad-task library to handle both co-operative threads
(or co-routines) and event processing in a TaskT transformer. To
demonstrate its usage, I also uploaded a GLFW-task library that helps
to program task monad with GLFW, which contains a sample application
if you unpack its source.
I documented the rationales behind this work in a (rather length but
runnable literal Haskell) tutorial "Invert the Inversion of Control",
and welcome any suggestions and feedbacks.
: Quick and dirty reinversion of control, Dan Piponi.
: Functional Pearls: A Poor Man's Concurrency Monad, Koen Claessen, 1999
: Combining Events And Threads For Scalable Network Services. Peng
Li and Steve Zdancewic. PLDI, 2007.
More information about the Haskell-Cafe