RSSAmplifier

Blog

blog | jelv.is

My technical blog containing articles about programming languages, functional programming and general CS.

jelv.isRSS feed ↗10 posts

Latest posts

Writing Code To Be Read at a Glance

Code is read more than it is written, but it is skimmed more than it is read, so we should write code that is clear at a glance.

Complexity is Bad—as a Concept

I don't like talking about “compelxity” in software any more. People have radically different ideas of what “complexity” means, and “complexity” conflates several inherently distinct concepts.

Letting Experts Be Experts

Experts aren't just beginners with more knowledge, they operate in a fundamentally different way. How can we empower rather than hinder them?

By Looking

Years ago, I heard a stupid philosophy joke: a student taking an intro philosophy class asks the professor “but how do we know?”; then, when the professor gives an answer, the student asks “okay, but how do we know that ?” This keeps on going until eventually the professor gets fed up and says “by looking”. I gather this is absolutely not how philosophers actually think about epistemology, but…

Three Regimes for Resilience

A useful mental tool for designing resilient software: consider how the system will operate in three separate regimes : The happy path. Everything is handled automatically with no manual intervention needed. Small issues crop up requiring narrowly scoped —but not necessarily routine —human intervention. A large, unexpected issue crops up, affecting the entire system and requiring major , novel…

Debugging Haskell Type Errors

Fixing Haskell type errors can be hard . Learning how to understand and fix type errors was the first real obstacle I faced when I first picked up the language. I’ve seen the same tendency with every Haskell beginner I’ve taught. With a bit of experience, I got so used to the quirks of GHC’s typechecker and Haskell’s standard library that I could resolve most type errors intuitively. Most but not…

Structure your Errors

Recently, I’ve revisited how I represent errors in code. I’m working on a command-line tool used across multiple teams and I want to keep its error messages consistent and readable. As the codebase has grown, I’ve moved from ad hoc error strings throughout my code to a structured error type. I never want to see this in my software! Useful error messages need to: Contain the information and context…

Haskell, Monads and Purity

I believe the notion that Haskell uses “monads” to enforce purity is rather misleading. It has certainly caused quite a bit of confusion! It’s very much like saying we use “rings to do arithmetic”. We don’t! We use numbers, which just happen to form a ring with arithmetic operations. The important idea is the number , not the ring. You can—and most people do —do arithmetic without understanding or…

Lazy Dynamic Programming

Dynamic programming is a method for efficiently solving complex problems with overlapping subproblems, covered in any introductory algorithms course. It is usually presented in a staunchly imperative manner, explicitly reading from and modifying a mutable array—a method that doesn’t neatly translate to a functional language like Haskell. Happily, laziness provides a very natural way to express…

Generating Mazes with Inductive Graphs

A few years ago—back in high school—I spent a little while writing programs to automatically generate mazes. It was a fun exercise and helped me come to grips with recursion: the first time I implemented it (in Java), I couldn’t get the recursive version to work properly so ended up using a while loop with an explicit stack! Making random mazes is actually a really good programming exercise: it’s…