[web-devel] Re: anybody have toy examples of using digestive functors formlets lib?

Jeremy Shaw jeremy at n-heptane.com
Sat Nov 6 04:40:25 CET 2010


Hello,

I have a attached a little demo that shows how I like to use digestive
functors. The primary issue right now is that it does not work
correctly if you try to put more than one formlet on a page. (due to
an issue in my code). It is fixable -- I just have not had the time
and need quite yet. Though, if you can skip the use of
digestiveFunctorPart and use digestive-functors-hsp the 'normal' way.

To run the demo you will need:

 - lastest happstack from darcs
 - lastest digestive-functors from git,
https://github.com/jaspervdj/digestive-functors
 - lastest digestive-functors-hsp from darcs,
http://src.seereason.com/digestive-functors-hsp

Furthermore, you will need to edit the digestive-functors.cabal file
and change, monads-fd to mtl < 2. That will change later this week
when I switch happstack from mtl to monads-fd. (Or *you* could patch
happstack to use monads-fd and send me a patch). If you do not make
that change, then you will get an overlapping instance error regarding
MonadPlus IO.

If you do not want to update to the lastest happstack, you will just
have to look at the attached code and reverse engineer what you want
to do. Though, I recommend upgrading to happstack from darcs. It will
break your code, but I think I made all the code breaking changes for
the next release, so you can get it over with now :p Or, if you are
using it for a new project, you can start with the good stuff and not
have to upgrade it later. The happstack crash course documents the
darcs version of happstack.

I will eventually add a section to the happstack crash course on this
technology. But until then, I hope this gets you started.

Note that the rendering is ugly because there is no CSS applied. You
can use 'setAttr' in the digestive-functors-hsp library to set some
class attributes and then apply some CSS to pretty things up. Also,
jaspervdj mentioned something in the README about better ways to theme
a form than what formlets offered. I have no idea what that refers
too. But maybe it is better than using setAttrs.

Note that both digestive-functors and digestive-functors-hsp are very
new. If you think something about them is wacky, please let us know.
Don't assume that when meant for things to be stupid.

- jeremy


On Fri, Nov 5, 2010 at 6:32 PM, Thomas Hartman
<thomashartman1 at googlemail.com> wrote:
> anybody have toy examples of using digestive functor library?
> Especially with hsp, which is my usual templating system these days?
> A couple of people have recommended this library to me but I don't see any
> easy way to get started using it.
> Toy example would be great.
> Thanks a bunch!
> thomas.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: demo.hs
Type: text/x-haskell
Size: 6306 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/web-devel/attachments/20101105/4f89e8f3/demo.bin


More information about the web-devel mailing list