Thomas Hallgren hallgren@cse.ogi.edu
Tue, 10 Jun 2003 16:54:09 -0700

Ashley Yakeley wrote:

> Would it be worth rewriting Fudgets to take advantage of such recent 
> advances in Haskell as monadic IO?

A rejuvenation of Fudgets, taking advantage of things like subtyping, 
multi-parameter classes with functional dependencies, syntactic sugar 
for arrows, making room for monadic IO, and using a more modern graphics 
subsystem, would probably make Fudgets much more interesting. Actually, 
Fruit [1], although it is independent work, could be seen as a 
redesign/rejuvenation of Fudgets.

Allowing arbitrary monadic IO inside fudgets is not impossible, see [2], 
but while it would give access to modern things like the FFI, it would 
also mean giving up some of the purity and elegance of fudgets. The old 
approach to IO, where every IO operation is a constructor in a data 
type, means that all IO operations can be examined and manipulated 
within the program in interesting ways, by just adding a wrapper around 
the main function. For example, when a fudget program is run with the 
-debug flag, a trace of all IO operations and their results is printed 
on stderr. As another example, the cacheF fudget wrapper speeds up 
fudget programs by caching the result of requests for colors, fonts and 
other GUI resources. It would be easy to write a wrapper that swaps the 
left and right mouse buttons, or makes a program ask for the user's 
permission before deleting a file. Try doing things like that by adding 
a wrapper around a value of type IO()!

>I must confess I'm not all that familiar with Fudgets, although it 
>certainly looks interesting. For what sort of problems is it currently 
>the best solution?
I guess it depends on what you are comparing to, but if you like 
programming GUIs in a declarative style, you don't need the FFI but can 
live with the IO operations already provided by the fudget library 
(which includes file/directory access and networking), or perhaps you 
want to experiment with implementing your own special purpose widgets in 
Haskell (Fudgets implements its own widget set in Haskell), then using 
Fudgets might be a good choice. But when the GUI starts getting big and 
irregular, the plumbing can become a bit clumpsy (some would even say 
painful, "worse than having a tooth pulled" :-).

Thomas H

[1] http://www.haskell.org/fruit
[2] http://www.cs.chalmers.se/~hallgren/Thesis/fudgets-implementation.html#fudgets-on-monadIO