Re: [Haskell-cafe] web-routes and forms

2011-01-26 Thread Jeremy Shaw
On Wed, Jan 26, 2011 at 4:33 PM, Corentin Dupont wrote: > Now turning to digestive functors, I don't see where do goes the "A.action > actionURL" part that was in traditionnal forms? > It seems I need it for routing the result of the form. I think you will find formHtml is returning you the stuf

Re: [Haskell-cafe] web-routes and forms

2011-01-24 Thread Jeremy Shaw
Hello, I think you should just be able to use showURL to convert the url type into a String that you can use with blaze-html: data SiteURL = Post_Login | etc loginForm :: RoutedNomicServer Html loginForm = do actionURL <- showURL Post_Login ok $ H.form ! A.method "POST" ! A.action actionUR

Re: [Haskell-cafe] web-routes and forms

2011-01-22 Thread Corentin Dupont
Hello Jeremy, Yes it would be fine to use solution 1, but I just don't figured how to mix web routes and forms. My forms are like that: loginForm :: RoutedNomicServer Html loginForm = do ok $ H.form ! A.method "POST" ! A.action "/postLogin" ! enctype "multipart/form-data;charset=UTF-8" $ do

Re: [Haskell-cafe] web-routes and forms

2011-01-22 Thread Jeremy Shaw
Hello, I believe you problem is because you are trying to use 'dir' inside RouteT after you have already consumed and decode the path info using implSite. There are two solutions here: 1. just use web-routes for all your URLs instead of using a mixture of type-safe routes and 'dir'. 2. put the

Re: [Haskell-cafe] web-routes and forms

2011-01-22 Thread Jasper Van der Jeugt
Hello, I forgot to upload the version with the fixed type of `submit`. It is on hackage now as digestive-functors-blaze-0.0.2.1. Cheers, Jasper On Fri, Jan 21, 2011 at 9:33 PM, Corentin Dupont wrote: > Hello Jeremy, > I'm still trying to integrate web routes, but there is one thing I don't > un

Re: [Haskell-cafe] web-routes and forms

2011-01-21 Thread Corentin Dupont
Hello Jeremy, I'm still trying to integrate web routes, but there is one thing I don't understand: how to deal with multiple forms? In my former application, each forms used to redirect to a subdirectory of the web site, and an appropriate handler was waiting there. But now with web routes I don't

Re: [Haskell-cafe] web-routes and forms

2011-01-19 Thread Corentin Dupont
Thanks Jeremy. I had it to work now ;) Corentin On Tue, Jan 18, 2011 at 6:01 PM, Jeremy Shaw wrote: > Hello, > > trhsx will be installed in ~/.cabal/bin, so you will need to add that > to your PATH. > > In order to use the demo code I provided you would need the latest > happstack from darcs be

Re: [Haskell-cafe] web-routes and forms

2011-01-18 Thread Jeremy Shaw
Hello, trhsx will be installed in ~/.cabal/bin, so you will need to add that to your PATH. In order to use the demo code I provided you would need the latest happstack from darcs because it contains a few differences in the API. The code can be made to work with what is on hackage though. The su

Re: [Haskell-cafe] web-routes and forms

2011-01-13 Thread Corentin Dupont
Hello, I'm using the combination happstack + digestive-functors + web-routes + blazeHTML. I'm not finding any examples on the net... I've tried to adapt your example (thanks): type NomicForm a = HappstackForm IO String BlazeFormHtml a demoForm :: NomicForm (Text, Text) demoForm = (,) <$> ((

Re: [Haskell-cafe] web-routes and forms

2011-01-09 Thread Corentin Dupont
Hello, after installing digestive-functors-blaze with: cabal install digestive-functors-blaze My prog doesn't compiles anymore: Warning: This package indirectly depends on multiple versions of the same package. This is highly likely to cause a compile failure. Followed by an error on MonadCatchIO.

Re: [Haskell-cafe] web-routes and forms

2011-01-09 Thread Jeremy Shaw
Hello, newRule also needs to have the type, RoutedNomicServer. The transformation of RoutedNomicServer into NomicServer is done in the handleSite function. Something like this: nomicSpec :: ServerHandle -> Site Route (ServerPartT IO Response) nomicSpec sh = Site { handleSite = \f

[Haskell-cafe] web-routes and forms

2011-01-08 Thread Corentin Dupont
Hello, I have difficulties mixing web-routes and forms: I have put routes in all my site, except for forms which remains with the type ServerPartT IO Response. How to make them work together? I have: type NomicServer = ServerPartT IO type RoutedNomicServer = RouteT PlayerCommand Nomic