Hi Jeremy<br><br>If the signature of a formlet or digestive functor is<br><br>View <i>format m a </i><br><br>with `<i>m</i>` a monad, `<i>a</i>` the resulting value and `<i>format</i>` the formatting (Usually HTML)<br><br>
then the signatures of the operators for Text.XHtml format are:<br><br><i>(<<<) :: Monad m => (Html -> Html) -> View Html m a -> View Html m a<br><br>(<++) :: Monad m => Html -> View Html m a -> View Html m a<br>
<br>(++>) :: Monad m => View Html m a -> Html -> View Html m a<br><br>(<+>) :: Monad m => View Html m a -> View Html m b -> View Html m (Either a' b')</i><br><br><br>My mplementation is tightly integrated with other non related functionalities in an app server that I´m developing so a translation to diggestive functors is not trivial, but I too would love to have this integrated in digestive functors for the shake of modularity. <br>
<br><br><br>2012/2/3 Jeremy Shaw <<a href="mailto:jeremy@n-heptane.com">jeremy@n-heptane.com</a>>:<br>> Hello,<br>><br>> 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.<br>
><br>> 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…<br>><br>> The digestive functors library defines two new operators (++>) and (<++) which are somewhat related to what you are trying to do.<br>
><br>> In HTML, the <label> tag is supposed to reference the 'id' of the field is it labeling. For example, you might have:<br>><br>> <label for="username">Username: </label><input text="text" id="username" name="username" value=""><br>
><br>> 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:<br>
><br>> label "Username :" ++> inputText Nothing<br>><br>> Anyway, I would love to see:<br>><br>> a) your new combinators renamed and reimplemented for digestive-functors<br>> b) the type signatures of these new operators<br>
><br>> With out the type signatures it is a bit hard to decipher what your new operators are actually doing..<br>><br>> But, I love seeing any new improvements to the formlets/digestive-functors concept!<br>><br>
> - jeremy<br>><br>><br>><br>> On Feb 2, 2012, at 6:50 PM, Alberto G. Corona wrote:<br>><br>>> I came across the idea that is easy to define additional operators to<br>>> Text.FormLets for adding custom HTML formatting.<br>
>> Had anyone tried that?<br>>><br>>><br>>> For example to enclose the Prod formulary in a Table using Text.XHtml<br>>> tags. I defined additional operators <<< and <++ for enclosing and<br>
>> prepending<br>>> Html to a formLet, respectively:<br>>><br>>>> data Prod= Prod{pname :: String, pprice :: Int}<br>>><br>>>> getProd= table <<< (<br>>>> Prod <$> tr <<< (td << "enter the name" <++ td <<< getString (pname <$> mp))<br>
>>> <*> tr <<< (td << "enter the price" <++ td <<< getInt ( pprice <$> mp)))<br>>><br>>><br>>> even:<br>>><br>>>> p << "paragraph" <++ getProd ++> (more Html stuff)<br>
>><br>>> is possible<br>>><br>>> or even it is possible an operator <+><br>>><br>>>> getProd <+> someOtherStuff<br>>><br>>> to return Either Prod OtherStuff<br>
>><br>>><br>>> I did it in my own version of FormLets. So It is too heavy to put<br>>> here a running example. It is part of a package that I will upload<br>>> soon to hackage.<br>>><br>
>><br>>><br>>> This also may work for embedding formLets in other haskell HTML<br>>> formats besides Text.XHtml.<br>>><br>>> _______________________________________________<br>>> Haskell-Cafe mailing list<br>
>> <a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>>> <a href="http://www.haskell.org/mailman/listinfo/haskell-cafe">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>><br>
<br>