Hi All,

Next monad query.... [*]

In the 1995 paper "Composing Haggis", layout is done using a monad to
compose individual elements. To modernize the syntax consider (forgive
the operator, but it avoids parentheses):

infixl 1 <|
f <| x = f x

mylayout
   = do
       hbox <| do
            button "ok"
            button "cancel"

It was nice, because you didn't need to worry about temporary
structures, variable names, and suchlike.

In the 1996 version of the paper, this silently changed to

mylayout
    = do
         o <- button "ok"
         c <- button "cancel"
         hbox [o, c]

Does anyone know why the change occurred? IMO, the former was much more elegant.

Also, assuming you want to use a different underlying monad (e.g. IO),
how would you implement a layout monad.

FWIW, I'm not actually interested in widgets per se, but in building
html pages in such a way that you can specify the style
elements/scripts with the code that creates the nodes of the document
tree, but serialize them separately.

Tom
* Maybe we need a [EMAIL PROTECTED] list. On second thoughts,
no, because it would kill off the other mailingl lists. ;-)
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to