At what point should I give up on learning Haskell?

My biggest problem with Haskell right now is not so much the language itself – I love it!!! – but the interface with external libraries, like Dear ImGui, for example. There are inconsistencies with what should be an “Int” and a “Enum” in the typing that stops the compilation cold in its tracks.

I was told that the autogen tool that created the FFI between Haskell and ImGui is, in so many words, a bit janky, and fixing one problem may break others.

I would love to see problems like this resolved faster.

It would also help to see better documentation with the Haskell libraries as well. With examples. And better support for LLVM as well. Better support for ARM architectures would also be a clear win.

Basically, I want to be able to turn to Haskell in all places I normally would have to resort to using C++, Python, Ruby or even (ugh!!!) Rust. Why is not Haskell eating Rust’s lunch? Doing complex data structures in Rust is a real pain, having always to fight with its borrow checker or spraying “unsafe” all over the code. I want to focus on the problem I am trying to solve, not on making the compiler happy!!!

I will not be giving up on Haskell anytime soon, because Haskell allows me to think more mathematically than any other language I’ve used to this point. Not sure of OCaml or even Coq would be better… have not learned either yet, and I hope I don’t have to.

5 Likes

For me, Learn you a Haskell was the right introduction to Haskell. Then, I went over to Rosetta Code and tried implementing some of the tasks in Haskell.

It took me a few years to feel comfortable with Haskell. It’s been about 12 or 13 years now since I first started learning Haskell. I would say I’m pretty good at Haskell now, but I still use only a subset of it. I’ve tried and failed to understand arrows and lenses, so I just don’t use those features in my code, and I don’t use libraries that use those features in their API. I only just started using monad transformers this year.

The good news is that there is a useful subset of Haskell which is fairly small. But learning “the whole language” is something that takes a lifetime. (At least for someone like me, who only has a bachelor’s degree, and isn’t particularly mathematically inclined.)

Just don’t feel like you need to use every feature, because you don’t. Find a subset that works for you, and gradually expand it if you need/want to.

4 Likes

I’ve seen this sentiment many times before. People try to learn Haskell from LYAH and end up really liking the book even though it failed to teach them Haskell. They end up thinking it’s their fault for not understanding Haskell, that they are not smart enough or don’t have enough background knowledge for Haskell, or that Haskell is just too darn complicated.

I’m pretty sure that today there are other introductions to Haskell that would’ve worked better for you.

btw, if you’d like I can try to explain the basics of lenses. Hit me up if you’re interested.

6 Likes

This is very interesting. What’s your impression of the dynamic here? People want to learn Haskell; they see LYAH mentioned somewhere; it has a nice elephant and a friendly tone so they read it; it’s not actually a good beginner Haskell text, but it’s so friendly they blame themselves rather than the book?

2 Likes

That’s my impression at least, yes.

To give another anecdote, here’s an old thread about the experience of some people with LYAH. Even though the commenters are likely to be survivors, there are still some less than positive (detailed) experiences there.

2 Likes

I agree completely, gilmi. I have been surprised over the years at the amount of praise people give LYAH and how often it’s recommended given the number of stellar introductory resources we now have. Yet for some reason I had never considered the book itself playing a role in people dropping out of learning Haskell, but I do think that makes a lot of sense given the issues I believe the book has.

The first few parts of LYAH are good as a day one GHCi-as-a-calculator introduction, but it fails as an introduction to actually using Haskell as a programming language instead of just an expression evaluator, and I think that’s why many people think they just can’t learn the language. Not everyone who feels that way, but many.

5 Likes

I never rely on one book, but many books and other sources. LYAH? I poked around in there for examples, etc. One of the many references that I’ve used.

In my experience, actually doing a solid (not toy) project in a language is the best teacher, and Haskell is no exception.

My only wish is that I could focus on it far more than I have the actual time for. Haskell needs time. The way I look at Haskell is that it’s the German of programming languages. And German needs time too.

7 Likes

This probably isn’t the best advice since it’s very long, but I’ve found the (combined) Haskell WikiBooks book to be pretty good & thorough. I was already somewhat into Haskell when I started though, so it’s probably not that great of a beginner book, although I could see someone learning Haskell through it.

3 Likes

I got super frustrated and quit for about 3 weeks. Something (forget what it was) inspired me to get back to it and I rethought my approach. In short, I accepted, perhaps given my background, that it will take me longer to learn Haskell than it would a language like Python which I have never used but intuitively understand. So now if I use all my available study time for a week (which I have about 10 hrs per week) to thoroughly pick apart and fully understand something, say a code sample, I accept that. My frustration is gone (so far) and I’m retaining more.

I also have a number of books:

  • LYAH - I think left too much unexplained but I do refer to it as an additional source
  • Haskell from First Principles - got part of the way through it and have since been using as a reference and hope to finish it eventually.
  • Get Programming with Haskell - I’m currently following this book and think it is the right level for me. Combined with reading about its topics in other books I’m getting a lot out of it.
  • Haskell in Depth - is a too advanced for me at this point but I struggled through some of the examples in it and that was very helpful. Hopefully will finish in future.
6 Likes

Don’t give up. I struggled a lot too learning Haskell and had several pauses, sometimes as long as a year. But everytime I got back to it my understanding and intuition of the language got a little bit better. A game changer for me was taking a (long) detour and learning Elm. A beautiful language, much simpler than Haskell and helped me build a deeper understanding of the basic functional concepts. After that I got back to again and much of the stuff I had struggled with in Haskell suddenly made sense. :slightly_smiling_face: I highly recommend Elm as a language for learning FP.

4 Likes

One should try finding a mentor before giving up. Or a study group. Or TA, if you’re struggling with course material.

And have some project in mind to hammer at it with the newfound knowledge.

1 Like

I wonder why this thread is still active…

I have been thinking about starting a study group and would be happy to organize. Anyone interested?

3 Likes

I would so be interested!
Could it be arranged at a reasonable hour for Australia? GMT +10h (almost 9pm at the time of this posting).
Certainly isn’t the programmer stereotype, but interacting with other humans (or super-advanced AI bots) definitely helps me learn.

@odcameron I’m based in Perth and always happy to meet people if you (or anyone in a compatible timezone, really) are interested.

@odcameron @andreabedini

I’m in California. Looks like our only overlap is in your morning. Is that a possibility for you?

1 Like

Yes, I have replied in private with more details.

IMHO, if you want to write code fit for production use of the language (handling money, putting lives on the line, etc), a mentor is a must-have.

So you’ve decided to stay with Haskell…@odcameron, since you’re mathematically-educated (well, perhaps more that the rest of us on this thread), start with something from your studies that interests you:

  • you’ll be reusing your existing knowledge in Haskell;
  • like [most of] Haskell, mathematics is free of effects (side or otherwise), so a mathematical project should largely keep you away from those “more imperative” aspects of Haskell e.g. I/O;
  • For your initial prototypes, you can indulge a little in using Haskell’s most notable feature: it being non-strict, which makes dealing with potentially-infinite mathematical values just that bit easier.

Is it? I saw many Java devs dealing with production code without any mentor. Some of them handles money transaction code.