[Haskell-cafe] Re: advice on architecting a library (and haskell software in general)

apfelmus at quantentunnel.de apfelmus at quantentunnel.de
Fri Jan 12 07:03:30 EST 2007


Yang wrote:
> hi all, i'm looking for advice on how to architect a simple widget
> library for vty/hscurses, but these beginner-level questions should
> apply to haskell applications in general. input/requests on any aspect
> of my design would be greatly appreciated - in return perhaps you'll
> get something you'd actually want to use!
>
> i have studied in detail various haskell curses/vty apps, including
> yi, hmp3, riot, and hscurses.widgets/contactmanager. my immediate goal
> is to produce a set of composable widgets and a flexible framework
> that - as much as possible - reduces the amount of code a user has to
> write. my eventual goal is to make a functional gui library, along the
> lines of fruit/wxfruit/fg. to this end i've also read their
> literature, but i still do not understand enough about
> arrows/yampa/afrp.

Currently, the design of a functional UI library (be it graphical or for
tty) is still an open research problem.

Somehow, the arrow based approaches like Fruit etc. are not yet
satisfying. A predecessor to this approach is FranTk. The early library
Fudgets is in essence based on arrows but precedes their invention. The
most recent development in this direction is Phooey.

In the mean time, the medium level libraries wxHaskell and gtk2hs have
gathered acceptance, mostly because they implement a full widget set
while still being reasonably succinct. A predecessor is HToolkit drawing
from ObjectIO. Despite being close to their imperative cousins, they
already supersede them in expressiveness. They make an excellent base
for further experiments, be it for arrows (wxFruit) or other recent
approaches like PropLang.

You have two options:

* Search for the grail. Most likely, this doesn't involve much coding
but much searching and has the risk of not finding it. But as the tty
doesn't have many different widgets, you can concentrate on the high
level ideas, i.e. how to get rid of IO and IORefs. Pumping your brain
with ideas - as you already do - surely helps.

* Implement an existing design. This way, you'll actually program
something. I'd propose to implement something medium level along the
lines of wxHaskell that can later be utilized in a high level approach.
Maybe you can even create a cross platform interface, i.e. one that
works for a tty and for graphical UIs at the same time. The author of
HToolkit wrote a proposal on how to transparently enclose Windows, Mac
and Gnome.


> try to use it for a "real" application that has little to do with
> parsing or other purported strengths of the language.

Well, Haskell's "only" strength is that it gives you enough power to
express your ideas, i.e. to compose great things from small ones. The
strength of your ideas is your business :) In this sense, monadic parser
combinators are not an inherent strength of the language, they happen to
be powerful by themselves.


Regards,
apfelmus



More information about the Haskell-Cafe mailing list