Last November at the Haskell eXchange conference, Simon Peyton Jones announced the Haskell Foundation. This can be understood as many things: an organization dedicated to the hard work of making Haskell more successful and useful, a touchpoint for different parts of the Haskell community to come together and cooperate, and a focus knob to direct general support (financial and otherwise) for the Haskell community and maximize its impact.

SPJ Announcing the Haskell Foundation

I recently decided to become a major contributor to the Haskell Foundation, and I’m writing about the reasons behind my decision. I also hope to encourage others who can easily do so…

I have always loved finding those parts of mathematics where big ideas just pop out almost by accident, appearing fully formed in a surprising and delightful way. Who, for example, could fail to marvel at how topology manages to capture so many unique and striking meanings into words like continuous which can mean very different things just by choosing a different topology in which to interpret the same definition?

Something like this happens in categories by considering limits and colimits. One simply draws a simple picture, follows a simple set of rules, and important ideas pop out. …

Here are two theorems from game theory, which initially seem to contradict each other. By comparing them, we can uncover some hidden nuance in the situation.

Gibbard and Roth face off!

Gibbard’s Theorem: Strategy is Inevitable

The first theorem, initially by Allan Gibbard and generalized by later work by Gibbard and others, showed that any collective decision-making process must have one of three properties:

  1. There are only two possible outcomes.
  2. There is a dictator, who can choose the outcome regardless of any choices made by anyone else.
  3. It is strategic, meaning that the best way to get what you want depends not just on your preferred outcome but also on…


In this article, we’ll develop a Haskell library for continued fractions. Continued fractions are a different representation for real numbers, besides the fractions and decimals we all learned about in grade school. In the process, we’ll build correct and performant software using ideas that are central to the Haskell programming language community: equational reasoning, property testing, and term rewriting.

I posted an early version of this article to Reddit, and I’m grateful to those who responded with insight and questions that helped me complete this journey, especially iggybibi and lpsmith.

Introduction to continued fractions

Let’s start with a challenge. Assume I know how to…

This is the story of an interesting flight of fancy with mathematics. I found it intriguing, and hope you do, as well.

The question

Here’s a fact that comes up in high school mathematics: you can demote multiplication into addition by using logarithms. That is:

That is, you can compute the log of a product, given only the logs of the factors.

To students today, this might seem like just another algebraic identity. But in the age before calculators, it was actually the main reason for a typical high school student to be interested in logarithms at all! Multiplication is more difficult…

Quadratic expressions are the first category of non-linear expressions that algebra students typically study in detail. How do you motivate quadratics as an interesting object of study?

There are a few answers to this question. For example:

  • Khan Academy starts with parabolas. After a hint that the shape of a parabola has to do with ballistics and the path of a thrown object, they go on to describe the shape of the graph in detail, including the vertex, the axis of symmetry, and the x and y intercepts.
  • EngageNY starts with algebraic techniques. Specifically, it is concerned with distributing and…

I’ve made another change to make the CodeWorld environment more useful for general Haskell programming.


Here is the calculator from

Here is the calculator running inside CodeWorld:

You can also use Miso from CodeWorld:

You can even build your own HTML with ghcjs-dom, jsaddle, or even just the JavaScript FFI. For example, here’s how you can incorporate the diagrams library into CodeWorld:

I’d love to add anything else that’s useful. The framework must be usable in an otherwise blank page, so frameworks that expect lost of preexisting HTML, CSS, images, etc. won’t work out so well. If you would…

This is the story of a question I’ve been pondering off and on for about a decade now. I’m writing this down mostly because it makes for some enjoyable pondering, but it would be nice if someone has an interesting answer that I’ve missed.


For the purposes of this post, when I say “graph”, I’m going to mean a finite directed graph, which is allowed to have multiple parallel edges and self-loops (edges from a vertex back to itself). …

In this post, I show how you can use Haskell and the ad package (automatic differentiation) to build a toy machine learning model in Haskell. I’ve tried to write enough that someone without a machine learning background can follow the code. If you do have an ML background, just skim those parts!

I’m going to try something different. Instead of writing in Medium, I’ve written up this post in comments inside of CodeWorld.

Part 1: Model Structure

In this part, I explain what a machine learning model is, define the Haskell types for the parts of the model, and write the code to make…

Lately, I’ve been thinking more about beefing up CodeWorld as an easy playground for sharing running Haskell code examples. The platform makes it easy to write Haskell code in any web browser without setting up anything on your machine, and to share this code by a unique URL through any medium such as Twitter, IRC, etc. and make it easy for others to tinker with them in turn.

To further this goal, I am formalizing the list of Haskell packages that I can guarantee to be available in the environment. The current list is available here.

My question: What else…

Chris Smith

Software engineer at Facebook, volunteer math and computer science teacher, author of the CodeWorld platform, amateur ring theorist, and Haskell enthusiast.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store