A Haskell Failure Story

Posted on August 3, 2018

I like Haskell. I haven’t always like it. My road to Haskell was fraught with false starts and ignorant dismissals. I tried reading Learn You a Haskell back when it came out. I watched talks. I became comfortable with the opinion that Haskell was an impractical, academic language made from line-noise and elitist non-sense.

Who needs types? I thought. I had never had a type error go into production code with any language I had used. At least that’s what I thought then.

I started getting interested in Haskell again. A colleague of mine wouldn’t stop talking about it. And as I’ve done in the past to win an argument I decided to drop the gloves and seriously learn Haskell well enough to decide for myself, once and for all, that it was everything I thought it was.

A few months later I found myself changing my mind. I took an online course. I started reading Haskell from First Principles. I started writing tools for myself with it.

A couple of years later I decided to use Haskell as a prototyping language. My workplace is primarily a Javascript shop. I just didn’t want to deal with the typical Javascript problems while prototyping: chasing down senseless run-time type errors and the like. I was the only person assigned to the project so I decided, Why not?

Well about a month goes by. The prototype is solid. I’m planning on using it as a reference architecture and throwing the code away. I’d intended to ship the project in Javascript. We had lots of experience with the language on the team and the stakeholders were comfortable with it.

But then a different colleague of mine said, Why not just write it in Haskell?.

I wasn’t sure this was going to fly. Asking a company to adopt a new language is a difficult proposition. Asking them to adopt a language that has a reputation like Haskell’s is a long shot. A really, really long shot.

At this point I was starting to believe in Haskell. I was halfway through Haskell from First Principles. I did research into the success stories. I watched talks. I asked myself: why should I not use Haskell? I tried to talk myself out of it. But I couldn’t. It was too good an opportunity. It made sense for the project. I already had a prototype that, to be honest, was more polished than most production code I’d ever written in a dynamic language… and I didn’t write that much code.

I prepared my notes. I practiced my pitch to the stakeholders for several nights. I was a nervous wreck going into that meeting.

And it worked!

They liked my pitch. I was allowed to use Haskell. I was officially a professional Haskell programmer. I was shortly given a small budget to hire another Haskell developer. I was asked to train one of our developers internally. I was in charge of building the team that would deliver a super-important project to our company and I’d be doing it in Haskell.

It wasn’t all roses. Many people at company still thought this was a terrible idea. I was the only person at the company who knew any Haskell: why would I even think of suggesting we use it on a major project? People from outside the company at community meetups, when they found out, would ask: Why Haskell? Seriously?

So I spent the next few months rigorously defending my choice to use Haskell. My team mates that didn’t support the idea from day one were constantly casting their doubts at every meeting and in every channel. Every set back was a silent eye-roll and disapproving glare. It was an emotional battle to have to reinforce my beliefs that I made the right choice and fend off the feeling that my disapproving co-workers were waiting for me to fail.

Meanwhile I started putting the job postings up. People really liked my job posting. I got more applicants than I knew what to do with. I was asked to speak at a local university about my company’s adoption of Haskell. People in the community reached out to wish me luck. Many people in my local community were supportive and wished to see a local success story with Haskell.

Then a curve ball hit me square in the face. A month before an important call with the customer I find out that they’re expecting a full, 100% production-ready version fo the software to be completed. When my stakeholders agreed to do the project in Haskell I thought I’d have at least a year with some demos along the way. I broke out in a cold sweat.

No problem, I thought. This is Haskell. We may have been slow to start but things will pick up soon and you won’t be able to stop us. I just need to hire a few more people and polish up a few niggly bits in the API. It will be fine.

Have I mentioned that during the last few months I’ve only had few hours here and there to work on this project? Yeah, I’m the engineering manager at my company and still had two other teams to help run and a constant stream of activity from sales and operations to contend with.

No problem. I decided a while before that I was going to make this work. I spent my evenings and weekends working on this project. The demo came and the customer was not impressed. Sales promised them another progress demo in August. That got pushed back another month to September. I was barely sleeping.

Then… the project started stalling. We struggled for three sprints in a row to make forward progress. We made some. But it came slow and painfully. I’m still not sure what happened. But it seemed like every time I had an idea for an easy change to make it turned into a rabbit hole. We were refactoring poor decisions I made early on with the prototype when I wasn’t sure what I was doing. We had already been through a long refactor that cost us a lot of time to sort out. But no matter how I motivated the team or how much I pushed we couldn’t avoid the costs.

And sensing my worry that the next demo was looming and we were stalled for progress… one of my senior engineers pulled in with a prototype they whipped up over the weekend in Rails. It wasn’t at feature-parity with our code but his staggeringly quick progress, despite the trade offs of being in a dynamic language, were a no-brainer for the company.

When he brought it to me I couldn’t deny it. I was unimpressed at first but asked him to continue in his spare time and keep reporting to me. Then he came back with more a few days later. I was shocked. And happy for him.

But that was the nail in the coffin for my first Haskell project. I brought it up to the stakeholders, we all had a chat, and we agreed that the Haskell experiment was over. I had to let the people I hired go. I have to let the people I’m in the middle of hiring know we switched gears. I’m having to wind down several months of progress and hard work. It feels horrible.

Worse it feels like I let everyone down. All those people that wanted to see a Haskell success story from a small startup, including myself, were disappointed.