Tech News
← Back to articles

Haskell, Reverse Polish Notation, and Parsing

read original related products more articles

My Side Quest into Haskell, Reverse Polish Notation, and Parsing

26 Jun, 2025

My Journey into Haskell: Building a Reverse Polish Notation Calculator Introduction: A Side Quest

In my attempt to get my first paycheck, aka get a job, I have led myself down a fascinating rabbit hole into functional programming, mathematical notation, and parsing theory. This is the story of how I discovered Haskell, tackled reverse Polish notation, and learned about monadic parsing along the way.

My journey began when my friend Jackson Slipock encouraged me to explore functional programming. After a quick Google search, I landed on Haskell as my first functional language. Around the same time, during a networking call about job opportunities, someone mentioned reverse Polish notation. The idea struck me: why not build a reverse Polish notation calculator in Haskell?

What could have been a simple weekend project became weeks of deep learning. This blog chronicles that journey, drawing heavily from Graham Hutton's excellent book Programming in Haskell, which I highly recommend. What you're reading is my attempt to learn something deeply, implement it myself, and then teach it to others.

From Imperative to Functional: A Mental Shift

Coming from a background in Python and C—languages I'm comfortable with after a couple years of experience—Haskell represented a fundamental shift in thinking. Both Python and C are imperative languages that share similar concepts: loops, mutable data, global state, and variables that can be modified. The transition between them never required a major mental adjustment.

Functional programming throws all of that out the window.

In Haskell, functions are mathematical abstractions. Given the same input, a function will always produce the same output. There are no global variables, and data is immutable once created. Instead of writing a series of statements that accomplish a task, functional programming encourages building expressions that naturally compose together.

... continue reading