• posts projects
    • February 05, 2021
    • 5 minutes
    • Haskell
    • Programming
    Programming Problem: Run-Length Encoding

    This is just a quick post about a programming problem that’s been circulating around on twitter recently:

    • January 10, 2021
    • 13 minutes
    • Haskell
    • Compiler
    Making an IO

    Recently I’ve been wrapping up my work on a compiler for a subset of Haskell. While my subset doesn’t (yet) have any support for IO, I’ve been thinking about how to implement it.

    • December 31, 2020
    • 8 minutes
    • Haskell
    • Category Theory
    (Basic) Universal Properties in Haskell

    This is a post going over the basic concept of defining objects through Universal Properties, in Category Theory, with explanations and examples in Haskell.

    • December 28, 2020
    • 67 minutes
    • Haskell
    • Programming Languages
    • Compiler
    (Haskell in Haskell) 3. Parsing

    This is the third post in the Haskell in Haskell series.

    In this post, we’ll go over creating a parser for our subset of Haskell. This stage of the compiler is responsible for taking the tokens that our lexer produced in the previous part.

    • December 10, 2020
    • 61 minutes
    • Haskell
    • Programming Languages
    • Compiler
    (Haskell in Haskell) 2. Lexing

    This is the second post in the Haskell in Haskell series.

    In this post, we’ll go over creating a lexer for our subset of Haskell. This stage of the compiler goes from the raw characters in our a source file, to a more structured stream of tokens.

    We’ll finally be digging into some serious code this time, so get your editor ready if you’re following along!

    • December 07, 2020
    • 7 minutes
    • Algebra
    • Haskell
    • Category Theory
    (Un)fold as (Co)algebra

    One cool thing about lists is that they have canonical ways of consuming and producing them: folds, and unfolds. It turns out that these are canonical, in that folding and unfolding functions are themselves isomorphic to lists. In this post, we’ll explore why this is true.

    • November 23, 2020
    • 19 minutes
    • Haskell
    • Programming Languages
    • Compiler
    (Haskell in Haskell) 1. Setup

    This is the first “real” post in the Haskell in Haskell series.

    In this post we’ll go over setting up a basic project in Haskell. We’ll be building our compiler on top of this foundation in the next posts.

    • November 01, 2020
    • 13 minutes
    • Haskell
    • Programming Languages
    • Compiler
    (Haskell in Haskell) 0. Introduction

    This is an introduction to a series I’m calling Haskell in Haskell. The goal of this series of posts is to go through the implementation of a subset of the Haskell language, from parsing, to typechecking, to code generation, using Haskell itself.

    • October 22, 2020
    • 1 minute
    • Haskell
    • Programming Languages
    • Parsing
    • Compiler
    Haskell in Haskell

    This is a series I’m writing about implementing a compiler for a subset of Haskell, using nothing else than Haskell itself! We’ll go through the whole process, going from a file containing Haskell code to generating C that we can compile into a functional executable. I’ve only just started working on the series, so stay tuned for new posts as they come along: I’ll update this page whenever they arrive.

    • October 18, 2020
    • 12 minutes
    • Haskell
    • Programming Languages
    Lexer Combinators

    When you write a parser in Haskell, you want to use parser combinators. When you write a lexer, you should use lexer combinators! We’ll see what these are, and how to use them to write a simple lexer.

    • September 09, 2020
    • 10 minutes
    • Math
    • Category Theory
    • Haskell
    Recursive Types as Initial Algebras

    Recently (well, more like a month ago), I came across this interesting observation: In my head, I immediately jumped to the notion of Algebras in Category Theory. I had recently studied that notion, found it quite interesting, and was very happy to see this observation, because it was actually quite obvious to me thanks to what I’d recently learned. The goal of this post is to unpack that tweet, and then explain why that observation is true.

    • August 30, 2020
    • 17 minutes
    • Math
    • Category Theory
    • Haskell
    Encoding the Naturals

    In this post, we’ll cover 3 ways I know of encoding the natural numbers $\mathbb{N}$ in your standard functional language with recursive types and polymorphism. At least, these are the 3 most generalized ways of doing it. As we’ll see, some common encodings are just specific cases of a more general encoding. Prerequisites Some familiarity with defining data types in a functional-esque language might be helpful, but shouldn’t be strictly necessary.