August 3, 2016

The declarative imperative

This is an adaptation of a talk that I gave a few times to graduates of the Flatiron School as part of Trello’s fellowship program.

This is a softer post than my “usual” fare. This post is not about a particular challenge or task; it’s about programming for the sake of programming. It’s a self-indulgent affair. You have been warned.

Keep reading…
March 9, 2016

A newcomer's run-in with lazy I/O

Look at this program:

main = do
  contents <- readFile "foo.txt"
  writeFile "foo.txt" ('a':contents)

What does it do?

Keep reading…
January 11, 2016

Applicative Functors for Good and Evil

This post started out as “Applicative Functors for Non-Haskell Developers.”

That was an ambitious title.

Instead, it’s turned out to be something more like “Applicative Functors for Curious Haskell Novices,” or, more accurately, “Applicative Functors for Ian Henry, Two Years Ago.” But that’s not as catchy.

Specifically, this post assumes the following prior Haskell knowledge:

Keep reading…
January 17, 2015

Decoding UTF-8 with Parser Combinators

We all know the absolute minimum every software developer must know about Unicode. We aren’t bad citizens of the internet, spreading malice and encoding errors willy-nilly around the world. We’re good people, just trying to get by.

But knowing the minimum is starting to bother us. And the more we think about UTF-8 and text encoding, the more we realize that we don’t “get it” at a messy, squishy level. We’ve read about it, sure, but we’ve never actually wrapped our hands around it and felt the blood pump through its veins.

So that’s what we’re going to do in this post: grab UTF-8 by the bytes and squeeze some real understanding out of it.

Keep reading…
May 4, 2014

If KVO is right, why does it feel so wrong?

Let’s do something extremely simple:

We’ve got a view controller, it has a user, the user’s got a username, and we want to show that in our navbar title. With an @ in front, because that’s what all the cool kids do these days. Simple, right?

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = [NSString stringWithFormat:@"@%@", self.user.username];
}

Yep! That’s all it takes. As long as the username never changes.

Keep reading…