Reified dictionaries

- February 6, 2017

GADT allows us to reify a constraint as an explicit dictionary. With ConstraintKinds, we can further generalize this trick. In this post, I will explain how this trick works.

Read more

Avoid overlapping instances with closed type families

- February 5, 2017

Overlapping instances are one of the most controversial features in Haskell. Fortunately, there are many tricks that let us avoid overlapping instances. In this post, I will introduce one such trick which uses closed type families.

Read more

Context reduction

- February 2, 2017

Hello, Haskellers! Today I am going to explain what context reduction is and why it is necessary.

Read more

Simple benchmarking with GHCi

- February 1, 2017

GHCi has a lesser known option :set +s. When turned on, GHCi displays some stats for each expression evaluated.

Read more

Type-level insertion sort

- January 30, 2017

Multi-parameter type classes and functional dependencies made type-level programming possible. Back in 2000, Thomas Hallgren showed an implementation of insertion sort as an example of static computation using functional dependencies. The code has a strong resemblance to logic programming which looks bizarre to most functional programmers. In this post, I will show you a more “functional-style” implementation of insertion sort using closed type families.

Read more

…or you can find more in the archives.