Permalink
Browse files

Site updated at 2012-01-03 07:54:51 UTC

  • Loading branch information...
norm2782 committed Jan 3, 2012
1 parent fa05dec commit 6018835c0c6c7e91ac050546ee94bd4245a1a13e
View
@@ -4,7 +4,7 @@
<title><![CDATA[Norm 2782]]></title>
<link href="http://norm2782.github.com/atom.xml" rel="self"/>
<link href="http://norm2782.github.com/"/>
- <updated>2012-01-02T15:19:27+01:00</updated>
+ <updated>2012-01-03T08:54:25+01:00</updated>
<id>http://norm2782.github.com/</id>
<author>
<name><![CDATA[Jurriën Stutterheim]]></name>
@@ -154,10 +154,10 @@ datatype:</p>
</span></code></pre></td></tr></table></div></figure>
-<p>Defining the form is straight-forward if you are used to working with digestive-functors.
-The form is wrapped in divs for better styling options and we attach validators to make
-sure that we get a valid email address and a long enough password. The <code>isValid</code> function
-comes from the email-validate library.</p>
+<p>Defining the form is straight-forward if you are used to working with
+digestive-functors. The form is wrapped in divs for better styling options and
+we attach validators to make sure that we get a valid email address and a long
+enough password. The <code>isValid</code> function comes from the email-validate library.</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
@@ -206,8 +206,9 @@ comes from the email-validate library.</p>
</span></code></pre></td></tr></table></div></figure>
-<p>Up to this point we have not seen anything new yet, so lets start with something a bit
-more interesting. For most of my Snap apps I use the following function to render a form:</p>
+<p>Up to this point we have not seen anything new yet, so lets start with
+something a bit more interesting. For most of my Snap apps I use the following
+function to render a form:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
@@ -222,15 +223,17 @@ more interesting. For most of my Snap apps I use the following function to rende
</span></code></pre></td></tr></table></div></figure>
-<p>It takes an <code>AttributeValue</code> containing the target of the form, an <code>AttributeValue</code> containing
-the HTTP request method and a form as produced by the <code>eitherSnapForm</code> function we will see
-below, resulting in a rendered form of type <code>Html</code>.</p>
+<p>It takes an <code>AttributeValue</code> containing the target of the form, an
+<code>AttributeValue</code> containing the HTTP request method and a form as produced by
+the <code>eitherSnapForm</code> function we will see below, resulting in a rendered form
+of type <code>Html</code>.</p>
-<p>Now for the request handler, which is where most of the action will take place. We want to
-make our lives easy, so we call in the help of the digestive-functors-snap library, which
-provides the <code>eitherSnapForm</code> function. This function can be applied to a digestive-functors
-form and a form name, after which it will use the Snap API to parse the request. Before
-continueing, lets have a look at some code:</p>
+<p>Now for the request handler, which is where most of the action will take place.
+We want to make our lives easy, so we call in the help of the
+digestive-functors-snap library, which provides the <code>eitherSnapForm</code> function.
+This function can be applied to a digestive-functors form and a form name,
+after which it will use the Snap API to parse the request. Before continueing,
+lets have a look at some code:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
@@ -251,23 +254,26 @@ continueing, lets have a look at some code:</p>
</span></code></pre></td></tr></table></div></figure>
-<p>The result of <code>eitherSnapForm</code> is an <code>Either</code> value. When the form has not been submitted yet,
-or if a submitted form failed validation, the result will be a <code>Left</code> constructor containing
-a form of type <code>FormHtml (HtmlM a)</code>. When a form has been submitted and has succesfully passed
-validation, we will get a <code>Right</code> value containing the constructor applied in our form (in this
-case the <code>LoginData</code> constructor).</p>
+<p>The result of <code>eitherSnapForm</code> is an <code>Either</code> value. When the form has not been
+submitted yet, or if a submitted form failed validation, the result will be a
+<code>Left</code> constructor containing a form of type <code>FormHtml (HtmlM a)</code>. When a form
+has been submitted and has succesfully passed validation, we will get a <code>Right</code>
+value containing the constructor applied in our form (in this case the
+<code>LoginData</code> constructor).</p>
-<p>Rendering the form is done when we get a <code>Left</code> result. As it turns out, it is almost trivially
-easy to render the form in Heist. To bind the form as a Heist splice, we first need to render it
-to an <code>Html</code> value using our <code>showForm</code> function. Since Heist cannot work with values of type
-<code>Html</code>, we have to convert the <code>Html</code> to something Heist does understand. Luckily, the xmlhtml
-library provides us with a function that does just that: <code>renderHtmlNodes :: Html -&gt; [Node]</code>.
-Heist loves a list of <code>Node</code>s, so all we need to do is <code>return</code> it to the <code>Splice</code> context so
-we can bind it as a splice to our template.</p>
+<p>Rendering the form is done when we get a <code>Left</code> result. As it turns out, it is
+almost trivially easy to render the form in Heist. To bind the form as a Heist
+splice, we first need to render it to an <code>Html</code> value using our <code>showForm</code>
+function. Since Heist cannot work with values of type <code>Html</code>, we have to
+convert the <code>Html</code> to something Heist does understand. Luckily, the xmlhtml
+library provides us with a function that does just that: <code>renderHtmlNodes ::
+Html -&gt; [Node]</code>. Heist loves a list of <code>Node</code>s, so all we need to do is
+<code>return</code> it to the <code>Splice</code> context so we can bind it as a splice to our
+template.</p>
-<p>The final piece of the puzzle is the template in which the form needs to be rendered. As you can
-see, rendering the form&#8211;including potential validation error messages&#8211;is done by adding nothing
-but a single element to the template.</p>
+<p>The final piece of the puzzle is the template in which the form needs to be
+rendered. As you can see, rendering the form&#8211;including potential validation
+error messages&#8211;is done by adding nothing but a single element to the template.</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
@@ -288,9 +294,10 @@ but a single element to the template.</p>
</span></code></pre></td></tr></table></div></figure>
-<p>With this, we have seen how to use digestive-functors and Heist together in a win-win scenario.
-On the one hand you mostly maintain your separation of concerns by using Heist for most of your
-HTML output, while on the other hand you can enjoy the great digestive-functors library as-is.</p>
+<p>With this, we have seen how to use digestive-functors and Heist together in a
+win-win scenario. On the one hand you mostly maintain your separation of
+concerns by using Heist for most of your HTML output, while on the other hand
+you can enjoy the great digestive-functors library as-is.</p>
]]></content>
</entry>
@@ -58,6 +58,7 @@ <h2>Why are you here?</h2>
<ul class="main-navigation">
<li><a href="/">Blog</a></li>
+ <li><a href="/snaplet-hdbc.html">snaplet-hdbc</a></li>
<li><a href="/blog/archives">Archives</a></li>
</ul>
@@ -228,10 +229,10 @@ <h1 class="entry-title">Using Digestive-functors With Heist</h1>
</span></code></pre></td></tr></table></div></figure>
-<p>Defining the form is straight-forward if you are used to working with digestive-functors.
-The form is wrapped in divs for better styling options and we attach validators to make
-sure that we get a valid email address and a long enough password. The <code>isValid</code> function
-comes from the email-validate library.</p>
+<p>Defining the form is straight-forward if you are used to working with
+digestive-functors. The form is wrapped in divs for better styling options and
+we attach validators to make sure that we get a valid email address and a long
+enough password. The <code>isValid</code> function comes from the email-validate library.</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
@@ -280,8 +281,9 @@ <h1 class="entry-title">Using Digestive-functors With Heist</h1>
</span></code></pre></td></tr></table></div></figure>
-<p>Up to this point we have not seen anything new yet, so lets start with something a bit
-more interesting. For most of my Snap apps I use the following function to render a form:</p>
+<p>Up to this point we have not seen anything new yet, so lets start with
+something a bit more interesting. For most of my Snap apps I use the following
+function to render a form:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
@@ -296,15 +298,17 @@ <h1 class="entry-title">Using Digestive-functors With Heist</h1>
</span></code></pre></td></tr></table></div></figure>
-<p>It takes an <code>AttributeValue</code> containing the target of the form, an <code>AttributeValue</code> containing
-the HTTP request method and a form as produced by the <code>eitherSnapForm</code> function we will see
-below, resulting in a rendered form of type <code>Html</code>.</p>
+<p>It takes an <code>AttributeValue</code> containing the target of the form, an
+<code>AttributeValue</code> containing the HTTP request method and a form as produced by
+the <code>eitherSnapForm</code> function we will see below, resulting in a rendered form
+of type <code>Html</code>.</p>
-<p>Now for the request handler, which is where most of the action will take place. We want to
-make our lives easy, so we call in the help of the digestive-functors-snap library, which
-provides the <code>eitherSnapForm</code> function. This function can be applied to a digestive-functors
-form and a form name, after which it will use the Snap API to parse the request. Before
-continueing, lets have a look at some code:</p>
+<p>Now for the request handler, which is where most of the action will take place.
+We want to make our lives easy, so we call in the help of the
+digestive-functors-snap library, which provides the <code>eitherSnapForm</code> function.
+This function can be applied to a digestive-functors form and a form name,
+after which it will use the Snap API to parse the request. Before continueing,
+lets have a look at some code:</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
@@ -325,23 +329,26 @@ <h1 class="entry-title">Using Digestive-functors With Heist</h1>
</span></code></pre></td></tr></table></div></figure>
-<p>The result of <code>eitherSnapForm</code> is an <code>Either</code> value. When the form has not been submitted yet,
-or if a submitted form failed validation, the result will be a <code>Left</code> constructor containing
-a form of type <code>FormHtml (HtmlM a)</code>. When a form has been submitted and has succesfully passed
-validation, we will get a <code>Right</code> value containing the constructor applied in our form (in this
-case the <code>LoginData</code> constructor).</p>
+<p>The result of <code>eitherSnapForm</code> is an <code>Either</code> value. When the form has not been
+submitted yet, or if a submitted form failed validation, the result will be a
+<code>Left</code> constructor containing a form of type <code>FormHtml (HtmlM a)</code>. When a form
+has been submitted and has succesfully passed validation, we will get a <code>Right</code>
+value containing the constructor applied in our form (in this case the
+<code>LoginData</code> constructor).</p>
-<p>Rendering the form is done when we get a <code>Left</code> result. As it turns out, it is almost trivially
-easy to render the form in Heist. To bind the form as a Heist splice, we first need to render it
-to an <code>Html</code> value using our <code>showForm</code> function. Since Heist cannot work with values of type
-<code>Html</code>, we have to convert the <code>Html</code> to something Heist does understand. Luckily, the xmlhtml
-library provides us with a function that does just that: <code>renderHtmlNodes :: Html -&gt; [Node]</code>.
-Heist loves a list of <code>Node</code>s, so all we need to do is <code>return</code> it to the <code>Splice</code> context so
-we can bind it as a splice to our template.</p>
+<p>Rendering the form is done when we get a <code>Left</code> result. As it turns out, it is
+almost trivially easy to render the form in Heist. To bind the form as a Heist
+splice, we first need to render it to an <code>Html</code> value using our <code>showForm</code>
+function. Since Heist cannot work with values of type <code>Html</code>, we have to
+convert the <code>Html</code> to something Heist does understand. Luckily, the xmlhtml
+library provides us with a function that does just that: <code>renderHtmlNodes ::
+Html -&gt; [Node]</code>. Heist loves a list of <code>Node</code>s, so all we need to do is
+<code>return</code> it to the <code>Splice</code> context so we can bind it as a splice to our
+template.</p>
-<p>The final piece of the puzzle is the template in which the form needs to be rendered. As you can
-see, rendering the form&#8211;including potential validation error messages&#8211;is done by adding nothing
-but a single element to the template.</p>
+<p>The final piece of the puzzle is the template in which the form needs to be
+rendered. As you can see, rendering the form&#8211;including potential validation
+error messages&#8211;is done by adding nothing but a single element to the template.</p>
<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
@@ -362,9 +369,10 @@ <h1 class="entry-title">Using Digestive-functors With Heist</h1>
</span></code></pre></td></tr></table></div></figure>
-<p>With this, we have seen how to use digestive-functors and Heist together in a win-win scenario.
-On the one hand you mostly maintain your separation of concerns by using Heist for most of your
-HTML output, while on the other hand you can enjoy the great digestive-functors library as-is.</p>
+<p>With this, we have seen how to use digestive-functors and Heist together in a
+win-win scenario. On the one hand you mostly maintain your separation of
+concerns by using Heist for most of your HTML output, while on the other hand
+you can enjoy the great digestive-functors library as-is.</p>
</div>
View
@@ -57,6 +57,7 @@ <h2>Why are you here?</h2>
<ul class="main-navigation">
<li><a href="/">Blog</a></li>
+ <li><a href="/snaplet-hdbc.html">snaplet-hdbc</a></li>
<li><a href="/blog/archives">Archives</a></li>
</ul>
Oops, something went wrong.

0 comments on commit 6018835

Please sign in to comment.