survey replies: functional languages and GUI's 
Author Message
 survey replies: functional languages and GUI's

A while ago I posted the following request to comp.lang.functional and
the Haskell mailing list:

> I am conducting a field survey in the area of "the interfacing of
> pure functional languages to graphical user interfaces". I would be
> interested to hear from anyone who is currently working in this
> area. I already know of:

>    - the Fudgets system (from Chalmers),
>    - the Concurrent Clean IO system (from Nijmegen),
>    - the Yale Haskell X Interface,
>    - Duncan Sinclair (Tcl and Tk with Haskell),

> I am also aware of some previous work:

>    - Andrew Dwelly (Graphical Dialogue Combinators),
>    - Satnam Singh (Miranda <-> XView/X11),
>    - Sandra Foubister, Colin Runciman (LML <-> MGR),

> If you are currently doing research in this area, I would appreciate it
> a brief mail message containing a summary of what you are currently
> working on. Also, if I have missed any important previous work...

> I will post a summary of the replies in due course.

> Thanks in advance for your time,

> Rob.
> -----------------------------------------------------------------

The replies I have received follow. Thanks to all those who replied.

Not me, but Kavi Arya has an article on functional programming and
GUIs in FPCA '89 (in London, I think).  I don't have any further
information since I don't have the article here.

Related to your research is the following:

Turtle Graphics in Miranda

The Turtle Graphics program is written in Miranda version 2.009 (Nov.
1989), a pure functional language.  Turtle Graphics is an interactive
program and it prompts for turtle commands.  Turtle commands help to
produce drawings which are displayed on a visual interface. Turtle
Graphics consists on moving the turtle on the screen, producing
geometric designs. A geometric design is a sequence of connected
lines, whose symmetry and regularity provokes the user investigate
deeper in geometry and number theory.

A not so "pure" extension of SML of New Jersey with asynchronous I/O from
CMU (I will try to dig out some refs) is also worth investigating.



