Programming || math

A software engineer's ramblings


Algebraic Types

I’m a math nerd. I’m also a language nerd - both for programming languages and for natural languages.

Read More

The Nature of Promises (Haskell version)

This post is a followup to the previous post, which tried to illustrate that JavaScript Promises are an instance of a common interface that comes up in programming, called “monads”. In this post, I want to introduce some basic Haskell, talk a bit more about what it means to be a monad[^trap], and show some of the ideas that were briefly mentioned in the last post.

Read More

The Nature of Promises

I want to take you down the journey I went down when I initially learned about JavaScript Promises for work. This post was originally supposed to be an homage to “You Could Have Invented Monads” because I found it enlightening when I taught myself Haskell. However, I’ve convinced multiple teams (at multiple jobs) that some of our headaches would go away if we started using Promises, and I’ve given some presentations on the subject. I’ve written tens of thousands of lines of code in Promise-using applications. So I’d say I’m relatively familiar with them and the problems they solve at this point, and this post sort of evolved into half “why callbacks suck, and how Promises are better” and half “why Promises are as nice as they are - and what else is that nice”. So without further ado…

Read More