Learning Haskell

A few years back, a colleague of mine commented to me that he really liked Haskell, and that he thought more developers should adopt functional programming in their work. At the time, I didn't really think much about it, since I work as an Android developer. For native Android development, the only real choices in programming languages are Java or Kotlin. Over the past few years though, I've watched functional programming concepts gain traction in Android development, especially with the rise of Jetpack Compose1, and as such I have slowly been adopting a more functional approach to my work. With that in mind, I thought it might be helpful to learn a functional programming language, and Haskell seems to come up quite frequently in searches on functional programming. As a big fan of strongly-typed langauges, it was immediately appealing to me.

When it comes to learning a new language, I'm always hesitant to build something I might actually care about later. I cringe when looking back at the first projects I've made in the various programming languages I've tried, so I wanted something to work on that I could basically throw away after the fact. For better or for worse, I thought it might be a good idea to work on old challenges from Advent of Code23. For the most part, it's been difficult though quite fun and extremely satisfying to come up with concise, elegant solutions to the problems, except where the solutions involve manipulating arrays in-place, for which I just switch over to Go. I know Haskell has mutable references and I should probably be using them as a learning exercise, but sometimes the frustration wins out and I just want to solve the challenge and move on. Gotta get those stars after all.

This has me thinking though. Haskell doesn't have a thriving job market. I find it hard to believe that will change anytime soon. It's also used to solve similar problems as other languages I already use and like, so I'm not exactly expanding my horizons into new problems to solve4. In fact, for some problems I feel like Haskell can lead to elegant solutions, though for others it makes the problem even harder to solve. Overall, I find myself constantly questioning my decision to learn Haskell, because aside from the fun and intellectual challenge, there doesn't seem to be much upside to it. Even if you consider that I am sharpening my skills as a developer, the skills and techniques I learn will have to be used sparingly, because what good will it do me to write concise, elegant code if none of my coworkers can confidently iterate on it because it's so terse and hard to wrap their heads around?

Still, I don't want to give up on Haskell. There is still plenty for me to learn about functional programming, and after I've beaten my head against the wall for a few hours and slept on it, I can usually find a solution that works and then I can clean it up a bit to make it something I'm happy with. The satisfaction of that feeling is probably part of what keeps me coming back to Haskell, along with the novelty of feeling like a junior developer all over again, warts and all. If I'm being entirely honest with myself though, it's hard to justify the effort put into getting a working Haskell program when I can just bust it out in Go in a fraction of the time. In the end, I think I'd rather spend my time working with a language that will open up new doors in software development to me, like C, C++, Zig, Rust, etc.

Am I saying Haskell is a terrible language and no one should bother learning it? Absolutely not. It would probably benefit software engineering as a whole if everyone dove into at least one functional programming language once in a while. But I'm also not going to become a Haskeller myself, because I don't think that going from extreme imperative programming to extreme functional programming is necessarily better. I'm going to settle in here on the fence and say that taking tools and techniques from both sides is probably the best approach, and so it's good to be familiar with both sides. If you're a Haskeller for life, I'm happy for you! If you've never touched Haskell, I think it's at least worth taking a quick look at to understand how it's different.


  1. Jetpack Compose is Google's declarative UI framework for native Android app development. ↩

  2. https://adventofcode.com/ ↩

  3. Was this a good idea? Probably not. Would I recommend it to others learning new languages? Also no. Would I recommend it to people who are just looking to write some code in a language they're already familiar with? Absolutely! ↩

  4. There are actually a lot of problems Haskell is probably better suited to solving than languages I already know and use. The problem is, they're not problems I'm particularly interested in, like problems related to mathematics. Interesting stuff for sure, but not for me. ↩