At what point should I give up on learning Haskell?

As a beginner, I’m really struggling with my Haskell relationship. Please read this as a strong encouragement towards making Haskell more accessible, and a discouragement from extending the features of the language.

I have been dabbling with Haskell on and off for 9years, reading the usual intro books, trying to use it for simple tasks like basic data analysis, … It was the language of my COMP101 course, my first ever taste of programmin. Ever since I have been captivated by the promises of its superiority - advantages of academic influence, mathematical congruence (I am a maths major), fast to write, conceptually natural (???), safety checks/guarantees, bug limiting… not to mention beautiful syntax (this one I finally agree with)!!!

However, despite being “faster to write” for experts, it seems awfully hard to get to any level of productivity. There are so many features of the language to get your head around, to name a few:
the concept of type classes and all the instances such as monads, along with at least 100 of their attributes (<*>, >>=, fmap, compare, …)
algebraic data type definitions, data constructors
type instances, type synonyms, type constructors, kinds, patterns, currying,
so many different syntactic features (operator precedence, )
The reported “productivity advantage” needs to account for the time to learn, and it seems like you need to be solid on all of these things until you can even start to understand the documentation.
But how can you get solid on all these things? You need to be able to write code, interesting code, for useful/meaningful things. But how can you do this without accessible documentation?

I am starting to wonder if it the language is just too complex to be worth the effort. I am losing heart.

I’m not sure what the way forward here is, but something needs to change. There is certainly a shortage of accessible walk-through documentation for simple modules or simple tasks…

It just seems like the community is far too focused on making more ego-inflating advanced features, and not focused enough on teaching it to others so they can share its advantages.

There is no point in baking a cake if nobody is going to eat it.

10 Likes

I feel you. We are not quite there yet for a great beginner experience. I am optimistic though because I see that there are many people currently making effort to make things more approachable. I think we keep pushing as a community and I see a lot of improvements as time goes by.

It is also important to note that:

  • The bar to Haskell productivity is lower than portrayed by social media
  • There are quite a few hands-on tutorials out there already that can help figuring out how to actually write Haskell.
  • Practice is pretty much the only way to solidify the knowledge gained by learning resources. It’s a good idea to pick a small project or extend/fix an existing one and give it a try and ask questions if you need to.
  • The community can help. If there’s a particular thing you want to do, or a specific tutorial you want to read, feel free to ask, maybe it already exist, maybe someone will use it as an opportunity to write something, or improve certain documentation.

I wish you success in whatever you choose to do. Feel free to ask more questions and consult the community when you need to.

13 Likes

My advice is to pick a single book such as HPFFP at haskellbook.com and work through it. Do all the exercises. If you get stuck, ask for help, here or somewhere else e.g. the fp chat slack.

It sounds like you are getting lost in all the “stuff” that is out there. What you need is a guide to show you what you need to learn, in what order you need to learn it. Once I finished working through HPFFP, I was able to generally understand the various libraries that I needed to use.

You’re quite right, there is a ton of stuff to learn in Haskell. And since it is a “research” language, lots of new things are being added (and perhaps not all are good ideas! Only time time will tell). The trick is to not worry about most of it and just focus on what is in front of you, and once you have mastered that, move on to the next topic.

I struggled with Haskell for years. Personally, I think it was worth it!

3 Likes

Since you already have some background knowledge I would try to apply it to a domain
you are passionate about. eg. web apps, databases, compilers, games, etc.

The ecosystem is very rich and trying to understanding a significant portion of it before being productive is not feasible. Better to put what you have learnt so far into practice. Some of us learn better by working with many concrete examples first, which helps us understand the abstraction/programming pattern.

As you iterate with reading/learning/coding you will get more productive and continue to learn and experience the joy of discovery & creation. If you can get a Haskell job, nothing beats the immersion of the learning+earning model.

4 Likes

I would suggest to concentrate on simple haskell https://www.simplehaskell.org/ – and try to write some small project using it. You simply need to get your hands dirty with the language usage before you can master it. You can not learn programming by just reading books. You need to practice your art.
And do not beat yourself while learning it. Haskell is swiss-army knife of functional programming so indeed its provided tools options may be overwhelming but you need to keep in mind that you may not need to use all the provided tools. Just those useful for your task. Hence simple haskell recommendation.

3 Likes

It takes a long time to learn to write good programs in any language.

Learning all Haskell features may not be necessary.

Learning a language is easier if you write some programs you can use, while reading books / articles / documentation.

To answer your question, it may help to compare learning a language with learning to play a musical instrument.

Why not consider:

  1. why were you interested in the language. What were your goals
  2. how much effort you put in
  3. is the result worth the effort
  4. are you still interested

Provided there are no obligations, I switch to another pastime soon after I lose interest in something.

6 Likes

Re: Ego-inflating features

