September 5, 2014
Emulating dependent types (and, more generally, advanced type-level programming) has been a hot topic in the Haskell community recently. Some incredible work has been done in this direction: GADTs, open and closed type families, singletons, etc. The plan is to copy even more features to the type level, like type classes and GADTs, and simplify the promotion of value-level functions.
On the other hand, there’s a good deal of scepticism around this idea. «If you want to program like in Agda, why don’t you program in Agda?»
July 30, 2014
Many Haskellers know and love the
bracket :: IO a -> (a -> IO b) -> (a -> IO c) -> IO c
In our volatile world
bracket provides a safe haven of certainty: the resource will be released, no matter what. However, there’s a catch. (Nice pun, huh?)
This article describes two observations about
bracket that are useful to keep in mind when writing concurrent Haskell code.
July 15, 2014
In mtl, the
ask method of the
MonadReader class will automatically «lift» itself to the topmost
ReaderT layer in the stack, which is very convenient, but only works as long as the topmost layer is the one you need. If you have multiple
ReaderTs in the stack, you often have to insert manual lifts.
Previously I described why a smarter automatic lifting mechanism is needed to build truly reusable pieces of monadic code without too much boilerplate.
In this article I show two ways to achieve a type-based lift (that is, a lift which takes into account the
ReaderT r), one relying on
IncoherentInstances, the other — on closed type families.
July 7, 2014
When I started writing an application that used persistent to interact with a MySQL database, I decided to put the whole application inside one big
SqlPersistM action, and run it once inside
main. (To make it clear, this is not a Yesod application; I simply use persistent as a standalone library.)
However, as I learned more about persistent and how it worked, it became clear that this was the wrong way to use persistent. Here’s why.
June 14, 2014
After I had published The problem with mtl, many people wondered what my proposed solution was. If you, like them, are impatient to find out, feel free to peek at the slides from my kievfprog talk, or directly at the code on github.
Still, I’ll continue this series at my own pace. Today we’ll look at two failed solutions to the problem described in the previous article.
June 11, 2014
This article starts a series in which I am going to publish my thoughts on and experience with different «extensible effects» approaches. This one in particular will explain the problem with the classic mtl approach that motivates us to explore extensible effects in the first place.
May 9, 2014
One of the first things that Haskell beginners usually notice is that Haskell has this somewhat unusual but attractive way of defining functions case-by-case:
foldr f z  = z foldr f z (x:xs) = f x (foldr f z xs)
It looks fun and math-y. The other way to do pattern matching,
case expressions, is much less advertized, probably because
case invokes associations with dirty old imperative programming. Here’s how the same function could be defined using
foldr f z l = case l of  -> z x:xs -> f x (foldr f z xs)
However, there are plenty of reasons to prefer
case to multiple function definition clauses.
April 24, 2014
Edward Kmett writes:
Ironically if I had to say anything from the traffic in my inbox and on #haskell about it, it is mostly the old guard who gets disgruntled by lens.
So let me try and explain why that is. I’ll go ahead and say this:
lens is unidiomatic Haskell.
By which I mean that
lens isn’t like any other library that we normally use. It doesn’t follow the conventions of Haskell APIs, on which I elaborate below.
April 21, 2014
Here’s a complete guide for setting up a wireless Samsung printer on Linux, where by “setting up” I mean making it connect to your wireless network.
It worked for me with Samsung ML-2165W on Debian GNU/Linux «jessie», but should work for other models and distributions, too.
April 20, 2014
At Signal Vine we have a JSON-based language for describing text messaging campaigns. We may design a better surface syntax for this language in the future, but the current one gets the job done and there are certain existing systems that depend on it.
Anyway, the problem with this language is that it is too easy to make mistakes — including errors in JSON syntax, structural errors (plugging an array where an object is expected), or name errors (making a typo in a field name).
So the first thing I did was write a validator for our JSON format.
March 13, 2014
An often asked Haskell question is how to find out a type of a locally defined function or expression.
Here’s a new one: use the typed holes feature of GHC 7.8+.
March 8, 2014
As we approach the 7.8 release of GHC, more and more people are running into problems with packages that use Alex and/or Happy for parsing.
March 5, 2014
In case you missed it, starting from version 1.18
cabal-install has awesome sandboxing capabilities. Here I share a couple of tricks that will make your sandboxing experience even better.
March 3, 2014
I’m glad to announce the 0.8 release of tasty, a modern Haskell testing framework.
February 8, 2014
I hate it when maintainers become unreachable. At the same time, I’m not immune to that myself (if nothing else, I could be hit by a bus tomorrow).
So I contacted a few people with a request to become backup maintainers (BM) for some of my more popular Haskell packages, and they kindly agreed.