Is haskell worth learning for me?

Hi everyone! I’ll go straight to the point so I don’t waste your time. I will first give my background

I don’t consider myself a “programmer”. I’ve only made some few toy programs for now. I have WASTED TONS of hours on finding my perfect programming language. I’ll find a language with a lot of features but It will have a bad performance, then I’ll find a language with a great performance and features but It will take ages to compile (I’m pointing on you Rust) then I’m find a language that compiles fast, has great performance but it’s bloated, annoying to use, write and read (Yes C++ I’m talking about you) and it general this whole situation pisses me off.

I find Haskell interesting! The syntax looks very readable (and keep in fact that I don’t even know what’s going on, lol) and the language is probably really fast. So here I am, I want to make a couple of questions. It will make a couple of them starting from the most important to the less import in case some people don’t want to answer to the last ones. I don’t know if anyone will answer but in any case, thanks a lot to everyone that will read this.

  1. Would you say that Haskell (once learned of course) is more easy and enjoyable to use than languages like Rust or C++ and do you need to write less or more code to do some basic stuff?
  2. How worse (I suppose it’s worse) the performance and the compilation times are compared to C/C++?
  3. What are the strong parts of Haskell compared to C++? For example, any useful feature that C++ doesn’t have like Rust’s pattern matching or modules etc.? To add on that, I also heard that C++ is a bad language to maintain a huge code base. What’s your thoughts on that? Is Haskell better on that?
  4. Are there any reasons that you wouldn’t recommend someone to learn and use Haskell?
1 Like

I don‘t think that it makes sense to compare C++ and Haskell. Also, if you are not a OS or game developer C++ is most probably not the right choice.

Apart of this, the right language for you depends on what you want to develop:

  • iOS apps -> Swift
  • Android apps -> Kotlin
  • Websites -> Ruby, Elixir, JavaScript…
  • game engines -> C++
  • operating systems -> C
  • Smart contracts -> Solidity, Haskell
2 Likes

I kinda search for a general purpose to do most stuff. Have you find Haskell enjoyable to work in things like Desktop apps, automation tools, scripts etc.?

There is an interesting study (PDF) by Hudak and Jones on the matter. Tl;dr: in the experiment, resulting Haskell code was way more concise than C++ (⅐ of C++):

2 Likes

Hello rempas!

“The whole things that I have wasted TONS of hours on is finding my perfect programming language.”

The painful truth is that there is no such thing as a perfect language. Each language has good parts and bad parts, as you have already discovered. Haskell has strengths and weaknesses, just like any other.

“The syntax looks very readable (and keep in fact that I don’t even know what’s going on, lol) and the language is probably really fast.”

Most people come to Haskell because they are curious about functional programming and monads. Haskell only does functional programming, unlike languages like F# and Common Lisp which also do procedural and object orientated programming, and the theory is that when you’re learning with a functional language like Haskell you can’t slip back into old procedural and object orientated habits. I can promise you that Haskell will make your regular programming better.

Haskell was originally a research language for researchers in Computer Science. It shows. Things that are hidden in languages like Python are put first and foremost - monoids, functors, monads, etc. A lot of people program in Haskell because they are trying to find out more about these things. But it makes simple things a bit more complex. The theory is that being able to access these things allows more abstractions and a more expressive language.

Haskell has an optimising compiler, like C++, and can be fast. It can also be treacly slow. Haskell is a lazy language, whereas C++ is an eager language. A lazy language means that you can create sequences which are large - even infinite data structures - and still process them. Many languages offer lazy processing - Haskell insists on it. The upshot is that you can drive the garbage collector nuts with large allocations of memory & this slows things down.

“Are there any reasons that you wouldn’t recommend someone to learn and use Haskell?”

You seem to like tinkering with languages. Learning Haskell is good for this. You will learn a lot.

It is not a language which is used much in business. Like a lot of people. there is a fundamental gap between the languages that I like and the languages that I use. I really like Haskell, various kinds of Lisp - I actually use VBA/Excel, R, Python, C#. If you are hobby programming, you can use what you like. In a commercial environment you will (sadly) encounter a lot of push-back. So, if you a looking to learn to code for a programming career then Haskell might be a poor choice. There are a lot of Haskell programmers chasing a few jobs.

“Would you say that Haskell (once learned of course) is more easy and enjoyable to use than languages like Rust or C++ and do you need to write less or more code to do some basic stuff?”

That depends so much on what you are doing,

For rapid Windows GUI programming, for example, C# in Visual Studio is hard to beat. You can create code very quickly and accurately.

For the fastest speed for desktop application, the correct language is C++. It’s what Microsoft uses, and they invented C#.

In Google the new language is called Go, together with the Gopher mascot. Go is slower than C++ in a straight line, but does better with threading.

For artificial intelligence and data processing, Python is the correct language. I use R for data processing at the moment, it is an excellent language for this. I am not a fan of obsessive Python-fanboys, who claim that Python is best for everything, but if I was starting over I would pick Python over R. Python is the more general language.

Alternatives to Haskell include F# (very similar, but simpler, runs in Visual Studio) and various Lisps (Clojure, Common Lisp, Scheme).

I hope this helps.

3 Likes

I would add SML or OCaml if you want elegant functional programming and rich types, but would like the more predictably performant eager evaluation and an easy escape hatch for mutable imperative programming.

2 Likes

That’s really interesting! However as this is almost 3 decades ago, I would like to see something more resent and something that also compares with other more modern Languages like Rust, Java, Python, Ruby etc. to kinda get an idea

I thinks you said everything! I still getting amazed by how much people try to help in such cases. Thanks a lot and have an amazing day/night!!!

For fun: 1 Problem, 16 Programming Languages (C++ vs Rust vs Haskell vs Python vs APL…)

1 Like