Common GUI API : What would the code look like?

David Sankel <[email protected]>
Newsgroups gmane.comp.lang.haskell.gui
Message-ID <[email protected]>
Overview :: 

  This is an example of a low-level binding to a c++
GUI library 
and a mid-level abstraction over it.  This was created
primarily to spark 
discussion in the [email protected] mailing list and
secondarily to provide a 
simple example that can be compiled using ghc without
any language extensions.

  I encourage those who code, to implement their ideas
for the Common GUI API
using this simple framework.  This would allow all
reviewers to understand
exactly what you are talking about by running your
examples.

  Fltk was chosen for its simplicity and portability. 
I didn't use an existing 
library because I wanted a short example where the
source code is easy to 
comprehend at all levels.

Questions ::
1) How does the interface look in Test_midlevel.hs? 
Is there any critiques in
  regard to using this style in CGA (Common GUI API)?

2) What drastic or minor changes would have to be made
to the Test_midlevel.hs
  file to make it CGA compatible?  Yes, this is a
completely subjective 
  question.  In your opinion, what should
Test_midlevel.hs look like?

3) There has been some discussion about using
non-standard Haskell extensions
  in CGA.  No extensions have been used in this
example.  Exactly what 
  extensions would be useful in this example or in CGA
as a imaginary whole?
  Is it worth it to use said extensions and allow CGA
to be incompatible with
  Haskell98?

4) Haskell has one namespace, the global one.  Since
there would be a lot of 
  function names and attributes in CGA, their names
should be well thought out.
  Is there any initial ideas on how to handle this?

5) I am willing to implement more stuff like this. 
What other stuff would you like to see with this?

Running ::
To run the examples, one needs a standard Haskell
compiler with ffi (ghc) and 
fltk installed (http://www.fltk.org).  run make.  If
necessary, change the 
makefile to modify for your configuration.

f_*_stub.cpp -- These are the stubs that are used to
bind the c++ library to 
  c functions.  This is required because the Haskell
ffi standard does not 
  specify any conventions for C++.

Fl.hs
Box.hs
Button.hs
Window.hs -- These contain the bindings to the stub
files.  They also provide 
  a low-level interface for the GUI toolkit.

Test_lowlevel.hs -- This is a simple program
demonstrating use of the low-level
  binding.

Attributes.hs -- This code was taken from the htoolkit
cvs server.  Simple 
  modifications were made to suit our purposes.

A_Button.hs -- This is an abstraction over the
low-level Button interface.  It 
  uses the Attributes module for the mid-level
interface.

Test_midlevel.hs -- This is the same simple program as
Test_lowlevel.hs except
  it uses A_Button instead of Button to demonstrate
use of the Attributes
  abstraction.


Cheers,

David J. Sankel
CGA-example-1.0.tar.bz2 (application/octet-stream, 7.1 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.