VLSI Research Group           _`\<,_       The ViRTUE project
University of Windsor        (*)/ (*)      Ontario N9B 3P4, CANADA

Not sure if this is what you're looking for, but here goes:

"A Declarative Approach to Event-Handling in Visual Programming
 Languages", M. Burnett and A. Ambler, 1992 IEEE Workshop on Visual
 Languages, Seattle, Washington, 34-40, September 1992.

        Summary:  In the approach to events, system-level, interactive,
        and user-defined events are supported while still maintaining
        the property of referential transparency.  An approach to time termed
        temp{*filter*}assignment provides a unifying mechanism for events to be
        defined as ordinary sequences of values, and conversely for ordinary
        sequences of values to be defined as events.


You might also like to include a reference to Erlang. Erlang is
a concurrent functional programming language. Interfaces exist
to PXW (an interface to the "Athena" widget set), Interviews and
(real soon) TCL/TK.

Chapter 14 of "Concurrent Programming in Erlang" discusses and gives
examples of how to build a GUI in Erlang. We argue that building a GUI
in a concurrent functional language is much simplified by controlling each
"object" in the windowing system by a process. Widgets are abstracted
by processes and changes to the display effected by sending messages
to the widgets. Mouse events are converted to messages to the processes
which control the widgets (more details can be found in the book).

[["Concurrent Programming in Erlang" (J. Armstrong, M. Williams &
R. Virding, Prentice Hall, 1993. ISBN 13-285792-8.]]

It might also be of interest to note that Erlang has been used in
many projects just because it is so easy to program GUI's. It has
been used in 3 RACE projects for building demonstrators, these have
a large graphics component.

Erlang (and the associated toolkits for graphics etc.) is available
freely for academic use. A fully supported system can be purchased
for product development.

FTP Info:

At Warwick this year we've had a couple of final year undergraduate projects
which have been hooking up GUIs to Functional Languages:

Jason Smith: "An Interactive Tool to Build Miranda Programs for
Inexperienced Users", and

Steve Chaplin: " Graphical User-Interface for a Simple Functional Language".

Steve's project uses a language called "Ginger", which is a simple FL
used here which has parallel constructs and which is being used for a
parallel implementation. Steve's project is not related to the

Both projects have been successful. If you require more info,
either contact me, or mail them direct (they'll be here for a couple
more weeks yet). Their addresses are:
        [ Oops! Too late, they'll be gone now, so I've removed their ]
        [ old mail addresses from this reply - Rob                   ]

--- uucp  ...!mcsun!uknet!warwick!msj --- fax        +44 203 525714 ---------

Winterp (Widget interpreter) is an X-Lisp interface to the OSF/Motif package.
Looks ok. Free software from HP.

Succes, Huub.

1009 AB Amsterdam
The Netherlands                    
Tel. 31 20 5924080

You might take a look at David Turner's "An approach to functional
operating systems" in his book "Research Topics in Functional
Programming".  In it he describes the KAOS project where they had a
non-functional "sorting office" in the run-time system to route
message streams to and from individual purely functional processes.

- I've recently worked on a "dedicated language" called "SEAL"
  (Semantics-directed Environment Adatation Language) to connect 'tools' to
  syntax-directed editors. These editors form the programming environment
  for some language L.
- The programming environment is generated from a formal definition
- The GUI is generated from a 'script' written in SEAL.

This implies that by defining a programming environment for _any_ language,
SEAL allows you to generate a GUI for it.

We have several examples, e.g., an environment for lambda calculus.

If you are interested, ftp the following files:
        (host:, username: anonymous, passwd: your email address)
A technical report describing SEAL
A technical report describing the lambda calculus environment

Any questions are welcome.

See you, Wilco.

Wilco Koorn
Programming Research Group
University of Amsterdam

I'm currently looking into this field. I am writing a small paper
about this for an assignment for my Masters. I'm looking into using
Monadic I/O in a GUI setting. I'm considering doing my masters in this

You might want to look at the following. I received it from a fellow
called Brett Marl, in the UK.


> Subject:       Gofer for Windows(c)(R)(tm) etc... etc...

> Thanks for your interest in Gofer for Windows, you'll be able to pick
> up a copy of it from

>  (ip =

> by anon. ftp its in pub/gofer

> I take it from your mail that you are implementing functions that allow
> you to build Windows applications - rather than a Graphical Interface
> to a standard FPL. - mine was the latter....

    |  Leander Conradie    |   Pizza + Soda + Programmer = Program  |


###### From: AlastairReid ######

I'm currently working on two things (jointly with Satnam Singh):

1) Producing a library of access routines allowing Haskell to use
   X-widgets effectively. (I'm working on Openlook widgets at the
   moment though the conversion to Athena widgets or Motif widgets
   should be fairly small.)

   One major difference from Duncan Sinclair's approach and from
   Satnam's original approach is the use of the Glasgow extensions
   to Haskell to allow us to call C directly.

   One major problem is that C cannot call Haskell routines and so
   we have to implement callbacks and action procedures indirectly.

   (I expect we'll also have problems managing the fairly large amount of
    "state" information that widgets programs need to keep around... but
    we'll only see that in larger programs.)

2) Producing a library of animation combinators.

   (Not sure how far we're going to take this.)

[This work started when I decided to rewrite a C program that animates
 juggling patterns in Haskell - this seemed particularily appropriate since:
 Patterns could sensibly be represented as (infinite) lists of throws; and
 The ball-drawing commands can easily be generated by a series of
  transformations from throws to ball states to ball positions to
 Anyway, this was fine under basic X-windows but I wanted to modify it
  to use widgets (to vary speed, to vary level of detail, to move hands,
  ...) which started me on the above.]


My bibliography turns these up:

K. Arya, A Functional Approach to Picture Manipulation, Computer Graphics
Forum 3,1, 1982

A. Dwelly, Functions and Dynamic User Interfaces, FPCA, Imperial College,
1989, pp371-381

Peter Henderson, Functional Geometry, In acm82, pp179-187

P. Lucas, S.N. Zilles, Applicative Graphics using Abstract Data Types,
Research Report RJ 6198 (61188), IBM Research Division, Yorktown Heights,
NY, 1988

F.G. Pagan, A Graphical FP Language, SIGPLAN 22, 3, pp21-39

M.S. Parsons, Applicative Languages and Graphical Data Structures, Ph.D.
Thesis, University of Kent at Canterbury

Tony Davie               Department of Mathematical and Computational Sciences
Tel: +44 334 63257       St.Andrews University
Fax: +44 334 63278       North Haugh

                         KY16 9SS

        The following references, while not dealing with the actual
interfacing, describe some of the graphical tasks FPL's have been
used for:

  author =      {Kavi Arya},
  title =       {Processes in a Functional Animation System},
  booktitle =   {FPLCA},
  year =        {1989},
  pages =       {382--395},
  anote =       {Describes the use of FP to realise a very
                 quick prototyping system for animators.
                 Discusses the use of communication to synchronise
                 events, comparing the various I/O models such as
                 Haskell, CSP etc.},
  got =         {yes},


  author =      {Duncan C. Sinclair},
  title =       {Solid Modelling in {H}askell},
  booktitle =   {Functional Programming},
  year =        {1990},
  pages =       {246--263},
  anote =       {Discusses the implementation of a solid modelling
                 system using a FP approach.  Discusses how the
                 haskell class system was put to use, and how the
                 laziness properties enabled a three phase, intuitive
                 system to be developed rather than a all-in-one,
                 obscure system, while retainning good performance.
                 Discusses how the I/O bad press is just a myth, but
                 the lack of decent debugging tools is a serious
                 drawback.  No comparisons are made with other
                 modelling systems.  Uses both boolean and potential
                 field methods for combinning shapes.},
  got =         {In Library, Classmark QA 76.6G},



I've written an OLIT(OpenLook)/X11 interface for Haskell that
uses C monads to directly call C stuff.

It's been used to build OpenLook applications and for graphics
and animation. Curently, we're working on a video game (student
project) and a higher level interface.


Satnam Singh                            Phone: +44 41-339-8855 x 4904
Dept. Electronics & Elec. Eng.,         Fax:   +44 41-330-4907

Scotland G12 8QQ
E-Mail (X.400): "/S=satnam/OU=DCS/O=GLASGOW/PRMD=UK.AC/ADMD= /C=GB/"

See the paper by Simon Peyton Jones and myself in POPL 93,
which describes what we do in the Glasgow Haskell compiler.
-- P

I am working on a software re-engineering project here and am
responsible for the UI of the prototype. We use PolyML (an SML
implementation) as the development environment which supports Motif,
although not in a functional style. It's more just like a direct map
of C functions of Motif to SML functions.

I've only just started working with PolyML, but plan to do a better
(e.g. functional) abstraction of a GUI, based on the possibilities
PolyML offers me.


Ingemar Ahlberg of Ericsson's (Sweden) is working on a functional language
system called Erlang for use in concurrency applications. As I understand it,
part of this has an X based GUI builder. His e-mail is

We are working on using pure functional languages on constraint satisfaction
problems. One stage of the work will include the development of GUI's for CSP
solving systems. Any information you have now, or in the future, will be most

Ken Brownsey
Oxford Brookes University

>    - the Yale Haskell X Interface,

Do you have any good references on this?  Does the Yale distribution
come with any papers on it?

        [ See the next message for a reply - Rob ]

>    - Duncan Sinclair (Tcl and Tk with Haskell),

It's always nice to see my name in lights... :-)

I'm currently writing a paper about more general communication between
Haskell-like languages, and "external systems", including operating

>    - Satnam Singh (Miranda <-> XView/X11),

Satnam extended this to LML and Haskell.  I believe that he is now
working on it again, using Glasgow's monadic I/O.  I'm sure he


>   >       - the Yale Haskell X Interface,

>   Do you have any good references on this?  Does the Yale distribution
>   come with any papers on it?

We have a brief introductory manual, but not a detailed reference
manual.  It's basically just a foreign-function interface to the CLX
library, so you should have little difficulty figuring out how to use
it if you have a CLX manual (an X protocol manual or the C xlib manual
would probably do in a pinch, too).  We're still working on some
last-minute cleanup and testing, but this will be included with our
next source release.


Andrew Donald Gordon, "Functional Programming and Input/Output",
PhD Thesis, University of Cambridge, England, August 1993


You might be interested in

%A E Ireland
%T Writing interactive and file-processing functional programs
%R MSc thesis, Victoria University of Wellington
%D March 1989
%K generational GC, continuations, input, output, I/O, assignment, references

It has some stuff early stuff on basic window based I/O. I thinks
its curses, not X based).

Being from York I'm sure you are aware of "TiP In Haskell"


My claim to fame is Gofer for Windows, not fully robust but is kinda
functional, done as a part of my 3rd year project - ported Gofer 2.23 to
run under MS Windows 3.1. (You'll need a 386 + 4Mb + (S)VGA)

Feel free to pick up a copy from

by anon. ftp

All it is, is Gofer running under a cute GUI, it doesn't support functions to
write GUI apps, however, it would've been nice. Just a little experiment to see
how useful a GUI development environment for Gofer would be...



[ Any probs / queries etc. mail me back ]

____/|   Disclaimer: Gofer for Windows? Me? Nah...
\ o.O|   Brett Marl BSc (hons) Dunelm (AT LAST!) The Castle, Durham DH1 3RW


not sure if it's quite what you're looking for but you might want to
look at Stuart Wray's 1986 thesis (Cambridge tech. report 92).
Among other things he describes writing a free-format spreadsheet
in Jon Fairbairn's fully lazy language Ponder.  As far as I know
it was more of an ad hoc attempt to show that laziness was no barrier
to traditional interactive programs, rather than an attempt to do
a functional model for GUIs in general (the thesis itself was mostly
about strictness etc.), but 1986 is pretty early all the same.
Hope this helps...
Alasdair Grant, Computer Lab, Cambridge University, UK

The SML/NJ ftp distribution includes an X-windows interface called eXene.
I don't know if you consider SML to be a "pure" functional language, tho.

Hi Rob,
        I'm an undergrad involved with a project at my university. It involves
TWINE, which is a SISAL execution kernel. SISAL is a functional data-flow
language receiving much attention from Lawrence Livermore National Laboratories
and Colorado State Univ. As well as us here at Univ. of Massachusetts/Lowell.  
Part of the effort here is to develope an environment package (the graphical user interface that displays the intermediate code of IF1 and IF2) that will
interact with the twine program during execution. This package is being built
by students working with another part of this project, and from my knowledge,
they are building it from two other GUI's already developed to display IF1. If
you would like further info, drop me a line.

// Paul Gentile            

:>   Did you ever wonder why we drive on parkways and we park in driveways???

Dimitris Phoukas writes:
> Rob,

> Related to your research is the following:

> Turtle Graphics in Miranda

> The Turtle Graphics program is written in Miranda version 2.009  (Nov.
> 1989), a pure functional language.  Turtle Graphics is an  interactive
> program and it prompts for turtle commands.  Turtle commands help  to
> produce drawings which are displayed on a visual interface. Turtle
> Graphics consists on moving the turtle on the screen, producing
> geometric designs. A geometric design is a sequence of connected
> lines, whose symmetry and regularity provokes the user investigate
> deeper in geometry and number theory.

In the most recent Yale Haskell release (with X interface), there is  
a Haskell implementation of Logo. Logo is a programming language  
which supports turtle graphics.

The Logo interpreter is in progs/demo/X11/logo. There are a few other  
X Window and graphics related programs under progs/demo/X11:

animation/      Haskell implementation of Kevi Arya's FPCA'88 paper
                "A Functional Animation Starter Kit".

                The following animations are provided there:

                  seaside.hs  - a seaside scene
                  planets.hs  - planets in orbit
                  palm.hs     - another seaside scene
                  birds.hs    - flying birds

draw/           The example draw program used in the X window

gobang/         A game played on a Go board. It has fully interactive
                graphic interface and allows a human to play against
                the computer.

                Two players in turn place pieces on a 19 by 19 board.

                The winner is the first who makes five consecutive

                pieces along either vertical, horizontal or diagonal

graphics/       Haskell implementation of Henderson's recursive


Thanks Sheng.  For what it's worth, I wanted to also mention that
all of the programs that Sheng mentioned, except for the animation
program, were written by undergraduates in a course I taught last
semester (they were subsequently cleaned up somewhat by Sheng, the
TA for the course, but not much).  None of these students had any
functional programming experience before the course began, and I
think it's interesting to see how well they did by the end.


###### THE END (phew!) ######


Sun, 24 Dec 1995 20:23:10 GMT  
 [ 1 post ] 

 Relevant Pages 

1. survey: functional languages and GUI's

2. Petit survey: What functional language do you use?

3. Survey of functional languages

4. Survey of functional languages

5. Looking for a Functional Language Article Abstract Survey

6. Functional Language Teaching Survey [V. Long ~800 lines]

7. multiplatform GUI design with parallelized lazy functional language

8. gui programming in functional languages

9. GUIs in functional languages

10. languages, environments etc -Reply -Reply

11. Transparent GIF's -Reply -Reply

12. Don't suppress the ODISC4 programming language survey


Powered by phpBB® Forum Software