Skip to content
Browse files

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

  • Loading branch information...
1 parent fa05dec commit 6018835c0c6c7e91ac050546ee94bd4245a1a13e @norm2782 committed Jan 3, 2012
View
73 atom.xml
@@ -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>
View
72 blog/2012/01/01/using-digestive-functors-with-heist/index.html
@@ -58,6 +58,7 @@
<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
1 blog/archives/index.html
@@ -57,6 +57,7 @@
<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>
View
77 blog/categories/digestive-functors/atom.xml
@@ -4,7 +4,7 @@
<title><![CDATA[Category: digestive-functors | Norm 2782]]></title>
<link href="http://norm2782.github.com/blog/categories/digestive-functors/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>
@@ -115,10 +115,10 @@ datatype:</p>
<p>```</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>
+<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>``` haskell</p>
@@ -160,8 +160,9 @@ longPwd = check "Password needs to be at least six characters long"</p>
<p>```</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>
+<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>``` haskell</p>
@@ -175,15 +176,17 @@ showForm act mth frm =
<p>```</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>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>
<p>``` haskell</p>
@@ -200,23 +203,26 @@ Right (LoginData e p r) -&gt; writeBS "Success!"
<p>```</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>The final piece of the puzzle is the template in which the form needs to be rendered. As you can
-see, rendering the form--including potential validation error messages--is done by adding nothing
-but a single element to the template.</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>The final piece of the puzzle is the template in which the form needs to be
+rendered. As you can see, rendering the form--including potential validation
+error messages--is done by adding nothing but a single element to the template.</p>
<p>``` xml
<html>
@@ -235,9 +241,10 @@ but a single element to the template.</p>
</html>
```</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>
+<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>
View
1 blog/categories/digestive-functors/index.html
@@ -56,6 +56,7 @@
<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>
View
77 blog/categories/haskell/atom.xml
@@ -4,7 +4,7 @@
<title><![CDATA[Category: Haskell | Norm 2782]]></title>
<link href="http://norm2782.github.com/blog/categories/haskell/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>
@@ -115,10 +115,10 @@ datatype:</p>
<p>```</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>
+<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>``` haskell</p>
@@ -160,8 +160,9 @@ longPwd = check "Password needs to be at least six characters long"</p>
<p>```</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>
+<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>``` haskell</p>
@@ -175,15 +176,17 @@ showForm act mth frm =
<p>```</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>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>
<p>``` haskell</p>
@@ -200,23 +203,26 @@ Right (LoginData e p r) -&gt; writeBS "Success!"
<p>```</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>The final piece of the puzzle is the template in which the form needs to be rendered. As you can
-see, rendering the form--including potential validation error messages--is done by adding nothing
-but a single element to the template.</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>The final piece of the puzzle is the template in which the form needs to be
+rendered. As you can see, rendering the form--including potential validation
+error messages--is done by adding nothing but a single element to the template.</p>
<p>``` xml
<html>
@@ -235,9 +241,10 @@ but a single element to the template.</p>
</html>
```</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>
+<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>
View
1 blog/categories/haskell/index.html
@@ -56,6 +56,7 @@
<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>
View
77 blog/categories/heist/atom.xml
@@ -4,7 +4,7 @@
<title><![CDATA[Category: Heist | Norm 2782]]></title>
<link href="http://norm2782.github.com/blog/categories/heist/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>
@@ -115,10 +115,10 @@ datatype:</p>
<p>```</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>
+<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>``` haskell</p>
@@ -160,8 +160,9 @@ longPwd = check "Password needs to be at least six characters long"</p>
<p>```</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>
+<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>``` haskell</p>
@@ -175,15 +176,17 @@ showForm act mth frm =
<p>```</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>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>
<p>``` haskell</p>
@@ -200,23 +203,26 @@ Right (LoginData e p r) -&gt; writeBS "Success!"
<p>```</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>The final piece of the puzzle is the template in which the form needs to be rendered. As you can
-see, rendering the form--including potential validation error messages--is done by adding nothing
-but a single element to the template.</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>The final piece of the puzzle is the template in which the form needs to be
+rendered. As you can see, rendering the form--including potential validation
+error messages--is done by adding nothing but a single element to the template.</p>
<p>``` xml
<html>
@@ -235,9 +241,10 @@ but a single element to the template.</p>
</html>
```</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>
+<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>
View
1 blog/categories/heist/index.html
@@ -56,6 +56,7 @@
<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>
View
77 blog/categories/snap/atom.xml
@@ -4,7 +4,7 @@
<title><![CDATA[Category: Snap | Norm 2782]]></title>
<link href="http://norm2782.github.com/blog/categories/snap/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>
@@ -115,10 +115,10 @@ datatype:</p>
<p>```</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>
+<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>``` haskell</p>
@@ -160,8 +160,9 @@ longPwd = check "Password needs to be at least six characters long"</p>
<p>```</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>
+<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>``` haskell</p>
@@ -175,15 +176,17 @@ showForm act mth frm =
<p>```</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>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>
<p>``` haskell</p>
@@ -200,23 +203,26 @@ Right (LoginData e p r) -&gt; writeBS "Success!"
<p>```</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>The final piece of the puzzle is the template in which the form needs to be rendered. As you can
-see, rendering the form--including potential validation error messages--is done by adding nothing
-but a single element to the template.</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>The final piece of the puzzle is the template in which the form needs to be
+rendered. As you can see, rendering the form--including potential validation
+error messages--is done by adding nothing but a single element to the template.</p>
<p>``` xml
<html>
@@ -235,9 +241,10 @@ but a single element to the template.</p>
</html>
```</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>
+<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>
View
1 blog/categories/snap/index.html
@@ -56,6 +56,7 @@
<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>
View
1 index.html
@@ -58,6 +58,7 @@
<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>
View
10 sitemap.xml
@@ -2,14 +2,18 @@
<urlset xmlns='http://www.sitemaps.org/schemas/sitemap/0.9'>
<url>
<loc>http://norm2782.github.com/blog/2012/01/01/using-digestive-functors-with-heist/</loc>
- <lastmod>2012-01-02T11:02:47+01:00</lastmod>
+ <lastmod>2012-01-02T15:22:45+01:00</lastmod>
</url>
<url>
<loc>http://norm2782.github.com/blog/archives/</loc>
- <lastmod>2012-01-02T11:02:47+01:00</lastmod>
+ <lastmod>2012-01-02T15:22:45+01:00</lastmod>
</url>
<url>
<loc>http://norm2782.github.com/</loc>
- <lastmod>2012-01-02T11:02:47+01:00</lastmod>
+ <lastmod>2012-01-02T15:22:45+01:00</lastmod>
+ </url>
+ <url>
+ <loc>http://norm2782.github.com/snaplet-hdbc.html</loc>
+ <lastmod>2012-01-03T08:46:24+01:00</lastmod>
</url>
</urlset>
View
593 snaplet-hdbc.html
@@ -0,0 +1,593 @@
+
+<!DOCTYPE html>
+<!--[if IEMobile 7 ]><html class="no-js iem7"><![endif]-->
+<!--[if lt IE 9]><html class="no-js lte-ie8"><![endif]-->
+<!--[if (gt IE 8)|(gt IEMobile 7)|!(IEMobile)|!(IE)]><!--><html class="no-js" lang="en"><!--<![endif]-->
+<head>
+ <meta charset="utf-8">
+ <title>HDBC Snaplet Tutorial - Norm 2782</title>
+ <meta name="author" content="Jurriën Stutterheim">
+
+
+ <meta name="description" content="HDBC Snaplet Tutorial Jan 3rd, 2012 About the snaplet-hdbc library Many applications use a relational database for information storage. A popular &hellip;">
+
+
+ <!-- http://t.co/dKP3o1e -->
+ <meta name="HandheldFriendly" content="True">
+ <meta name="MobileOptimized" content="320">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+
+
+ <link rel="canonical" href="http://norm2782.github.com/snaplet-hdbc.html">
+ <link href="/favicon.png" rel="icon">
+ <link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css">
+ <script src="/javascripts/modernizr-2.0.js"></script>
+ <script src="/javascripts/ender.js"></script>
+ <script src="/javascripts/octopress.js" type="text/javascript"></script>
+ <link href="/atom.xml" rel="alternate" title="Norm 2782" type="application/atom+xml">
+ <!--Fonts from Google"s Web font directory at http://google.com/webfonts -->
+<link href="http://fonts.googleapis.com/css?family=PT+Serif:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css">
+<link href="http://fonts.googleapis.com/css?family=PT+Sans:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css">
+
+
+
+</head>
+
+<body >
+ <header role="banner"><hgroup>
+ <h1><a href="/">Norm 2782</a></h1>
+
+ <h2>Why are you here?</h2>
+
+</hgroup>
+
+</header>
+ <nav role="navigation"><ul class="subscription" data-subscription="rss">
+ <li><a href="/atom.xml" rel="subscribe-rss" title="subscribe via RSS">RSS</a></li>
+
+</ul>
+
+<form action="http://google.com/search" method="get">
+ <fieldset role="search">
+ <input type="hidden" name="q" value="site:norm2782.github.com" />
+ <input class="search" type="text" name="q" results="0" placeholder="Search"/>
+ </fieldset>
+</form>
+
+<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>
+
+</nav>
+ <div id="main">
+ <div id="content">
+ <div>
+<article role="article">
+
+ <header>
+ <h1 class="entry-title">HDBC Snaplet Tutorial</h1>
+ <p class="meta">
+
+
+
+
+
+
+
+
+
+
+
+<time datetime="2012-01-03T08:23:00+01:00" pubdate data-updated="true">Jan 3<span>rd</span>, 2012</time></p>
+ </header>
+
+ <h2>About the snaplet-hdbc library</h2>
+
+<p>Many applications use a relational database for information storage. A popular
+library, called HDBC, already exists to make this possible. The snaplet-hdbc
+library provides two snaplets to make it easier to integrate HDBC into your web
+application: <code>Snap.Snaplet.Auth.Backends.Hdbc</code> and <code>Snap.Snaplet.Hdbc</code>. The
+former serves as a backend for Snap&#8217;s own authentication snaplet, while the
+latter provides an abstraction over the plain HDBC functions. This tutorial
+assumes that you are familiar with writing your own snaplet. If you are not
+familiar with snaplets yet, please consider studying the
+<a href="http://snapframework.com/docs/tutorials/snaplets-tutorial">snaplet tutorial</a>
+first.</p>
+
+<p>In this tutorial we will write a small application that uses these two snaplets
+to interact with an SQLite database. The ideas presented here are implemented
+in <a href="https://github.com/norm2782/JCU">one of my applications</a>.</p>
+
+<h2>Installing</h2>
+
+<p>Installing the snaplet is easy: just do a <code>cabal install snaplet-hdbc</code> and
+you&#8217;re all set.</p>
+
+<h2>Literate Haskell</h2>
+
+<p>This tutorial is written in Literate Haskell, so we need to enable some
+extensions and define our imports first.</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>
+<span class='line-number'>3</span>
+<span class='line-number'>4</span>
+<span class='line-number'>5</span>
+<span class='line-number'>6</span>
+<span class='line-number'>7</span>
+<span class='line-number'>8</span>
+<span class='line-number'>9</span>
+<span class='line-number'>10</span>
+<span class='line-number'>11</span>
+<span class='line-number'>12</span>
+<span class='line-number'>13</span>
+<span class='line-number'>14</span>
+<span class='line-number'>15</span>
+<span class='line-number'>16</span>
+<span class='line-number'>17</span>
+<span class='line-number'>18</span>
+<span class='line-number'>19</span>
+<span class='line-number'>20</span>
+<span class='line-number'>21</span>
+<span class='line-number'>22</span>
+</pre></td><td class='code'><pre><code class='haskell'><span class='line'><span class="o">&gt;</span> <span class="cm">{-# LANGUAGE TemplateHaskell #-}</span>
+</span><span class='line'><span class="o">&gt;</span> <span class="cm">{-# LANGUAGE FlexibleInstances #-}</span>
+</span><span class='line'><span class="o">&gt;</span> <span class="cm">{-# LANGUAGE MultiParamTypeClasses #-}</span>
+</span><span class='line'><span class="o">&gt;</span> <span class="cm">{-# LANGUAGE OverloadedStrings #-}</span>
+</span><span class='line'><span class="o">&gt;</span>
+</span><span class='line'><span class="o">&gt;</span> <span class="kr">module</span> <span class="nn">Application</span> <span class="kr">where</span>
+</span><span class='line'><span class="o">&gt;</span>
+</span><span class='line'><span class="o">&gt;</span> <span class="kr">import</span> <span class="nn">Control.Monad</span>
+</span><span class='line'><span class="o">&gt;</span> <span class="kr">import</span> <span class="nn">Control.Monad.State</span>
+</span><span class='line'><span class="o">&gt;</span> <span class="kr">import</span> <span class="nn">Data.ByteString.Char8</span> <span class="p">(</span><span class="kt">ByteString</span><span class="p">)</span>
+</span><span class='line'><span class="o">&gt;</span> <span class="kr">import</span> <span class="k">qualified</span> <span class="nn">Data.ByteString.Char8</span> <span class="k">as</span> <span class="n">BS</span>
+</span><span class='line'><span class="o">&gt;</span> <span class="kr">import</span> <span class="nn">Data.Lens.Template</span>
+</span><span class='line'><span class="o">&gt;</span> <span class="kr">import</span> <span class="nn">Data.Maybe</span>
+</span><span class='line'><span class="o">&gt;</span> <span class="kr">import</span> <span class="nn">Data.String</span>
+</span><span class='line'><span class="o">&gt;</span> <span class="kr">import</span> <span class="nn">Database.HDBC.Sqlite3</span>
+</span><span class='line'><span class="o">&gt;</span> <span class="kr">import</span> <span class="nn">Snap.Core</span>
+</span><span class='line'><span class="o">&gt;</span> <span class="kr">import</span> <span class="nn">Snap.Snaplet</span>
+</span><span class='line'><span class="o">&gt;</span> <span class="kr">import</span> <span class="nn">Snap.Snaplet.Auth</span>
+</span><span class='line'><span class="o">&gt;</span> <span class="kr">import</span> <span class="nn">Snap.Snaplet.Auth.Backends.Hdbc</span>
+</span><span class='line'><span class="o">&gt;</span> <span class="kr">import</span> <span class="nn">Snap.Snaplet.Hdbc</span>
+</span><span class='line'><span class="o">&gt;</span> <span class="kr">import</span> <span class="nn">Snap.Snaplet.Session</span>
+</span><span class='line'><span class="o">&gt;</span> <span class="kr">import</span> <span class="nn">Snap.Snaplet.Session.Backends.CookieSession</span>
+</span></code></pre></td></tr></table></div></figure>
+
+
+<h2>Snaplet state</h2>
+
+<p>Our goal is to be able to authenticate against a database, remember the fact
+that we are logged in and then retrieve some information from the database.
+Before we can do so, we need to define our snaplet&#8217;s state and generate the
+corresponding lenses:</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>
+<span class='line-number'>3</span>
+<span class='line-number'>4</span>
+<span class='line-number'>5</span>
+<span class='line-number'>6</span>
+<span class='line-number'>7</span>
+<span class='line-number'>8</span>
+</pre></td><td class='code'><pre><code class='haskell'><span class='line'><span class="o">&gt;</span> <span class="kr">data</span> <span class="kt">App</span>
+</span><span class='line'><span class="o">&gt;</span> <span class="ow">=</span> <span class="kt">App</span>
+</span><span class='line'><span class="o">&gt;</span> <span class="p">{</span> <span class="n">_authLens</span> <span class="ow">::</span> <span class="kt">Snaplet</span> <span class="p">(</span><span class="kt">AuthManager</span> <span class="kt">App</span><span class="p">)</span>
+</span><span class='line'><span class="o">&gt;</span> <span class="p">,</span> <span class="n">_sessLens</span> <span class="ow">::</span> <span class="kt">Snaplet</span> <span class="kt">SessionManager</span>
+</span><span class='line'><span class="o">&gt;</span> <span class="p">,</span> <span class="n">_dbLens</span> <span class="ow">::</span> <span class="kt">Snaplet</span> <span class="p">(</span><span class="kt">HdbcSnaplet</span> <span class="kt">Connection</span> <span class="kt">IO</span><span class="p">)</span>
+</span><span class='line'><span class="o">&gt;</span> <span class="p">}</span>
+</span><span class='line'><span class="o">&gt;</span>
+</span><span class='line'><span class="o">&gt;</span> <span class="n">makeLens</span> <span class="sc">&#39;&#39;</span><span class="kt">App</span>
+</span></code></pre></td></tr></table></div></figure>
+
+
+<p>The <code>authLens</code> allows us to do the actual authentication, while the <code>sessLens</code>
+allows us to remember the result of the authentication attempt. As you might
+have guessed, the <code>dbLens</code> allows us to interact with the database. The
+<code>AuthManager</code>, <code>SessionManager</code> and <code>HdbcSnaplet</code> types are provided by the
+corresponding snaplets, while the <code>Connection</code> type is provided by HDBC. In
+this case, <code>Connection</code> represents a connection to our SQLite database.</p>
+
+<p>After having defined the application state, we can start writing our
+initialiser:</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>
+<span class='line-number'>3</span>
+<span class='line-number'>4</span>
+<span class='line-number'>5</span>
+<span class='line-number'>6</span>
+<span class='line-number'>7</span>
+<span class='line-number'>8</span>
+<span class='line-number'>9</span>
+<span class='line-number'>10</span>
+<span class='line-number'>11</span>
+</pre></td><td class='code'><pre><code class='haskell'><span class='line'><span class="o">&gt;</span> <span class="n">tutorialAppInit</span> <span class="ow">::</span> <span class="kt">SnapletInit</span> <span class="kt">App</span> <span class="kt">App</span>
+</span><span class='line'><span class="o">&gt;</span> <span class="n">tutorialAppInit</span> <span class="ow">=</span> <span class="n">makeSnaplet</span> <span class="s">&quot;snaplet-hdbc-tutorial&quot;</span>
+</span><span class='line'><span class="o">&gt;</span> <span class="s">&quot;A tutorial snaplet showing the use of snaplet-hdbc&quot;</span> <span class="kt">Nothing</span> <span class="o">$</span> <span class="kr">do</span>
+</span><span class='line'><span class="o">&gt;</span> <span class="n">addRoutes</span> <span class="p">[</span> <span class="p">(</span><span class="s">&quot;/some/:num&quot;</span><span class="p">,</span> <span class="n">someNumHandler</span><span class="p">)</span> <span class="p">]</span>
+</span><span class='line'><span class="o">&gt;</span> <span class="n">_sesslens&#39;</span> <span class="ow">&lt;-</span> <span class="n">nestSnaplet</span> <span class="s">&quot;session&quot;</span> <span class="n">sessLens</span> <span class="o">$</span> <span class="n">initCookieSessionManager</span>
+</span><span class='line'><span class="o">&gt;</span> <span class="s">&quot;config/site_key.txt&quot;</span> <span class="s">&quot;_session&quot;</span> <span class="kt">Nothing</span>
+</span><span class='line'><span class="o">&gt;</span> <span class="kr">let</span> <span class="n">sqli</span> <span class="ow">=</span> <span class="n">connectSqlite3</span> <span class="s">&quot;resources/tutorial.db&quot;</span>
+</span><span class='line'><span class="o">&gt;</span> <span class="n">_dblens&#39;</span> <span class="ow">&lt;-</span> <span class="n">nestSnaplet</span> <span class="s">&quot;hdbc&quot;</span> <span class="n">dbLens</span> <span class="o">$</span> <span class="n">hdbcInit</span> <span class="n">sqli</span>
+</span><span class='line'><span class="o">&gt;</span> <span class="n">_authlens&#39;</span> <span class="ow">&lt;-</span> <span class="n">nestSnaplet</span> <span class="s">&quot;auth&quot;</span> <span class="n">authLens</span> <span class="o">$</span> <span class="n">initHdbcAuthManager</span>
+</span><span class='line'><span class="o">&gt;</span> <span class="n">defAuthSettings</span> <span class="n">sessLens</span> <span class="n">sqli</span> <span class="n">defAuthTable</span> <span class="n">defQueries</span>
+</span><span class='line'><span class="o">&gt;</span> <span class="n">return</span> <span class="o">$</span> <span class="kt">App</span> <span class="n">_authlens&#39;</span> <span class="n">_sesslens&#39;</span> <span class="n">_dblens&#39;</span>
+</span></code></pre></td></tr></table></div></figure>
+
+
+<p>Many things are happening in this initialiser. First we define a route and a
+fallback handler, after which we initialise a session manager which stores the
+session information in a cookie. We then use the <code>connectSqlite3</code> function from
+HDBC to make a connection to the <code>tutorial.db</code> file locate in the <code>resources</code>
+directory, which sits in our project directory. This gives us a value of type
+<code>IO Connection</code> in <code>sqli</code>. We use this raw connection to initialise both the
+HDBC snaplet and the HDBC authentication snaplet, which happens on the
+following two lines.</p>
+
+<p>Initialising the HDBC snaplet is simple enough. We just pass the SQLite
+connection we obtained earlier to the initialiser and use to usual
+<code>nestSnaplet</code> function to nest the HDBC snaplet in our application snaplet. The
+HDBC authentication snaplet on the other hand, has several parameters. Lets go
+through them one by one:</p>
+
+<ul>
+<li><code>defAuthSettings</code> is exposed by the authentication snaplets and offers a
+default value of type <code>AuthSettings</code>, which contains information about your
+sessions.</li>
+<li><code>sessLens</code> is the session lens that has been generated by Template Haskell
+using the <code>makeLens</code> function.</li>
+<li><code>sqli</code> is the raw database connection we have defined earlier in the
+initialiser.</li>
+<li><code>defAuthTable</code> is exposed by the HDBC authentication snaplet and it
+provides a default set of column names for the table against you will
+authenticate. It is of type <code>AuthTable</code>.</li>
+<li><code>defQueries</code> is again exposed by the HDBC authentication snaplet and
+contains a default set of functions which generate the SQL queries the
+snaplet uses for the authentication process. Its type is <code>Queries</code>.</li>
+</ul>
+
+
+<p>By separating the column names from the actual queries, it becomes possible to
+support varying use-cases. In the simplest case, the application uses the
+default table layout and the default queries. When different column names are
+desired, one will only need to provide a custom value of type <code>AuthTable</code> and
+the queries will automatically use these new names. If completely custom
+queries are desired, one can easily override them by providing a custom value
+of type <code>Queries</code>. This allows for, e.g., using stored procedures for
+authentication. This tutorial will not cover authentication (that&#8217;s another
+tutorial), nor overriding the default queries. Please see the snaplet&#8217;s API
+documentation and code to learn how to do that.</p>
+
+<p>After all lenses are initialised, the <code>App</code> constructor is applied to all newly
+created lenses and the initialiser&#8217;s work is done.</p>
+
+<h2>Querying the database</h2>
+
+<p>Now that the snaplet is initialised, we can start querying our database.
+Amongst other functions, the HDBC snaplet offers the <code>query</code> and <code>query'</code>
+functions:</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>
+</pre></td><td class='code'><pre><code class='haskell'><span class='line'><span class="nf">query</span> <span class="ow">::</span> <span class="kt">HasHdbc</span> <span class="n">m</span> <span class="n">c</span> <span class="n">s</span> <span class="ow">=&gt;</span> <span class="kt">String</span> <span class="ow">-&gt;</span> <span class="p">[</span><span class="kt">SqlValue</span><span class="p">]</span> <span class="ow">-&gt;</span> <span class="n">m</span> <span class="p">[</span><span class="kt">Row</span><span class="p">]</span>
+</span><span class='line'><span class="nf">query&#39;</span> <span class="ow">::</span> <span class="kt">HasHdbc</span> <span class="n">m</span> <span class="n">c</span> <span class="n">s</span> <span class="ow">=&gt;</span> <span class="kt">String</span> <span class="ow">-&gt;</span> <span class="p">[</span><span class="kt">SqlValue</span><span class="p">]</span> <span class="ow">-&gt;</span> <span class="n">m</span> <span class="kt">Integer</span>
+</span></code></pre></td></tr></table></div></figure>
+
+
+<p>These functions make it easy to execute basic queries. The first one is
+intended to be used for <code>SELECT</code> queries. It takes a <code>String</code> with the query
+and a list of <code>SqlValue</code>s. The <code>SqlValue</code>s will be inserted on the places where
+there is have a <code>?</code> in the query. The result of the query is a list of <code>Row</code>s.
+A row is nothing more than a type synonym for a <code>Map</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>
+</pre></td><td class='code'><pre><code class='haskell'><span class='line'><span class="kr">type</span> <span class="kt">Row</span> <span class="ow">=</span> <span class="kt">Map</span> <span class="kt">String</span> <span class="kt">SqlValue</span>
+</span></code></pre></td></tr></table></div></figure>
+
+
+<p>The second one is intended to be used with any other type of query, usually
+the <code>INSERT</code>, <code>UPDATE</code> and <code>DELETE</code> queries.</p>
+
+<p>Now suppose we have some table containing messages, we can now define a
+function to retrieve them based on the value of some integer:</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>
+<span class='line-number'>3</span>
+<span class='line-number'>4</span>
+<span class='line-number'>5</span>
+<span class='line-number'>6</span>
+<span class='line-number'>7</span>
+<span class='line-number'>8</span>
+</pre></td><td class='code'><pre><code class='haskell'><span class='line'><span class="o">&gt;</span> <span class="kr">data</span> <span class="kt">Message</span> <span class="ow">=</span> <span class="kt">Message</span> <span class="kt">String</span> <span class="kr">deriving</span> <span class="kt">Show</span>
+</span><span class='line'><span class="o">&gt;</span>
+</span><span class='line'><span class="o">&gt;</span> <span class="n">getMessages</span> <span class="ow">::</span> <span class="kt">HasHdbc</span> <span class="n">m</span> <span class="n">c</span> <span class="n">s</span> <span class="ow">=&gt;</span> <span class="kt">ByteString</span> <span class="ow">-&gt;</span> <span class="n">m</span> <span class="p">[</span><span class="kt">Message</span><span class="p">]</span>
+</span><span class='line'><span class="o">&gt;</span> <span class="n">getMessages</span> <span class="n">n</span> <span class="ow">=</span> <span class="kr">do</span>
+</span><span class='line'><span class="o">&gt;</span> <span class="n">rows</span> <span class="ow">&lt;-</span> <span class="n">query</span> <span class="s">&quot;SELECT * FROM messages WHERE somenum = ?&quot;</span> <span class="p">[</span><span class="n">toSql</span> <span class="n">n</span><span class="p">]</span>
+</span><span class='line'><span class="o">&gt;</span> <span class="n">return</span> <span class="o">$</span> <span class="n">map</span> <span class="n">toMsg</span> <span class="n">rows</span>
+</span><span class='line'><span class="o">&gt;</span> <span class="kr">where</span> <span class="n">toMsg</span> <span class="ow">::</span> <span class="kt">Row</span> <span class="ow">-&gt;</span> <span class="kt">Message</span>
+</span><span class='line'><span class="o">&gt;</span> <span class="n">toMsg</span> <span class="ow">=</span> <span class="n">undefined</span>
+</span></code></pre></td></tr></table></div></figure>
+
+
+<p>Normally you would expect to apply this function in your application&#8217;s
+handlers, but these query functions are not of type <code>Handler</code>, nor are they of
+type <code>MonadSnap</code>! Instead, we expect our query to be executed in the context of
+the <code>HasHdbc</code> typeclass. What is that all about?</p>
+
+<h2>The HasHdbc typeclass</h2>
+
+<p>One of the goals when designing the HDBC snaplet was to separate the functions
+from the <code>Handler</code> monad, or any Snap-related monad, so that the same queries
+could also be run outside of a Snap context, for example in a command-line
+tool. This goal is accomplished by the <code>HasHdbc</code> class. Whenever we are in some
+monad and a corresponding connection for which this class is defined, we can
+use the functions provided by the snaplet. In order to be able to use the
+snaplet&#8217;s functions in our application handlers, we need to make sure that our
+application&#8217;s handlers become an instance of <code>HasHdbc</code>. Before we can do that,
+however, we need to understand the <code>HasHdbc</code> typeclass:</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>
+<span class='line-number'>3</span>
+<span class='line-number'>4</span>
+<span class='line-number'>5</span>
+<span class='line-number'>6</span>
+</pre></td><td class='code'><pre><code class='haskell'><span class='line'><span class="kr">class</span> <span class="p">(</span> <span class="kt">IConnection</span> <span class="n">c</span>
+</span><span class='line'> <span class="p">,</span> <span class="kt">ConnSrc</span> <span class="n">s</span>
+</span><span class='line'> <span class="p">,</span> <span class="kt">MonadCatchIO</span> <span class="n">m</span>
+</span><span class='line'> <span class="p">)</span>
+</span><span class='line'> <span class="ow">=&gt;</span> <span class="kt">HasHdbc</span> <span class="n">m</span> <span class="n">c</span> <span class="n">s</span> <span class="o">|</span> <span class="n">m</span> <span class="ow">-&gt;</span> <span class="n">c</span> <span class="n">s</span> <span class="kr">where</span>
+</span><span class='line'> <span class="n">getHdbcState</span> <span class="ow">::</span> <span class="n">m</span> <span class="p">(</span><span class="kt">HdbcSnaplet</span> <span class="n">c</span> <span class="n">s</span><span class="p">)</span>
+</span></code></pre></td></tr></table></div></figure>
+
+
+<p>Again there are many things happening on only three lines of code. First we see
+that the typeclass is parameterised by three type variables, <code>m</code>, <code>c</code> and <code>s</code>.
+The <code>m</code> is any monad for which there is a <code>MonadCatchIO</code> instance available.
+As it so happens, <code>Handler</code> has an instance for this out of the box. The second
+parameter needs to be some type for which we also have an instance of
+<code>IConnection</code>, which is a typeclass provided by HDBC. The <code>Connection</code> type we
+saw earlier is such a type. The <code>s</code> parameter needs to be something of type
+<code>ConnSrc</code>; some context from which we can get a new connection. By default, the
+snaplet provides <code>ConnSrc</code> instances for <code>IO</code> and <code>Pool</code> (from the
+<code>resource-pool</code> package; it offers resource pooling capabilities). Since our
+example state type defines <code>s</code> to be <code>IO</code>, we don&#8217;t have to worry about this
+parameter anymore. Finally, the functional dependency <code>m -&gt; c s</code> says: &#8220;if we
+know the type of <code>m</code>, we also know the corresponding types of <code>c</code> and <code>s</code>&#8221;. Or:
+&#8221;<code>m</code> uniquely determines <code>c</code> and <code>s</code>&#8221;. This is very powerful, because we can
+now do things with a connection, even if we only know in which monad we are.
+The downside is that we cannot use two different adapter types with our
+application handlers. The typeclass defines an expression <code>getHdbcState</code>, which
+only requires you to yield the snaplet&#8217;s state type in the context of monad <code>m</code>.</p>
+
+<p>Getting back to our application, we want to define an instance of <code>HasHdbc</code> for
+our application&#8217;s handlers and we want the <code>getHdbcState</code> expression to give us
+something of type <code>HdbcSnaplet Connection IO</code> in the context of these handlers.
+A common type for an application handler would be <code>Handler App App</code>. With that
+in mind, lets see what the <code>getHdbcState</code> type would look like if we were to
+instantiate the typeclass:</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>
+</pre></td><td class='code'><pre><code class='haskell'><span class='line'><span class="nf">getHdbcState</span> <span class="ow">::</span> <span class="kt">Handler</span> <span class="kt">App</span> <span class="kt">App</span> <span class="p">(</span><span class="kt">HdbcSnaplet</span> <span class="kt">Connection</span> <span class="kt">IO</span><span class="p">)</span>
+</span></code></pre></td></tr></table></div></figure>
+
+
+<p>It looks like we&#8217;re just defining a regular <code>Handler</code>, like we always do in our
+Snap applications, but where do we get an <code>HdbcSnaplet Connection IO</code>? It turns
+out that this is exactly the HDBC snaplet&#8217;s state type, so all we need to do is
+get the state from the snaplet using the <code>dbLens</code> and the state monad&#8217;s <code>get</code>
+function:</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>
+</pre></td><td class='code'><pre><code class='haskell'><span class='line'><span class="kr">instance</span> <span class="kt">HasHdbc</span> <span class="p">(</span><span class="kt">Handler</span> <span class="kt">App</span> <span class="kt">App</span><span class="p">)</span> <span class="kt">Connection</span> <span class="kt">IO</span> <span class="kr">where</span>
+</span><span class='line'> <span class="n">getHdbcState</span> <span class="ow">=</span> <span class="n">with</span> <span class="n">dbLens</span> <span class="n">get</span>
+</span></code></pre></td></tr></table></div></figure>
+
+
+<p>And we&#8217;re done! Now we can interact with the database in our handlers, using
+the functions provided by the HDBC snaplet.</p>
+
+<h2>Putting it all together</h2>
+
+<p>Now that we have all the basics, we can finally write a handler which interacts
+with the database. Lets create the <code>someNumHandler</code> from the example
+initialiser. It reads an integer from the URL and uses that integer to
+parameterise a database query:</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>
+<span class='line-number'>3</span>
+<span class='line-number'>4</span>
+<span class='line-number'>5</span>
+<span class='line-number'>6</span>
+</pre></td><td class='code'><pre><code class='haskell'><span class='line'><span class="o">&gt;</span> <span class="n">someNumHandler</span> <span class="ow">::</span> <span class="kt">Handler</span> <span class="kt">App</span> <span class="kt">App</span> <span class="nb">()</span>
+</span><span class='line'><span class="o">&gt;</span> <span class="n">someNumHandler</span> <span class="ow">=</span> <span class="kr">do</span>
+</span><span class='line'><span class="o">&gt;</span> <span class="n">mnum</span> <span class="ow">&lt;-</span> <span class="n">getParam</span> <span class="s">&quot;num&quot;</span>
+</span><span class='line'><span class="o">&gt;</span> <span class="kr">let</span> <span class="n">n</span> <span class="ow">=</span> <span class="n">fromMaybe</span> <span class="s">&quot;11&quot;</span> <span class="n">mnum</span>
+</span><span class='line'><span class="o">&gt;</span> <span class="n">msgs</span> <span class="ow">&lt;-</span> <span class="n">getMessages</span> <span class="n">n</span>
+</span><span class='line'><span class="o">&gt;</span> <span class="n">writeBS</span> <span class="o">.</span> <span class="kt">BS</span><span class="o">.</span><span class="n">pack</span> <span class="o">$</span> <span class="n">show</span> <span class="n">msgs</span>
+</span></code></pre></td></tr></table></div></figure>
+
+
+<p>Since <code>Handler</code> now has a <code>HasHdbc</code> instance, we can happily execute our
+queries from the context of our handlers.</p>
+
+<h2>Wrapping up</h2>
+
+<p>If you are already a bit more familiar with snaplets, you might have notices
+that the <code>HasHdbc</code> instance for <code>Handler</code> is not as general as it could be.
+Since our implementation of <code>getConnSrc</code> is only interested in the current
+snaplet&#8217;s state, we can leave the type of the first parameter to <code>Handler</code>
+variable. This gives us the instance:</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>
+</pre></td><td class='code'><pre><code class='haskell'><span class='line'><span class="o">&gt;</span> <span class="kr">instance</span> <span class="kt">HasHdbc</span> <span class="p">(</span><span class="kt">Handler</span> <span class="n">b</span> <span class="kt">App</span><span class="p">)</span> <span class="kt">Connection</span> <span class="kt">IO</span> <span class="kr">where</span>
+</span><span class='line'><span class="o">&gt;</span> <span class="n">getHdbcState</span> <span class="ow">=</span> <span class="n">with</span> <span class="n">dbLens</span> <span class="n">get</span>
+</span></code></pre></td></tr></table></div></figure>
+
+
+<p>That&#8217;s it! You can now write web applications, backed by an HDBC-supported
+database of your choosing.</p>
+
+<h2>Using <code>resource-pool</code></h2>
+
+<p>The snaplet comes with support for the <code>resource-pool</code> package built-in. If you
+wish to use it, change the type of the subsnaplet from</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>
+</pre></td><td class='code'><pre><code class='haskell'><span class='line'> <span class="p">,</span> <span class="n">_dbLens</span> <span class="ow">::</span> <span class="kt">Snaplet</span> <span class="p">(</span><span class="kt">HdbcSnaplet</span> <span class="kt">Connection</span> <span class="kt">IO</span><span class="p">)</span>
+</span></code></pre></td></tr></table></div></figure>
+
+
+<p>to</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>
+</pre></td><td class='code'><pre><code class='haskell'><span class='line'> <span class="p">,</span> <span class="n">_dbLens</span> <span class="ow">::</span> <span class="kt">Snaplet</span> <span class="p">(</span><span class="kt">HdbcSnaplet</span> <span class="kt">Connection</span> <span class="kt">Pool</span><span class="p">)</span>
+</span></code></pre></td></tr></table></div></figure>
+
+
+<p>and do not forget to import <code>Data.Pool</code>.</p>
+
+
+ <footer>
+ <p class="meta">
+
+
+
+
+
+
+
+
+
+
+
+
+
+<time datetime="2012-01-03T08:23:00+01:00" pubdate data-updated="true">Jan 3<span>rd</span>, 2012</time>
+
+ </p>
+
+ <div class="sharing">
+
+ <a href="http://twitter.com/share" class="twitter-share-button" data-url="http://norm2782.github.com/snaplet-hdbc.html" data-via="" data-counturl="http://norm2782.github.com/snaplet-hdbc.html" >Tweet</a>
+
+
+ <div class="g-plusone" data-size="medium"></div>
+
+
+</div>
+
+
+ </footer>
+
+</article>
+
+</div>
+
+<aside class="sidebar">
+
+ <section>
+ <h1>Recent Posts</h1>
+ <ul id="recent_posts">
+
+ <li class="post">
+ <a href="/blog/2012/01/01/using-digestive-functors-with-heist/">Using digestive-functors with Heist</a>
+ </li>
+
+ </ul>
+</section>
+
+<section>
+ <h1>Github Repos</h1>
+ <ul id="gh_repos">
+ <li class="loading">Status updating...</li>
+ </ul>
+
+ <a href="https://github.com/norm2782">@norm2782</a> on Github
+
+ <script type="text/javascript">
+ $.domReady(function(){
+ if (!window.jXHR){
+ var jxhr = document.createElement('script');
+ jxhr.type = 'text/javascript';
+ jxhr.src = '/javascripts/libs/jXHR.js';
+ var s = document.getElementsByTagName('script')[0];
+ s.parentNode.insertBefore(jxhr, s);
+ }
+
+ github.showRepos({
+ user: 'norm2782',
+ count: 0,
+ skip_forks: true,
+ target: '#gh_repos'
+ });
+ });
+ </script>
+ <script src="/javascripts/github.js" type="text/javascript"> </script>
+</section>
+
+
+
+
+<section class="googleplus">
+ <h1>
+ <a href="https://plus.google.com/112856651265635312533?rel=author">
+ <img src="http://www.google.com/images/icons/ui/gprofile_button-32.png" width="32" height="32">
+ Google+
+ </a>
+ </h1>
+</section>
+
+
+
+
+</aside>
+
+
+ </div>
+ </div>
+ <footer role="contentinfo"><p>
+ Copyright &copy; 2012 - Jurriën Stutterheim -
+ <span class="credit">Powered by <a href="http://octopress.org">Octopress</a></span>
+</p>
+
+</footer>
+
+
+
+
+
+
+ <script type="text/javascript">
+ (function() {
+ var script = document.createElement('script'); script.type = 'text/javascript'; script.async = true;
+ script.src = 'https://apis.google.com/js/plusone.js';
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(script, s);
+ })();
+ </script>
+
+
+
+ <script type="text/javascript">
+ (function(){
+ var twitterWidgets = document.createElement('script');
+ twitterWidgets.type = 'text/javascript';
+ twitterWidgets.async = true;
+ twitterWidgets.src = 'http://platform.twitter.com/widgets.js';
+ document.getElementsByTagName('head')[0].appendChild(twitterWidgets);
+ })();
+ </script>
+
+
+
+
+
+</body>
+</html>

0 comments on commit 6018835

Please sign in to comment.
Something went wrong with that request. Please try again.