Here you can take a look at a complete example included in the package:<br> <br><a href="http://haskell-web.blogspot.com/2012/02/web-application-server-with-stateful.html">http://haskell-web.blogspot.com/2012/02/web-application-server-with-stateful.html</a><br>
<br>This snippet is the web page in declarative form:<div><br></div><div><pre style="text-align:justify;background-color:rgb(255,255,255)"><span class="hs-definition">shopProds</span> <span class="hs-keyglyph">::</span> <span class="hs-conid" style="color:rgb(79,67,113)">V</span><span class="hs-varop" style="color:rgb(51,51,51)">.</span><span class="hs-conid" style="color:rgb(79,67,113)">Vector</span> <span class="hs-conid" style="color:rgb(79,67,113)">Int</span> <span class="hs-keyglyph">-></span> <span class="hs-keyglyph">[</span><span class="hs-conid" style="color:rgb(79,67,113)">Prod</span><span class="hs-keyglyph">]</span>
<span class="hs-keyglyph">-></span> <span class="hs-conid" style="color:rgb(79,67,113)">View</span> <span class="hs-conid" style="color:rgb(79,67,113)">Html</span> <span class="hs-conid" style="color:rgb(79,67,113)">IO</span> <span class="hs-layout">(</span><span class="hs-conid" style="color:rgb(79,67,113)">Either</span> <span class="hs-conid" style="color:rgb(79,67,113)">Int</span> <span class="hs-conid" style="color:rgb(79,67,113)">Prod</span><span class="hs-layout">)</span>
<span class="hs-definition">shopProds</span> <span class="hs-varid" style="color:rgb(51,51,51)">cart</span> <span class="hs-varid" style="color:rgb(51,51,51)">products</span><span class="hs-keyglyph">=</span>
<span class="hs-varid" style="color:rgb(51,51,51)">br</span>
<span class="hs-varop" style="color:rgb(51,51,51)"><++</span> <span class="hs-comment" style="color:rgb(85,85,85)">-- add Html to the first widget</span>
<span class="hs-varid" style="color:rgb(51,51,51)">p</span> <span class="hs-varop" style="color:rgb(51,51,51)"><<</span> <span class="hs-str" style="color:rgb(54,99,84)">"-----Shopping List-----"</span>
<span class="hs-varop" style="color:rgb(51,51,51)"><++</span>
<span class="hs-varid" style="color:rgb(51,51,51)">widget</span><span class="hs-layout">(</span><span class="hs-conid" style="color:rgb(79,67,113)">Selection</span><span class="hs-layout">{</span>
<span class="hs-varid" style="color:rgb(51,51,51)">stitle</span> <span class="hs-keyglyph">=</span> <span class="hs-varid" style="color:rgb(51,51,51)">bold</span> <span class="hs-varop" style="color:rgb(51,51,51)"><<</span> <span class="hs-str" style="color:rgb(54,99,84)">"choose an item"</span><span class="hs-layout">,</span>
<span class="hs-varid" style="color:rgb(51,51,51)">sheader</span><span class="hs-keyglyph">=</span> <span class="hs-keyglyph">[</span> <span class="hs-varid" style="color:rgb(51,51,51)">bold</span> <span class="hs-varop" style="color:rgb(51,51,51)"><<</span> <span class="hs-str" style="color:rgb(54,99,84)">"item"</span> <span class="hs-layout">,</span> <span class="hs-varid" style="color:rgb(51,51,51)">bold</span> <span class="hs-varop" style="color:rgb(51,51,51)"><<</span> <span class="hs-str" style="color:rgb(54,99,84)">"price"</span><span class="hs-layout">,</span> <span class="hs-varid" style="color:rgb(51,51,51)">bold</span> <span class="hs-varop" style="color:rgb(51,51,51)"><<</span> <span class="hs-str" style="color:rgb(54,99,84)">"times chosen"</span><span class="hs-keyglyph">]</span><span class="hs-layout">,</span>
<span class="hs-varid" style="color:rgb(51,51,51)">sbody</span><span class="hs-keyglyph">=</span> <span class="hs-keyglyph">[</span><span class="hs-layout">(</span><span class="hs-keyglyph">[</span><span class="hs-varid" style="color:rgb(51,51,51)">toHtml</span> <span class="hs-varid" style="color:rgb(51,51,51)">pname</span><span class="hs-layout">,</span> <span class="hs-varid" style="color:rgb(51,51,51)">toHtml</span> <span class="hs-varop" style="color:rgb(51,51,51)">$</span> <span class="hs-varid" style="color:rgb(51,51,51)">show</span> <span class="hs-varid" style="color:rgb(51,51,51)">pprice</span><span class="hs-layout">,</span> <span class="hs-varid" style="color:rgb(51,51,51)">toHtml</span> <span class="hs-varop" style="color:rgb(51,51,51)">$</span> <span class="hs-varid" style="color:rgb(51,51,51)">show</span> <span class="hs-varop" style="color:rgb(51,51,51)">$</span> <span class="hs-varid" style="color:rgb(51,51,51)">cart</span> <span class="hs-conid" style="color:rgb(79,67,113)">V</span><span class="hs-varop" style="color:rgb(51,51,51)">.!</span> <span class="hs-varid" style="color:rgb(51,51,51)">i</span><span class="hs-keyglyph">]</span><span class="hs-layout">,</span><span class="hs-varid" style="color:rgb(51,51,51)">i</span> <span class="hs-layout">)</span>
<span class="hs-keyglyph">|</span> <span class="hs-layout">(</span><span class="hs-conid" style="color:rgb(79,67,113)">Prod</span><span class="hs-layout">{</span><span class="hs-keyglyph">..</span><span class="hs-layout">}</span><span class="hs-layout">,</span><span class="hs-varid" style="color:rgb(51,51,51)">i</span> <span class="hs-layout">)</span> <span class="hs-keyglyph"><-</span> <span class="hs-varid" style="color:rgb(51,51,51)">zip</span> <span class="hs-varid" style="color:rgb(51,51,51)">products</span> <span class="hs-keyglyph">[</span><span class="hs-num" style="color:rgb(79,67,113)">1</span><span class="hs-keyglyph">..</span><span class="hs-keyglyph">]</span><span class="hs-keyglyph">]</span><span class="hs-layout">}</span><span class="hs-layout">)</span>
<span class="hs-varop" style="color:rgb(51,51,51)"><+></span> <span class="hs-comment" style="color:rgb(85,85,85)">-- operator to mix two wdigets</span>
<span class="hs-varid" style="color:rgb(51,51,51)">br</span>
<span class="hs-varop" style="color:rgb(51,51,51)"><++</span> <span class="hs-comment" style="color:rgb(85,85,85)">-- add Html to the second widget</span>
<span class="hs-varid" style="color:rgb(51,51,51)">p</span> <span class="hs-varop" style="color:rgb(51,51,51)"><<</span> <span class="hs-str" style="color:rgb(54,99,84)">"---Add a new product---"</span>
<span class="hs-varop" style="color:rgb(51,51,51)"><++</span>
<span class="hs-varid" style="color:rgb(51,51,51)">table</span> <span class="hs-varop" style="color:rgb(51,51,51)"><<<</span> <span class="hs-comment" style="color:rgb(85,85,85)">-- <<< encloses a widget in HTML tags</span>
<span class="hs-layout">(</span><span class="hs-varid" style="color:rgb(51,51,51)">tr</span> <span class="hs-varop" style="color:rgb(51,51,51)"><<<</span> <span class="hs-varid" style="color:rgb(51,51,51)">td</span> <span class="hs-varop" style="color:rgb(51,51,51)">!</span> <span class="hs-keyglyph">[</span><span class="hs-varid" style="color:rgb(51,51,51)">valign</span> <span class="hs-str" style="color:rgb(54,99,84)">"top"</span><span class="hs-keyglyph">]</span>
<span class="hs-varop" style="color:rgb(51,51,51)"><<<</span> <span class="hs-varid" style="color:rgb(51,51,51)">widget</span> <span class="hs-layout">(</span><span class="hs-conid" style="color:rgb(79,67,113)">Form</span> <span class="hs-layout">(</span><span class="hs-conid" style="color:rgb(79,67,113)">Nothing</span> <span class="hs-keyglyph">::</span> <span class="hs-conid" style="color:rgb(79,67,113)">Maybe</span> <span class="hs-conid" style="color:rgb(79,67,113)">Prod</span><span class="hs-layout">)</span> <span class="hs-layout">)</span>
<span class="hs-varop" style="color:rgb(51,51,51)">++></span> <span class="hs-comment" style="color:rgb(85,85,85)">-- append Html after the widget</span>
<span class="hs-varid" style="color:rgb(51,51,51)">tr</span> <span class="hs-varop" style="color:rgb(51,51,51)"><<</span> <span class="hs-varid" style="color:rgb(51,51,51)">td</span> <span class="hs-varop" style="color:rgb(51,51,51)">!</span> <span class="hs-keyglyph">[</span><span class="hs-varid" style="color:rgb(51,51,51)">align</span> <span class="hs-str" style="color:rgb(54,99,84)">"center"</span><span class="hs-keyglyph">]</span>
<span class="hs-varop" style="color:rgb(51,51,51)"><<</span> <span class="hs-varid" style="color:rgb(51,51,51)">hotlink</span> <span class="hs-str" style="color:rgb(54,99,84)">"hello"</span>
<span class="hs-layout">(</span><span class="hs-varid" style="color:rgb(51,51,51)">bold</span> <span class="hs-varop" style="color:rgb(51,51,51)"><<</span> <span class="hs-str" style="color:rgb(54,99,84)">"Hello World"</span><span class="hs-layout">)</span><span class="hs-layout">)</span>
</pre><br class="Apple-interchange-newline"><br>2012/2/7 Alberto G. Corona <<a href="mailto:agocorona@gmail.com">agocorona@gmail.com</a>>:<br>> Hi Haskellers<br>><br>> I I“m happy to announce the first version of MFlow<br>
><br>> <a href="http://hackage.haskell.org/package/MFlow">http://hackage.haskell.org/package/MFlow</a><br>><br>> MFlow permits the execution of web applications in a procedural form,<br>> that is, with multiple requests-response interactions in a single<br>
> procedure. MFlow stores the execution state, manage timeouts, shutdown<br>> and restart the procedure on demand at the point of execution, even<br>> after server stop. These services are transparent for the programmer.<br>
><br>> The other aspect of MFlow are combinators for the definition of<br>> widgets and formlets that can be mixed freely with HTML formatting and<br>> produce statically typed values using the "traditional"<br>
> formlet/applicative approach. There are bindings for the package<br>> XHtml, so no need to learn new paradigms/scripting/formatting..<br>><br>> Console and window oriented apps are possible.<br>><br>> Out of te box serialization in files permits very rapid prototyping,<br>
> but any backend can be used .<br>><br>> MFlow (MessageFlow) was created initially as the user interface for<br>> the Workflow package . Currently is an alpha version. It has only<br>> basic authentication but I plan to inprove it for serious<br>
> applications. I upload this version just in case anyone wants to play<br>> with it.<br><br></div>