FP Complete

Announcing: the new unliftio library

For the past few years, Francesco Mazzoli and I have discussed issues around monad transformers—and the need to run their actions in IO—on a fairly regular basis. I wrote the monad-unlift library a while ago to try and address these concerns. But recent work I did in Stack on the extensible snapshots branch demonstrated some […]

Stack’s New Extensible Snapshots

NOTE This blog post made the rounds last week before the branch was actually merged and the post was still on a review server. I’m officially publishing it as the pull request is now merged. There is a collection of features in Stack that have been added in bit by bit, as opposed to being […]

Iterators and Streams in Rust and Haskell

Streaming data is a problem domain I’ve played with a lot in Haskell. In Haskell, the closest we come to built-in streaming data support is laziness-by-default, which doesn’t fully capture streaming data. (I’m not going into those details today, but if you want to understand this better, there’s plenty of information in the conduit tutorial.) […]

A Tale of Two Brackets

This is a debugging story told completely out of order. In order to understand the ultimate bug, why it seemed to occur arbitrarily, and the ultimate resolution, there’s lots of backstory to cover. If you’re already deeply familiar with the inner workings of the monad-control package, you can probably look at a demonstration of the […]

Understanding ResourceT

This blog post came out of two unrelated sets of questions I received last week about usage of the resourcet library. For those unfamiliar with it, the library is often used in combination with the Conduit streaming data library; basically every conduit tutorial will quickly jump into usage of the resourcet library. Instead of just […]

The ReaderT Design Pattern

Often times I’ll receive or read questions online about “design patterns” in Haskell. A common response is that Haskell doesn’t have them. What many languages address via patterns, in Haskell we address via language features (like built-in immutability, lambdas, laziness, etc). However, I believe there is still room for some high-level guidance on structuring programs, […]

What pure functional programming is all about: Part 2

In the last post, we covered the following: What purity is and what it isn’t. We looked at functions and function composition. We’ve looked at how reasoning is easier if you only have functions. In this post, we’ll explore: SQL as a pure language, which is a familiar language to almost everybody. How pure languages […]

What pure functional programming is all about: Part 1

This is a technical post series about pure functional programming. The intended audience is general programmers who are familiar with closures and some functional programming. We’re going to be seeing how pure functional programming differs from regular “functional programming”, in a significant way. We’re going to be looking at a little language theory, type theory, […]

Your CI build process should be in your code repository

It’s always been clear to developers that a project’s source code and how to build that source code are inextricably linked. After all, we’ve been including Makefiles (and, more recently, declarative build specifications like pom.xml for Maven and stack.yaml for Haskell Stack) with our source code since time immemorial (well, 1976). What has been less […]

Partial patterns in do blocks: let vs return

This blog post is about a pattern (pun not intended) I’ve used in my code for a while, and haven’t seen discussed explicitly. A prime example is when doing simplistic parsing using the functions in Data.Text.Read. (And yes, this is a contrived example, and using parsec or attoparsec would be far better.) Full versions of […]