Difference between revisions of "PropLang"
Jump to navigation
Jump to search
NeilMitchell (talk | contribs) |
NeilMitchell (talk | contribs) |
||
Line 2: | Line 2: | ||
Link: http://www.cse.unsw.edu.au/~chak/haskell/ports/ |
Link: http://www.cse.unsw.edu.au/~chak/haskell/ports/ |
||
+ | |||
+ | == Thoughts by == |
||
+ | |||
+ | Neil Mitchell |
||
+ | |||
+ | == The Var concept == |
||
+ | |||
+ | This is the low level stuff, on which the library will be built |
||
+ | |||
+ | data Var a = ... |
||
+ | data Notify |
||
+ | |||
+ | get :: Var a -> IO a |
||
+ | set :: Var a -> a -> IO () |
||
+ | addNotify :: Var a -> IO () -> IO Notify |
||
+ | remNotify :: Notify -> IO () |
||
+ | |||
+ | newVar :: a -> IO (Var a) |
||
+ | |||
+ | == Object layering == |
||
+ | |||
+ | textBox-text -< "test" |
||
+ | filename <- newVar Nothing |
||
+ | notify filename hatCover |
||
+ | lbl-text =< with filename $ \x -> |
||
+ | case x of |
||
+ | Nothing -> "Select a file" |
||
+ | Just x -> "Loaded: " ++ x |
||
+ | |||
+ | |||
+ | where |
||
+ | |||
+ | (-) :: GtkObject -> GtkProp -> Var a -- ignoring lots of details here |
||
+ | (-<) :: Var a -> a -> IO () |
||
+ | (=<) :: Var a -> Action a -> IO () |
||
+ | |||
+ | with :: Var a -> (a -> b) -> Action b |
Revision as of 00:29, 18 July 2006
A design for a GUI library which is more like Haskell and less like C.
Link: http://www.cse.unsw.edu.au/~chak/haskell/ports/
Thoughts by
Neil Mitchell
The Var concept
This is the low level stuff, on which the library will be built
data Var a = ... data Notify
get :: Var a -> IO a set :: Var a -> a -> IO () addNotify :: Var a -> IO () -> IO Notify remNotify :: Notify -> IO ()
newVar :: a -> IO (Var a)
Object layering
textBox-text -< "test" filename <- newVar Nothing notify filename hatCover lbl-text =< with filename $ \x -> case x of Nothing -> "Select a file" Just x -> "Loaded: " ++ x
where
(-) :: GtkObject -> GtkProp -> Var a -- ignoring lots of details here (-<) :: Var a -> a -> IO () (=<) :: Var a -> Action a -> IO ()
with :: Var a -> (a -> b) -> Action b