Difference between revisions of "Phooey"

From HaskellWiki
Jump to navigation Jump to search
m
m
Line 1: Line 1:
Phooey is a functional UI library for Haskell.
+
'''Phooey''' is an [arrow]-based functional UI library for [Haskell].
  +
  +
* [http://darcs.haskell.org/packages/phooey/doc/html Read the Haddock docs] (with source code & Comment/Talk links)
 
* Get the code repository: '''<tt>darcs get http://darcs.haskell.org/packages/phooey</tt>'''
  +
* Or grab a [http://darcs.haskell.org/packages/phooey/dist distribution tarball].
  +
* See the [http://darcs.haskell.org/packages/phooey/README README].
  +
  +
== Introduction ==
   
 
GUIs are usually programmed in an "unnatural" style, in that implementation dependencies are inverted, relative to logical dependencies. This reversal results directly from the imperative orientation of most GUI libraries. While outputs depend on inputs from a user and semantic point of view, the imperative approach imposes an implementation dependence of inputs on outputs.
 
GUIs are usually programmed in an "unnatural" style, in that implementation dependencies are inverted, relative to logical dependencies. This reversal results directly from the imperative orientation of most GUI libraries. While outputs depend on inputs from a user and semantic point of view, the imperative approach imposes an implementation dependence of inputs on outputs.
Line 7: Line 14:
 
As an example, below is a simple shopping list GUI. The <hask>total</hask> displayed at the bottom of the window always shows the sum of the values of the <hask>apples</hask> and <hask>bananas</hask> input sliders. When a user changes the inputs, the output updates accordingly.
 
As an example, below is a simple shopping list GUI. The <hask>total</hask> displayed at the bottom of the window always shows the sum of the values of the <hask>apples</hask> and <hask>bananas</hask> input sliders. When a user changes the inputs, the output updates accordingly.
 
<blockquote>
 
<blockquote>
[http://conal.net/phooey/images/ui1.png]
+
http://conal.net/phooey/images/ui1.png
 
</blockquote>
 
</blockquote>
   
Line 20: Line 27:
 
</haskell>
 
</haskell>
   
  +
== Portability ==
I am working on a paper about Phooey. For now, please see [http://darcs.haskell.org/packages/phooey/doc/Graphics-UI-Phooey.html the Haddock documentation] (which includes more examples), and try the code via
 
<blockquote>
 
darcs get http://darcs.haskell.org/packages/phooey
 
</blockquote>
 
Directions for building are in the [http://darcs.haskell.org/packages/phooey/README README] file. Distribution tarballs are [http://darcs.haskell.org/packages/phooey/dist here].
 
   
'''On portability''': Phooey is built on wxHaskell. Quoting from the [http://wxhaskell.sourceforge.net wxHaskell home page]
+
Phooey is built on wxHaskell. Quoting from the [http://wxhaskell.sourceforge.net wxHaskell home page]
 
<blockquote>
 
<blockquote>
 
wxHaskell is therefore built on top of [http://www.wxwidgets.org wxWidgets] -- a comprehensive C++ library that is portable across all major GUI platforms; including GTK, Windows, X11, and MacOS X.
 
wxHaskell is therefore built on top of [http://www.wxwidgets.org wxWidgets] -- a comprehensive C++ library that is portable across all major GUI platforms; including GTK, Windows, X11, and MacOS X.
 
</blockquote>
 
</blockquote>
So I expect that Phooey runs on all of these platforms. That said, I have only tried Phooey on Windows. Please give it a try and let me know what happens.
+
So I expect that Phooey runs on all of these platforms. That said, I have only tried Phooey on Windows. Please give it a try and leave a message on the Talk page ("Discuss this page").
 
Comments and collaboration are very welcome!
 

Revision as of 07:01, 16 January 2007

Phooey is an [arrow]-based functional UI library for [Haskell].

Introduction

GUIs are usually programmed in an "unnatural" style, in that implementation dependencies are inverted, relative to logical dependencies. This reversal results directly from the imperative orientation of most GUI libraries. While outputs depend on inputs from a user and semantic point of view, the imperative approach imposes an implementation dependence of inputs on outputs.

Phooey ("Phunctional ooser ynterfaces") retains the functional style, in which outputs are expressed in terms of inputs. In addition, Phooey supports dynamic input bounds, flexible layout, and mutually-referential widgets.

As an example, below is a simple shopping list GUI. The total displayed at the bottom of the window always shows the sum of the values of the apples and bananas input sliders. When a user changes the inputs, the output updates accordingly.

ui1.png

Phooey is structured as an arrow, and this example uses arrow notation. The code:

    ui1 :: UI () ()
    ui1 = title "Shopping List" $
          proc () -> do
            a <- title "apples"  (islider 3) -< (0,10)
            b <- title "bananas" (islider 7) -< (0,10)
            title "total" showDisplay        -< a+b

Portability

Phooey is built on wxHaskell. Quoting from the wxHaskell home page

wxHaskell is therefore built on top of wxWidgets -- a comprehensive C++ library that is portable across all major GUI platforms; including GTK, Windows, X11, and MacOS X.

So I expect that Phooey runs on all of these platforms. That said, I have only tried Phooey on Windows. Please give it a try and leave a message on the Talk page ("Discuss this page").