I think it’s fine for those to explore these unknown territories to see if something beautiful will come out of it, so I don’t see it as ego-inflating. Personally, I’m quite excited with the research on effect systems despite most cases it’s deemed as overkill, and despite me not fully understanding it (yet, one day :slight_smile: ). After all, with all this, that’s how the entire language came about, and a lot of the simple features in Haskell were once regarded as bleeding edge at one point. It just might seem like the case because there aren’t enough posts on normal/simple/boring Haskell on the forums (there should be more!). To add, if you’re not sure what advantages these advanced/fancy features might bring, it’s most likely too early to learn them still. Hence why they aren’t documented that well, so just ignore them. For now, learn and do Haskell the boring way.

Although I agree that documentation is definitely one of the sore spots of Haskell, at least with my experience while learning it. I think it’s one of the points the Haskell Foundation is trying to address.

4 Likes

At what point should I give up on learning Haskell?

Short answer: instead of focusing on learning the language, focus on learning the concepts the language makes use of:

  • purity
  • “typefullness”
  • abstraction
  • laziness (or non-strictness)

Long answer: If, like most of us, you have a background in imperative programming (and languages), you’ve been able to transfer your existing skills without much trouble…then you encounter Haskell!

But this ability to transfer skills also applies to languages like Haskell - once you have a grasp of the basics, switching to e.g. Clean, Frege, Eta, et al is made much simpler. So, instead of trying to do that with Haskell and its ever-growing suite of extensions, use the smallest language with those features [you’re interested in].

Fortunately, one such small language is experiencing something of a renaissance - Miranda®:

  • it’s a small download and can be up and running relatively quickly;
  • it supports those aforementioned concepts these languages have in common.
  • no monads!
1 Like

I tried, on and off, learning Haskell for maybe 6 years before it clicked for me. I started because a had a coworker who would talk enthusiastically about it nearly daily. What really worked for me was actually starting with Elm, which the same coworker introduced me to, and then once I had a good grasp of that switching back to Haskell. It still took me a little bit but the difference were small enough that I mostly only needed to learn about typeclasses and the tiny syntax differences.

I still find documentation and tutorials to be less than stellar, but I’m finally at the point where they make sense.

This is also roughly how long it took me to learn languages like C# and JavaScript, except I’ve forgotten most of that experience by now.

“As a beginner, I’m really struggling with my Haskell relationship.”

You and me both. I’m learning Haskell, and I can now read and write it, to a reasonable standard. It hasn’t been plain sailing, as some of the documentation is obscure, some is wrong, and some is both. I’ve volunteered to have a go at helping with the documentation - I got a GIT site to contribute to. What? Where? Help! So, I didn’t. Ironically, they need us badly - people who don’t know Haskell so well, and so would hopefully ask, learn and pass on. There are far too many experts who can’t explain stuff to beginners, and writers of libraries who don’t get around to writing / updating the documentation.

“There are so many features of the language to get your head around,…”

So, don’t. Keep it simple. Haskell, at its very basic level, is quite simple and imperative:

-- Hello world in Haskell

main :: IO ()
main = do 
       putStrLn "Hello world"

What have we got here?

We’re using the IO Monad. A monad is like an arrow, it points in one direction, it indicates from/to. Here we say that we have a function main which returns an IO () - something happens involving IO, but we’re not returning a value. One instruction, putStrLn, like print in Python. Like Python, we use white space indentation.

That’s it.

If you can code Python, Haskell is no harder. It’s just that Python hides its entrails, and Haskell doesn’t.

You theoretically don’t need to specify types, but if you don’t, and you get something wrong, Haskell will be major-league confused. So I always do. Plus, if I write code, and I can’t figure out the function type, I can always cheat. I can use :t function which tells me.

 Prelude> main = putStrLn "Hello world"
 Prelude> :t main
 main :: IO ()

“There are so many features of the language to get your head around, to name a few:
the concept of type classes and all the instances such as monads, along with at least 100 of their attributes (<*>, >>=, fmap, compare, …)
algebraic data type definitions, data constructors
type instances, type synonyms, type constructors, kinds, patterns, currying,
so many different syntactic features (operator precedence, )”

So, don’t. Be a little kind to yourself. Using the advanced features is clever, can reduce code complexity, reduce bugs, show off to your mates, etc,. but actually it’s not necessary. You only actually need to know two monads - IO monad and the Maybe monad.

Take your first example of scaryness, <*>. I can do Just (*2) <*> Just 4, which unwraps the operation *2 and value 4, does the calculation and puts it back in the Maybe monad as Just 8. Or, I can write a function which pattern matches for Just something or Nothing, and works through all of the combinations. The first one is tidier, but not necessary.

I’ve also seen expressions with multiple <*> operators. I don’t know what that is either. It looks like more showing off, if you ask me.

Haskell is a marathon, not a sprint, and you will get these things eventually, honest. Although I still don’t know what ‘kinds’ are, despite having had it explained to me.

