I came across the idea that is easy to define additional operators to
Text.FormLets for adding custom HTML formatting.
Had anyone tried that?


For example to enclose the Prod formulary in a Table using Text.XHtml
tags. I defined additional operators <<< and <++ for enclosing and
prepending
Html to a formLet, respectively:

>data Prod= Prod{pname :: String, pprice :: Int}

>getProd= table <<< (
>      Prod <$> tr <<< (td << "enter the name"  <++ td <<< getString (pname <$> 
> mp))
>               <*> tr <<< (td << "enter the price"   <++ td <<< getInt ( 
>pprice <$> mp)))


even:

>p << "paragraph" <++ getProd   ++> (more Html stuff)

  is possible

or even it is possible an operator <+>

>  getProd <+> someOtherStuff

to return  Either Prod OtherStuff


 I did it in my own version of FormLets. So It is too heavy to put
here a running example. It is part of a package that I will upload
soon to hackage.



This also may work for embedding formLets in other haskell HTML
formats besides Text.XHtml.

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to