
Hello, Formlets is deprecated in favor of digestive functors. If you have not looked at the digestive-functors package I highly recommend that you do. It fixes a lot of little issues that formlets had -- but is basically the same thing. The (<<<) operator is a already a standard operator in Control.Category / Control.Arrow. So, it is probably confusing to reuse that symbol for something else⦠The digestive functors library defines two new operators (++>) and (<++) which are somewhat related to what you are trying to do. In HTML, the <label> tag is supposed to reference the 'id' of the field is it labeling. For example, you might have: <label for="username">Username: </label><input text="text" id="username" name="username" value=""> In formlets, there was no way to do that because the 'ids' are not accessible to the user. In digestive functors you can use the ++> operator to 'share' an id between to elements. That allows you to write: label "Username :" ++> inputText Nothing Anyway, I would love to see: a) your new combinators renamed and reimplemented for digestive-functors b) the type signatures of these new operators With out the type signatures it is a bit hard to decipher what your new operators are actually doing.. But, I love seeing any new improvements to the formlets/digestive-functors concept! - jeremy On Feb 2, 2012, at 6:50 PM, Alberto G. Corona wrote:
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