[Haskell] ANNOUNCE: Phooey -- a Functional UI library for Haske ll
Neil Mitchell
ndmitchell at gmail.com
Wed Dec 13 15:13:07 EST 2006
Hi,
> Thanks for your comments, Steve. They're getting me closer to a clear
> explanation, which will be helpful in the paper I'm writing.
I was going to polish up PropLang before releasing it, but if you're
writing a paper, and I go and release PropLang just after you've put
the finishing touches on it, you'll hunt me down and kill me :)
As such, here is an announcement that PropLang exists, and is cool.
See the darcs repo: http://www.cs.york.ac.uk/fp/darcs/proplang/ - and
hopefully see some documentation in the future :)
No arrows, but seems to have the same underlying idea.
The darcs repo has a text editor (it had another sample, I'm sure, but
I can't see it!)
Some selected hilights:
-- CREATE VARIABLES
-- is a document open
document <- newVar False
-- is a document modified
modified <- newVar False
-- the filename of the document, if its been saved
filename <- newVar Nothing
-- SET UP RELATIONS BETWEEN PROPERTIES
txt!enabled =<= document
new!enabled =< with1 document not
saveas!enabled =< with2 document modified (&&)
--save!enabled =< with2 document modified (&&)
save!enabled =< (&&) =$$= document =$= modified
close!enabled =<= document
revert!enabled =<= modified
-- SUPPORTS EVENTS TOO
new!onClicked += newDocument gui
save!onClicked += saveDocument gui
saveas!onClicked += saveAsDocument gui
close!onClicked += closeDocument gui
open!onClicked += openDocument gui
-- COOL AND SIMPLE UNDO
revert!onClicked += (txt!text -<- lasttxt)
modified =< with2 (txt!text) (lasttxt) (/=)
let titleformat d m f = "TextEditor" ++
(if d then " - " ++ maybe "<untitled>" id
f else "") ++
(if m then " *" else "")
-- REALLY COOL SETTING OF THE TITLE AUTOMATICALLY
window!text =< titleformat =$$= document =$= modified =$= filename
-- CREATE A STATUS BAR WITH THE WORD COUNT IN ONE LINE!
sb!text =< (\x -> "Word count: " ++ show (length $ words x)) =$$= txt!text
I'll write up a tutorial or something at some point.
It's written using Gtk2Hs, and works fine on both Linux and Windows.
GuiHaskell is written using this:
http://www-users.cs.york.ac.uk/~ndm/projects/guihaskell.php
Thanks
Neil
More information about the Haskell
mailing list