[Haskell-cafe] Adding Html formatting to formlets

Alberto G. Corona agocorona at gmail.com
Fri Feb 3 01:50:36 CET 2012

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
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)))


>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.

More information about the Haskell-Cafe mailing list