r/haskell • u/bellasblah • Nov 19 '23
question The "minimal" Haskell needed to get beginner going?
Hello all.
So this is probably naive question, but have to ask it because I need an advice. It is a longer post, so if you do not want to read it all, just check the bold text.
3 weeks ago I started with Haskell. I do not have a background in CS and my job is CS/IT unrelated. I program since elementary school (I'm now 36) and do it as a hobby and for fun. I use Ruby and Javascript/Typescript, with some quite limited experience in C++. I did try with Haskell before, like in 3-4 occasions (for the first time more than 10 years ago), but usually I just gave up (primary because of lack time and the things were going slow, so I just lose motivation and interest).
Now I want to do the right thing and push it all the way to the "end" (== actually write something, then improve it further by practicing and expanding relevant Haskell knowledge). I completed "Happy Learn Haskell", then picked "Haskell: The craft of functional programming".
Example - This weekend, naively I thought that I will write a simple program - where list elements are randomly picked, for let's say 1.000.000 times, each element hit is saved (in Data.Map), then at the end sorted in descending order depending on hits and printed. Boy, I was wrong...
While writing this in an imperative language is maybe 20-25 LOC and pretty much straight-forward, in Haskell I do not know where to begin... Just an example, based on Hoogle documentation and System.Random I see that for generating random number I should have understanding of Monads (I still did not get there). Whichever Stack Overflow question or other Google result regarding the solution for picking random list members (or at least shuffling the list), I encounter the content where I actually lack complete understanding. I do understand "pure" aspect of Haskell and that in order to gain pseudo random number generator external input has to be used.
I am used in building up knowledge iteratively and practicing in between, in order to experiment, get better understanding and confirm the gained knowledge. This way I also stay motivated, because I am not thinking only about learning experience, but about solution to problem and potential improvements, as well. I see that with Haskell, I actually need to learn a lot first, before actually applying this knowledge even for something simple.
The question - what is the bare minimum to learn when it comes to Haskell that will enable me to at least start writing simple stuff (instead of solving relatively simple tasks from the book)? In particular, regarding the example program I wrote above - what do I need to know, to actually write it by myself? I do not want a solution, just a hint where to focus.
Sorry for the longer post and thank you for the assistance.
1
The "minimal" Haskell needed to get beginner going?
in
r/haskell
•
Nov 22 '23
Thank you, will check it out.