I factored out the submit buttons.

Now the three text boxes appear in succession above a unique button below.

http://mflowdemo.herokuapp.com/noscript/fviewmonad

This is the new code:

sumWidget=  pageFlow "sum" $ do

      n ←  (do
           n1 ←  p << "Enter first number"       ++> getInt Nothing <++ br
           n2 ←  p << "Enter second number" ++> getInt Nothing <++ br
           n3 ←  p << "Enter third number"      ++> getInt Nothing <++ br
           return (n1+ n2 + n3))

          <**  pageFlow "button" (submitButton "submit")

       p <<  ("The result is: "++show n)  ++>  wlink () << b << " menu"
       <++ p << "you can change the numbers in the boxes to see how the
result changes"




2013/7/10 Adrian May <adrian.alexander....@gmail.com>

> Oh how nice!
>
> I have been looking at MFlow a lot lately and I think it's got something
> quite special that Yesod, Happstack, etc don't seem to have, at least, not
> as far as I know. I mean, look at this:
>
> sumWidget= pageFlow "sum" $ do
>
>       n1 <- p << "Enter first number"  ++> getInt Nothing <** submitButton 
> "enter" <++ br
>
>       n2 <- p << "Enter second number" ++> getInt Nothing <** submitButton 
> "enter" <++ br
>
>       n3 <- p << "Enter third number"  ++> getInt Nothing <** submitButton 
> "enter" <++ br
>
>       p <<  ("The result is: "++show (n1 + n2 + n3))  ++>  wlink () << b << " 
> menu"
>
>       <++ p << "you can change the numbers in the boxes to see how the result 
> changes"
>
> Is that pretty or what? That's the code for this:
>
> http://mflowdemo.herokuapp.com/noscript/fviewmonad
>
> To me that's a real technological step over and above the usual servlets
> paradigm and I'd love to see more people getting involved. It seems like
> Yesod and Happstack have a lot more manpower behind them, but unless I've
> missed something, MFlow is going somewhere new and should be helped along.
>
> Adrian.
>
> PS. Besides Seaside, Racket is playing with the same ideas. They (Jay
> McCarthy) have something to say about performance but I didn't quite
> understand it.
>
>
>
> On 10 July 2013 06:41, Alberto G. Corona <agocor...@gmail.com> wrote:
>
>> The third version of MFlow is out.
>>
>> http://hackage.haskell.org/package/MFlow
>>
>> MFlow is an all-heterodox web application framework, but very haskellish.
>>
>> Now MFlow support restful URLs.  It is the first stateful web framework
>> to my knowledge that supports it. The type safe routes are implicitly
>> expressed as normal monadic code within a navigation monad. The application
>> look as a normal imperative console application, but the navigation monad
>> goes back and forth to match the path of the URL. The user has control of
>> the state, that can roll-back or not when the navigation goes back
>> depending on the application needs. The state is in the form of normal
>> Haskell variables In a monadic computation, with the weird addition of
>> backtracking.
>>
>> The menu of the application below is implemented as an imperative-like
>> syntax, but the application navigate forward and backward to synchronize
>> with the requests of the web browser:
>> http://mflowdemo.herokuapp.com/
>>
>> This version support  in-page flows.
>>  What is that? look at this example:
>>
>> http://mflowdemo.herokuapp.com/noscript/fviewmonad
>>
>> These flows are implemented as formlets with a monad instance, and
>> callbacks which change the look. I call them "widgets":
>>
>>
>> http://haskell-web.blogspot.com.es/2013/06/the-promising-land-of-monadic-formlets.html
>>
>>
>> Each page may have many  of these active widgets, each one running their
>> own flow. These widgets refresh themselves trough Ajax if they are enclosed
>> in the primitive "autoRefresh". If there is no Ajax or JavaScript
>> available, they gracefully degrade by refreshing the entire page:
>>
>> http://mflowdemo.herokuapp.com/noscript/combination
>>
>>
>> http://haskell-web.blogspot.com.es/2013/06/and-finally-widget-auto-refreshing.html
>>
>> The page flows and the multiflow idea was inspired in 
>> Seaside<http://www.seaside.st/>,
>> a great Smalltalk web framework and adapted to the pure recursive nature of
>> Haskell and the formlets.
>>
>> It also support some JQuery widgets integrated: modal and not modal
>> dialogs, datePicker and other active widgets that handle other widgets.
>>
>> It also support the older features: persistent state, WAI, blaze-html and
>> others integration, server process timeouts, Ajax, requirements,
>>  content management, caching of widget rendering and all the other
>> previous stuff.
>>
>> I wish to thank some people for their feedback. Specially Adrian May for
>> his feedback and interest
>>
>>
>> --
>> Alberto.
>>
>> _______________________________________________
>> Haskell-Cafe mailing list
>> haskell-c...@haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>
>>
>
> _______________________________________________
> Haskell-Cafe mailing list
> haskell-c...@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>


-- 
Alberto.
_______________________________________________
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to