title = "ak3n.com"
theme = "theme"
+[taxonomies]
+ tag = 'tags'
+
[params]
- sitename = "ak3n.com"
+ sitename = "ak3n.com"
[markup]
[markup.highlight]
title: Implementations of the Handle pattern
date: 2021-01-31
draft: false
+tags: [haskell, backpack]
---
In ["Monad Transformers and Effects with Backpack"](https://blog.ocharles.org.uk/posts/2020-12-23-monad-transformers-and-effects-with-backpack.html) [@acid2](https://twitter.com/acid2) presented how to apply Backpack to monad transformers. There is a less-popular approach to deal with effects — [Handle](https://jaspervdj.be/posts/2018-03-08-handle-pattern.html) ([Service](https://www.schoolofhaskell.com/user/meiersi/the-service-pattern)) pattern. I recommend reading both posts at first since they answer many questions regarding the design decisions behind the Handle pattern (why `IO`, why not type classes, etc). In this post, I want to show different implementations of the Handle pattern and compare them. All examples described below are available [in this repository](https://sr.ht/~ak3n/handle-examples/).
title: Thoughts on Backpack, modules, and records
date: 2021-01-31
draft: false
+tags: [haskell, backpack, modules, records]
---
In ["Implementations of the Handle pattern"](/implementations-of-the-handle-pattern) I have explored how Backpack might be used for the Handle pattern. It helped me to take a better look at Backpack and reflect a bit on modules and records in Haskell.
{{ partial "header.html" . }}
+<p>Posts tagged "{{ .Title }}":</p>
+
<section>
<ul>
{{ range .Data.Pages.ByPublishDate.Reverse }}
<section class="blog-post">
<h1>{{ .Title }}</h1>
<div class="blog-post-subheader">
- {{ .Date.Format (.Site.Params.dateform | default "January 02, 2006") }}
+ <div>
+ {{ .Date.Format (.Site.Params.dateform | default "January 02, 2006") }}
+ </div>
+ <div>
+ {{ partial "tags.html" (.GetTerms "tags") }}
+ </div>
</div>
<div class="blog-post-content">
{{ partial "headline.html" .Content }}
--- /dev/null
+<ul class="tags">
+ {{ range . }}
+ <li><a href="{{ .Permalink }}">{{ .LinkTitle }}</a></li>
+ {{ end }}
+</ul>
\ No newline at end of file
visibility: hidden;
}
+.blog-post-subheader div {
+ display: inline-block;
+}
+
+ul.tags {
+ margin: 0;
+ padding: 0;
+ list-style-type: none;
+}
+
+ul.tags li {
+ display: inline;
+}
+
+ul.tags li:first-child:before {
+ content: "# ";
+}
+
+ul.tags li:last-child:after {
+ content: none;
+}
+
+ul.tags li:after {
+ content: ",";
+}
+
h1 {
font-style: normal;
font-size: 2rem;