Skip to content

Instantly share code, notes, and snippets.

@jameshaydon
Last active September 29, 2023 15:52
Show Gist options
  • Save jameshaydon/43a6521cb20e9135df09ea59524b7cd0 to your computer and use it in GitHub Desktop.
Save jameshaydon/43a6521cb20e9135df09ea59524b7cd0 to your computer and use it in GitHub Desktop.
Why (some) Python programmers don't choose Haskell

Why Python and not Haskell?

This thread asks why more Python developers couldn't instead be using Haskell: https://discourse.haskell.org/t/commercial-haskell-should-go-after-python-julia-not-rust/6964/2

One of the points made in this thread, is that there is a sizeable class of Python programmers for which the trope "Python programmers will be scared of monads!" doesn't apply. I thought I would ask some of the people I know that use Python why they don't use Haskell.

Some notes about the demographic:

  • These people all work as academic researchers in Computer Science, formal methods, ranging from very abstract to quite practical.
  • Two of them know more about Category Theory and monads than the vast majority of Haskellers.
  • They all would choose Python for their next project.

These opinions are not my own.

General themes:

  • Haskell just isn't very well known.
  • Python has so many libraries.
  • Python has good, beginner friendly tooling.
  • I am using Python and my collaborators are already using Python, would need a good reason to change.
  • Students can pick up Python very quickly.
  • With Python you (or a collaborator, or a student) can always "muddle through". With Haskell you may just get stuck.
  • Haskell seems "locked down" (types? purity is handcuffs? no imperative programming?)
  • Unfamiliarity with functional programming.
  • Haskell code in the wild looks very complicated compared to Python code in the wild.

Subject A

I know nothing about Haskell despite it being in my list of things to look at for ages 😅😅😅 But I think part of the answer is the same as "why do you use this messaging app instead of that one": it's what the community uses.

network effect?

I think it's a big part. Another could be inertia : "I'm in research/industry and I have a new project. I'm not going to change my workflow just for shits and giggles". So if a working professional has been using python, it's unlikely to change if they keep working in the same field. I think.

But I'll tell you that : I think imperative is easier then functional, and I think many people agree. And the fact that if you want, you can do a bit of functional un python just sweetens the pot.

Are you aware that you can program imperatively in Haskell?

No, I wasn't aware.

Subject B

I’m not a huge programmer but when I need to program something, I will most likely use python by default. The reasons:

  • it takes me 5 mins to have an environment working in Python and I can focus on programming. It would take me days to make it work in Haskell. I guess the reason is I’ve never worked on a small project without fancy features from scratch in Haskell.
  • I find functional languages hard to read. If I see a python program, in a few minutes I know what’s roughly the purpose, with functional languages I cannot (not just Haskell, but Scala too).

Maybe I am biased in the sense that I’ve seen a lot of simple Python programs written by non-specialists, but only complex projects made by professionals in Haskell/Scala. Basically: I need newbies to write more Haskell programs

Subject C

  • Everything just works: Installation, setting things up, getting general support.
  • there's a library to do pretty much anything and a million people who have solutions for any one of your questions Numpy, scipy, pandas, geopandas, any tool API, ...

Everything is available in Python. I can teach any student to write python in 15 minutes. With Haskell/Scala/... it will take me days to get there and most likely I'll encounter an issue where I'll need something that's not available or very inconvenient

Every programmer understands OO, I'd say < 30% understand functional to a level where they can be proficient.

In pretty much every (university) course I am aware of, people will learn procedural programming with OO as a next step. Functional, logic oriented, etc. are seen as special cases that are taught "on demand". I'm aware that functional is now trending for web dev, but usually you get into it after learning the imperative styles.

This also includes tutorials. There are lots of "intermediate level" people doing YouTube tutorials of certain intermediate level Python things. (Function references, generators, lambda expressions, decorators)

I'm yet to find any good video explaining currying or monads aimed at intermediate level programmers. It's either "follow these steps exactly" without proper explanation, or some deep dive stuff explaining the ins and outs using all the "big words".

@dpwiz
Copy link

dpwiz commented Jul 14, 2023

But Haskell is basically Python 5...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment