8 ms·
Advice for Haskell beginners (2017)
- ben509 8y agoI started learning Haskell by working on a proof of concept for a relational language. The big advantage, I think, was I _didn't_ try to do anything fancy with monads or typeclasses. I was just interesting in expressing functions, and that got me fairly fluent in that subset of Haskell. It definitely helped later when I started working on a language myself, and now needed to write a parser and do a lot of transformations using uniplate. My biggest piece of advice for beginners trying to do anything more complicated that requires dependencies is to use stack[1] and set up a skeleton project. Set up your stack.yml file with the latest nightly (hack on nightlies, release on LTS) and then visit stackage[2] to see docs _completely in sync with the versions you're using_. You should just be able to add dependencies you need to package.yml. That gets you a fairly stable environment where things will actually do what you expect, which eliminates a big source of confusion and frustration. [1]: https://docs.haskellstack.org/en/stable/README/ https://docs.haskellstack.org/en/stable/README/ [2]: https://www.stackage.org/nightly-2018-08-21 https://www.stackage.org/nightly-2018-08-21
- baldfat 8y agoI wish they had stack when I started. I ended up in Cabal hell and left. Now I love Racket and find that it really was a better functional landing place, but I hit to many walls early on. I am glad these are getting fixed.
- carterschonwald 8y agoCabal newbuild is quite nice. For newbs stack is fine. But I genuinely question any serious code base that needs stack. Genuine cabal hell hasn’t existed since around 2010. And the mini purgatory that some people call hell is impossivle with cabal new build. My perspective is perhaps biased, but I also am comaintainer of widely used libraries used literally everywhere plus I’ve done commercial and recreation and research flavors haskell dev for over a decade, currently at a fortune 10ish sized company. Though zooming out: these days I tell learners they should try everything out, and revisit various tools as their mastery grows. For industrial / large prjects that want pinned deps, I’ve seen folks happy with the mafia build tool or even going full nix for end to end os level reproducible build and config. My main issue with workflows like those centered around stack is that I’ve seen a lot of folks just not think about library versions and deps as part of their library/application foot print. And this has various consequences in how they engineer and upgrade their own libraries and applications.
- DonaldPShimoda 8y agoI think this (short) article had a lot of good points, though I do take minor issue with one bit: > Some people learn Haskell with the expectation that they will achieve some sort of programming enlightenment or nirvana. You will be disappointed if you bring these unrealistic expectations to the language. While I have not achieved any sort of nirvana, I do believe that learning Haskell has "enlightened" me insofar as I now look at programming in a fundamentally different way. I put a much greater emphasis on writing many small functions, I use types wherever possible (and type hints too, since Python is my primary language), and I avoid side-effects when I can. All of these things I do because Haskell taught me just how powerful simplicity can be. I also learned about different ways to conceptualize the relationships between data, and I learned about laziness (something I'd never heard of before then). Haskell has a lot to offer for people who come from an imperative background. > Haskell is not an achievement to unlock or a trophy to be won because learning is a never-ending process and not a finish line. While you can never "finish" learning, you can set milestones to mark your achievement. Comprehending some of Haskell's features (both the basics and the advanced ones) are perfectly acceptable milestones by which to track progress. I don't think that's a bad thing. --- That said, overall the article is very good. I agree that newcomers should write small programs, get their hands dirty, and learn to really use the basic features of the language firsthand before moving on to more advanced things. (And especially I agree that new users should avoid typeclasses at first, or even at second.)
- orblivion 8y agoCame here to say the same re: nirvana. Maybe keep moderate expectations, but yeah it did open something up for me. I think the truth is somewhere between "programming nirvana" and "no more null pointers and undefined functions".
- nitrix 8y agoHere, you're basically re-iterating the same point the author made. Some of it was written implicitly while the rest is laid out in a way that induces the mentality you're after, yet, without making any promises based on perceived benefits.
- deleted 8y ago[deleted]
- LeanderK 8y agoIf you're not on a purely intellctual trip, my advice is to first get a feeling for the language before trying to understand everything. Every widely used concept arises out a necessity and not out of thin air. Don't read all the monad-tutorial first. It's hard to understand not only why this abstract nonesense is useful, but even what it "is" (assuming you have no serious math background)! The interesting thing is that the concept arise naturally if you spend some time tinkering with haskell. The Functor arises almost instantly!
- chriswarbo 8y agoSounds like the Haskell Pyramid https://patrickmn.com/software/the-haskell-pyramid https://patrickmn.com/software/the-haskell-pyramid
- _bxg1 8y agoI read through part of the "Learn you a Haskell" book that was posted here yesterday, and started getting really excited to use this beautiful language. And then I started looking into ways to use it for making games and was... disappointed. Maybe I've been spoiled by the vibrancy of JavaScript's ecosystem, but I hoped to find a library for simply rendering existing meshes with existing materials and the closest I found was a library of base OpenGL hooks. Add onto that the lack of half-decent UI libraries (on the web you can use Elm, which is similar but different) and it feels like the only thing Haskell is practical for is headless data-processing, which is a shame.
- marcosdumay 8y agoMy conclusion about using Haskell to make games and device drivers¹ is: don't. Even if the ecosystem changed and some great libraries appeared since I last tried, the language itself is a bad match for those domains. Lazyness is great everywhere, except when it works against you, and the garbage collector will assure you notice it. 1 - On my case, userspace drivers. I'm still open to userspace filesystems (I have on on my TODO list, if I ever get there), but device controlling implies on some harder real time requirements.
- _bxg1 8y agoI can see why it would be bad for drivers, but why games? Functional programming has started to become popular in that space lately, and for good reason
- marshray 8y agoGames are all about keeping the user in the 'flow'. Humans are really good at picking up on unpredictable timing. Action games are thus fundamentally hard-real-time systems.
- _bxg1 8y agoMy thinking was to have a top game loop that "ticks", and then passes the current game state + the time delta to a pure function which returns the new game state, which gets stored. Is the concern that Haskell's lazy-evaluation might lead to a higher level of variance in frame-rate than another language?
- KirinDave 8y agoAddenda (relevant to community musings today): Be aware that as a small and very distributed community, the Haskell world has less power to eject bad actors than more centrally managed and resourced projects have (e.g., Golang and Rust have much more structural power to moderate). Awful and abusive people exist in the community, and it's best to just start blocking and ignoring folks who disrespect you. The amazing thing about the Haskell community is that knowledge is very well distributed throughout the community these days. The culture, influenced by academia, strongly values writing and publishing ideas rather than sharing them orally or in the workplace. This means that if you're interested in learning, there are a ton of places and ways to do it. If you're looking for good initial connections to folks who are respectful, well informed, and unlikely to expose you to some of the frustrating cabals in the community, I've got a few recommendations 1. Gabriel Gonzales (this is his blog, and he's @GabrielG439 on twitter) 2. Chris Martin of TypeClasses. I'd also list his partner in crime Julie Moronuki, but her social media interaction is reduced these days. These two focus on helping programmers get up to speed with haskell from a variety of starting points, and they care more about functional programming than haskell specifics. 3. Patrick Thompson of Github (@importantshock on Twitter). A fantastically skilled person who will link you to a network of amazing Haskell folks who do stuff in a positively next-generational way. Two people who are adjacent to the Haskell community and incredibly interesting, but probably can't answer direct questions for you. Worth a follow. 1. Dr. Edwin Brady, creator of the Idris language. He's widely respected, humble, and has a beautiful vision for how humans and computers should interact to write programs. 2. Dr. Bodil Stokke (@bodil on twitter). Bodil is not so much a Haskell person these days, but she's got a phenomenal breadth of knowledge and always has interesting things to talk about in the FP space. Worth a follow if you're on that platform. I suppose you can ask me for help too, but I'm certainly not as competent as these folks.
- NickPollard 8y agoCan second all these suggestions. Also, from my experience all the Haskell events I've been to have been incredibly welcoming and positive, whilst I'm aware there are a tiny subset of abusive people out there, I've never met them nor met anyone who would tolerate them. Shoutout if you're in the SF area, BayHac (https://wiki.haskell.org/BayHac2018 https://wiki.haskell.org/BayHac2018), a yearly unconference/hackathon is incredibly fun, and also there are (roughly) bi-monthly Haskell meetups (https://www.meetup.com/Bay-Area-Haskell-Users-Group/ https://www.meetup.com/Bay-Area-Haskell-Users-Group/) in SF which are great fun (disclaimer: I co-organise the meetups - find me @Nick_enGB).
- nafizh 8y agoI have skimmed all the famous books so far on haskell. But the best learning resource to me so far has been the UPenn course [0] because of the quick coding and feedback loop in the browser. Also, the beginning assignments involve visualizations, which is always good to check if you are doing things right or wrong. 0. https://www.seas.upenn.edu/~cis194/fall16/ https://www.seas.upenn.edu/~cis194/fall16/
- noncoml 8y agoMy advice for Haskell("monad") beginners would be to try to re-implement the("a") State monad by yourself without using any libraries. It helped me understand that monads are nothing more than just function composition.
- raffael-vogler 8y agoAt this very moment I am checking the applicative and monad laws for the state applicative / monad discussed in Hutton's book. Wish me luck ...
- DonaldPShimoda 8y agoI like "Functors, Applicatives, and Monads in Pictures" [0] as a gentle introduction to the concepts. Same revelation as yours, but through a different vehicle. [0] http://adit.io/posts/2013-04-17-functors,_applicatives,_and_monads_in_pictures.html http://adit.io/posts/2013-04-17-functors,_applicatives,_and_...
- laurentl 8y agohttps://github.com/MostlyAdequate/mostly-adequate-guide https://github.com/MostlyAdequate/mostly-adequate-guide is also didactic but goes into more details, and is not Haskell-specific (IIRC functors, map and so forth are all defined in JavaScript)
- mfonda 8y ago> Haskell is not an achievement to unlock or a trophy to be won because learning is a never-ending process and not a finish line. Haskell aside, I think this is a fantastic point regardless of whatever it is you're learning. There's always so much more to learn and having this mindset makes it a lot easier to do so.
- quiq 8y agoReminds me a bit of the quote: "A classic is something everybody wants to have read, but no one wants to read." --Mark Twain
- raffael-vogler 8y agoWith regard to yesterday's exhumation of LYAH I'd like to point out typeclasses.com which I just discovered on r/haskell through this announcement: https://joyofhaskell.com/posts/2018-08-06-announcement.html https://joyofhaskell.com/posts/2018-08-06-announcement.html.
- marshray 8y agoCan anyone recommend a similar article for Rust?