I use PowerPoint slides and document everything that I learn, including in the margins the details of the book or website where I found the information. That way, I only have to pay the teacher’s fee once.

Everyone on this forum is looking for a juicy problem to get their teeth into. Please share your problems - it will make our day.

“At what point should I give up on learning Haskell?”

Never. If an old codger like me can learn Haskell, so can you.

If you want a change, try Clojure. It’s functional like Haskell, but like Python hides its entrails, so you don’t have to face another monad, if you don’t want to. I found that learning Clojure helped my Haskell, and learning Haskell helped my Clojure.

Another piece of good advice: “Beware the Common Lisp, my son, the jaws that bite, the claws that catch, Beware the Fortran thing, and spurn the frumious C++.”

3 Likes

Please report such documentation. The best place to report would be to the issue tracker related to the documentation itself, but if you can’t find it, it doesn’t have one, or you get no response, then I offer the Tilapia issue tracker as a general-purpose place to track issues related to Haskell programmer experience.

1 Like

This is perhaps a controversial opinion, and I’m sorry if I’m being a little direct, but maybe Haskell isn’t the language for you? I mean, why do you want to learn it? If you’ve been trying on and off for 9 years, perhaps your heart is not really in it, as it seems that you are not really that invested in learning it. You don’t have to learn Haskell. Life is short; go do things that you really enjoy!

4 Likes

Back at Reddit, the author of a terminal emulator written in Haskell gave an account on how he got to learn the language. It seems to give credence to the “try to write something you would find useful or interesting” approach. Of course, different methods might work for different persons.

2 Likes

Hmm, is Haskell good for data analysis? Are there any strong libraries with clear documentation? Maybe it’s just that Haskell isn’t mature in that field yet?

@techmindful This might be useful! :smiley:

2 Likes

It sure is! Seconds into skimming, I saw the “Data Science” field in Haskell is marked as “immature”. It further pointed out that smooth user experience and simplicity of types and API are all areas to improve.

So I think OP is struggling because Haskell’s ecosystem is immature in their field of work, rather than OP not learning Haskell well.

Thanks @FrancisKing, I found this validating. I guess I feel I have a reasonable grasp on the things you have written about, and you have a really nice way of explaining things. I think the community would really benefit if you stuck your fingers in some of the documentation!

It is encouraging to learn about the similar movements of SimpleHaskell, BoringHaskell, and others noting the problems with Haskell’s ivory-tower culture in workplace/production code. For now, I’ll stick with it and hopefully things will start to click soon!
Cheers for all the responses. To receive so much interest in this topic makes me feel welcomed, and is a promising indication that the language will continue to improve!

2 Likes

My personal feeling is that “The Haskell Book” is too much of a tome to make it worthwhile for newbies*. I think its place is more appropriate as a reference. I bring this up in this discussion because if I were in OP’s shoes, I think I’d be discouraged by being directed to it.

  • I hope I am remembering this example correctly, but the book dedicates an entire chapter to Foldable simply to say Foldable is “to list”, so think about it as a container to which you can do “listy” things to it, including folding.
2 Likes

Sure; I just don’t know of a better resource right now. I’d welcome something that was a bit shorter!

Its tricky; I think those kinds of things help give you practice. they help you get better with working with more abstract ideas. For example, there is the semigroup and monoid chapters; are those strictly necessary? I don’t think so. But, do they help a person grow as a haskeller so they’re ready to tackle functor/applicative/monad? I think so.

At the time, everyone was telling me “this book will get you to the point where you can write real stuff in Haskell”. By the time I finished it, I was more than able to write real world applications in Haskell.

So yeah, it was a giant book. But IMO being confident that something will actually get you to the goal you are trying to hit is extremely motivating.

For me one of the biggest issues with reading is unclear value proposition. What will I get out of the book? If I invest my time in it, will I actually be be able to complete it? If I complete it, will I actually be able to use that knowledge to do what I need to do?

To OP, if you do find the size of HPFFP to be demotivating, perhaps I can recommend https://www.amazon.com/Programming-Haskell-Graham-Hutton/dp/1316626229/ . It is much shorter, and does a good job too. I bought it after having already completed HPFFP however, so its hard to say how accessible it would be to a non-programmer. but, I can say for sure that I randomly read the chapter on parsers and found it mind-blowingly cool. So I bet the rest of it is pretty good. And one of my buddies recommends it too. But he isn’t really an actual haskell programmer now though.

1 Like

I’m getting out of this struggle right now :smile:

The problem for me was that I read too much about Haskell without settling all those concepts with real work. There are many reasons for this, time is the primary one for sure.

So for anyone dealing with this feeling right now what I decided to do, and seems to be working, is:

  1. Stop reading about Haskell, you already know enough
  2. Write Haskell code, try to implement something small, or look for an open sources project in Haskell and pick one of the “#good-first-issue” issues. Or just try to run it locally and make small changes.
2 Likes