12 ms·
An opinionated guide to Haskell
- dvddgld 9y agoLearning Haskell is one of those two weeks things that’s been on my interests list for a long time, but will likely stay there for awhile yet. Though, if anyone has got any high-quality quick resources handy that’d be appreciated!
- cauterize 9y agohttp://haskellbook.com/ http://haskellbook.com/ is a great modern deep dive catered to folks like you! It is long, but guides you along the way
- dvddgld 9y agoThank you!
- pimeys 9y agoNeed to reply after one day, but I read the sample, figured out an environment for Haskell using Spacemacs and bought the whole book. Because of your link, I decided to be proficient with Haskell in 2018. 2016 was the year of Clojure, 2017 Rust and now Haskell. Thank you in advance!
- sridca 9y agoHere's another targeted towards those who already know some Haskell: https://intermediatehaskell.com/ https://intermediatehaskell.com/
- drizze 9y agoI’ve been reading “Real World Haskell” and enjoying it thus far. Big bonus is it is available for free online: http://book.realworldhaskell.org http://book.realworldhaskell.org
- happimess 9y agoThis is a great book. I brought it on vacation once, read it end to end, and was a much better Haskeller afterwards. However, it was written a long time ago, and is missing a lot of Haskell's recent history. The book targets GHC 6.8, whereas I'm running 8.2.2. There's a summary at [1] Again, it's a great book and the price is right, but caveat lector. [1] http://support.oreilly.com/oreilly/topics/when-will-it-be-an-update-of-real-world-haskell http://support.oreilly.com/oreilly/topics/when-will-it-be-an...
- pdpi 9y agoIf you’re in it for the two-week thing rather than the long term, “learn you a Haskell for great good” is a good choice. Not terribly informative if your goal is writing large applications, but pretty good introduction to the mindset that goes with writing haskell
- chillee 9y agoTo elaborate on LYAH, I think it's a pretty bad resource for actually learning Haskell. It's very "here's a feature, now copy it". Which works fine for learning syntax, but works poorly for learning Haskell. Check here for a review that really resonated with my experiences about LYAH: http://bitemyapp.com/posts/2014-12-31-functional-education.html http://bitemyapp.com/posts/2014-12-31-functional-education.h... Note the author of that post is also the author behind the Haskell book, which is also what I'd recommend currently.
- atombender 9y agoI have to disagree about LYAH here. Allen can argue that LYAH is incomplete, and he seems to think the university courses he mentions are the best way to learn Haskell. But not all developers want to go down that route, at least not as a first step. For me, LYAH was an important stepping stone to getting productive, while at the same time fully understanding that it was not the final word on anything. This is, I suspect, what Allen doesn't get. His Haskell book is actually yet another example of why many developers find Haskell daunting to learn; it starts at the deep end, like many books before it. LYAH succeeds precisely because it doesn't go into several pages about beta reduce before explaining how variables are declared. Sure, it's chatty, it likes to rely on the REPL to show evaluations, and it also doesn't start with a formal introduction to functional languages or lambda theory. But it's a book written for programmers who already know how to code. It's approachable, doesn't go into unnecessary detail (if you want to know everything about List, go somewhere else; the Haskell Book has 59 pages devoted to it!), and lets you get up to speed fast without falling off along the way. It's an introductory mini course, and by the end of it you'll be able to write programs. I don't buy Allen's arguments about it being "unpedagogical". I've never used book exercises and I never will, yet I didn't have any issues learning Haskell, or any other programming book for that matter. The absence of exercises in LYAH doesn't make it a bad book. As an aside, Allen co-wrote what he claims is a superior book, and then published it as... a PDF. I just purchased it, and was immediately disappointed I had paid $59 for what amounts to a paper book in digital form, with no web version (the "online" version on gumread.com doesn't even provide hyperlinks within the book). LYAH is great because it's adapted to the web. I'm sure the Haskell Book is wonderful (and I'm reading it), but this is another way he misses the point of LYAH.
- farresito 9y agoHaskell is so far the language that has blown my mind the most, and it's not even close. Admittedly, I haven't learned that many (esoteric) languages (I found Prolog very peculiar, for example), but if you have never done any functional programming before, Haskell will (hopefully) blow your mind as well.
- cauterize 9y agoThis is really great. I'd love to see a follow up covering other topics. Such as testing (with hedgehog), modeling SQL, etc. Or -- anything that helps open up the world to see how Haskell is a beautiful language to build on.
- audiolion 9y agoWow, I wish this existed when I was wprking with Haskell a few years ago. This is a compendium of useful information. I really love how Haskell makes me think and code in an entirely different way. It is fun, and I hope the language continues to grow.
- resoluteteeth 9y agoI've tried messing around with haskell a few times, but the biggest problem I have is the tooling. I just tried to get haskell set up a few days ago and I couldn't get it working with either vscode or Idea. I also couldn't get ihaskell (jupyter notebook) installed successfully. I might give it another shot based on these instructions, but the fact that pretty much every program seems to make different assumptions about whether you're using cabal or stack and how you have them set up is really annoying. I assume if you are really knowledgeable about this tools it's not that bad, but as a haskell beginner they are completely impenetrable. (Even just the yaml files used by stack seem completely incomprehensible compared to the formats used by most languages' build tools.) Considering that the language itself has a pretty steep learning curve, it's really frustrating wasting several hours just trying to get the haskell environment set up without success and not even getting the point of being able to try to actually use it. I've had a pretty bad opinion of the Ocaml and F# tooling in the past, but the haskell tooling is just so, so much worse. (F# seems to have gotten to a point where the tooling if you can just use .net core, although it gets horrible again if you then need to also use mono at the same time so you can use the interpreter.) It's especially bad if you compare it to something like rust where cargo works so well it's actually in itself a reason to use rust.
- embwbam 9y agoIt takes a while for the Haskell community to reach consensus. Stack is definitely recommended by almost everyone for both beginners and production projects. It is used on every project I’ve run in to lately. Sure there are different ways to configure it, but these days there’s really one way to get started. Just download stack, make a new project, and start coding
- resoluteteeth 9y agoI get that Stack is what people should be using now but it's still not that helpful if I can't actually get actual instructions for setting up vscode, etc. based on using stack without "stack install." The fact that haskell users seem to think these things are completely obvious and doesn't need to be explained is frankly a big part of the problem.
- resoluteteeth 9y agoOK, I am trying to install haskell again using the instructions given in this guide. I removed my existing stack installation and my .stack directory, installed stack again, created a new stack project and then ran the recommended command in the guide to install ghc-mod and related tools: "stack build -j 8 --copy-compiler-tool ghc-mod hoogle weeder". I get an error: Error: While constructing the build plan, the following exceptions were encountered: In the dependencies for ghc-mod-5.8.0.0: Cabal-2.0.1.1 from stack configuration does not match >=1.18 && <1.25 (latest matching version is 1.24.2.0) ...etc. Can someone explain what's causing this?
- s4vi0r 9y agoCabal version too high. Did you have a pre existing cabal installation independent of stack or something?
- resoluteteeth 9y agoI don't think that I do. Is it possible that ghc-mod is broken on lts-10.5?
- lexi-lambda 9y agoIt isn’t broken in lts-10.5, it just isn’t in lts-10 at all. Go to https://www.stackage.org/lts-10.5 https://www.stackage.org/lts-10.5 and search for ghc-mod—it just isn’t currently available. Unfortunately, the reason for this is that ghc-mod still isn’t updated for GHC 8.2. It’s almost there—a package candidate has been uploaded that works alright—but it hasn’t made it into the LTS yet. There’s a way to build and install the package candidate in a way that will work with stack, which I have done on my personal machine, but honestly I decided it was just too much for this (already overly long) blog post.
- osense 9y agoYes, see https://github.com/DanielG/ghc-mod/issues/900 https://github.com/DanielG/ghc-mod/issues/900
- jadbox 9y agoWhen I look at many modern Haskel guides, they all seem to recommend adding all these extensions/sugar into your code. If these things are so common to use, why doesn't Haskel adopt them into core?
- badwebsite 9y agoHaskell is a standardized language that moves very slowly. Some of the extensions may be integrated into Haskell2020.
- Buttons840 9y agoThe most recent progress on Haskell 2020 seems to be a GitHub issue in which the committee members admitted work had stalled and put forth some ideas to improve things. That was 9 months ago though.
- tikhonj 9y agoThe standardization process is really slow and conservative, and making it faster is not a priority for anyone because—at least at the moment—GHC is the only meaningful compiler, so the standard wouldn't be doing more than explicitly recording how GHC's extensions work.
- whateveracct 9y agoLANGUAGE pragmas just end up being like imports. It felt weird to me at first but by now it’s just as natural. If you want to have some on by default, you can set that up easily in your cabal file.
- alphaalpha101 9y agoBecause a lot of them are a very bad idea: they overly complicate code to achieve with typeclasses what you can easily achieve without them in normal Haskell 98.
- latte 9y agoHow good is the static analysis tooling (IDE / editor plugins) for Haskell? Given Haskell's powerful type system, I imagine that it must be possible to see warnings, hints, autocompletion and other early feedback about the code in the editor before compilation, like in Java, Kotlin etc. or even better - is that the case?
- preordained 9y agoMaybe things have changed, but not a couple years ago when I was working with Haskell. No IDE story at all, which is just a crying shame when you think about the kind of refactoring and powerful features you could support. The fact that vim or other text editors were typically what was used was just odd and a waste IMO...like having a rocket propulsion system strapped to a Huffy.
- tathougies 9y agoI use emacs + intern and it’s great. Type errors are underlined immediately, warnings and lint messages are marked. Half the time I let the compiler write the code by using ghc placeholders and playing type golf
- AlexCoventry 9y ago> Half the time I let the compiler write the code by using ghc placeholders and playing type golf Is this method documented anywhere? Sounds interesting.
- tathougies 9y agoJust put in an underscore where you want to write code. If you compile the code, GHC outputs an error with the expected type as well as all bindings in scope. Then, just work backwards. If you use intero, then all type errors are underlined, including placeholders. The general feature is called 'typed holes', and there's a wiki page here: https://wiki.haskell.org/GHC/Typed_holes https://wiki.haskell.org/GHC/Typed_holes
- 9y ago
- Cieplak 9y agoA lot of people use Atom, but I think emacs + intero is currently the best Haskell tooling. I use it with spacemacs. Has everything I would need from an IDE, including highlighting errors on the fly, auto completion, jump to definition, auto formatting. It’s no intellij, but I’ll take Haskell’s type safety over that any day of the week, and twice on Sunday. http://commercialhaskell.github.io/intero/ http://commercialhaskell.github.io/intero/
- s4vi0r 9y ago+1, emacs+intero is the way to go. Emacs in general is highly underrated due to years of RSI/muh loading time shitflinging. Evil mode is by far the most complete vim emulation out there, and other than JS pretty much every language I write has been a more enjoyable/easy experience on Emacs than it was on vim or st3.
- james-mcelwain 9y agoI'm writing a lot of Java right now, and it's frustrating that the experience is so horrible on Emacs -- or so much better in Intellij. I tried using Eclim with Emacs for a while, but it's so tedious moving through Java without a specialized IDE. Still, I keep Emacs open on Java code solely for the git interface (magit) and helm integration with `ag`, which I find vastly superior to find-in-path / regex search capabilities in Intellij.
- marcosdumay 9y agoThere's a while that I can't find intero in melpa.org anymore. Do you know if it moved?
- Cieplak 9y agoPerhaps you need to update your package index?
- vinaybn 9y agoI've been learning Haskell using IntelliJ as my IDE. https://plugins.jetbrains.com/plugin/8258-intellij-haskell https://plugins.jetbrains.com/plugin/8258-intellij-haskell
- dmitriid 9y ago> There was a time when cabal-install had a (warranted) reputation for being nearly impossible to use and regularly creating dependency hell > You almost certainly do not want to use stack install. > The .cabal file is, ultimately, what is used to build your project, but modern versions of stack generate projects that use hpack, which uses an alternate configuration file, the package.yaml file, to generate the .cabal file. This can get a little bit confusing, since it means you have three configuration files in your project > Frankly, I think the UX around this is terrible. This goes to show that no amount of static typing can save you from implementing badly-designed software.
- Devac 9y ago> This goes to show that no amount of static typing can save you from implementing badly-designed software. Sure, but that's like saying "you can die to cancer even if you drive around in a Volvo."
- dmitriid 9y agoThis analogy (as any analogy) is wrong. A slightly better one would be "an expensive camera doesn't automatically make you a great photographer". There's a long running tradition of languages with static typing and better type systems making fun of dynamically typed languages and those with "worse" type systems. A good example is[1]: """ It's 2018 - static type systems are not optional... It is especially worrying that these people think they are gaining velocity by trading correctness. """ And yet I'm seeing more and more examples where (often preceived) correctness is often offset by much bigger problems. Another example is mini-thread on how horrible DateTime is in Haskell: https://twitter.com/chris__martin/status/956002730778288128 https://twitter.com/chris__martin/status/956002730778288128 [1] https://twitter.com/timperrett/status/957493915937943554 https://twitter.com/timperrett/status/957493915937943554
- tome 9y agoAny weaknesses with the Haskell "time" library have nothing to do with static types in particular nor the language in general. To stretch your analogy further "Having an expensive camera does not prohibit you from also taking photography lessons".
- allenleein 9y agoFor people who wanna learn Haskell: 1. Don't touch Haskell platform. Install Stack. If you did, Uninstall it. https://mail.haskell.org/pipermail/haskell-cafe/2011-March/090170.html https://mail.haskell.org/pipermail/haskell-cafe/2011-March/0... Why? It is considered harmful https://mail.haskell.org/pipermail/haskell-community/2015-September/000014.html https://mail.haskell.org/pipermail/haskell-community/2015-Se... 2. Install Stack: https://haskell-lang.org/get-started/osx https://haskell-lang.org/get-started/osx If you do not wish to install these dependencies, you may use a virtual machine instead https://github.com/data61/fp-course/blob/master/ops/README.md https://github.com/data61/fp-course/blob/master/ops/README.m... 3. Learning resources: https://github.com/allenleein/brains/projects/9 https://github.com/allenleein/brains/projects/9
- aaronchall 9y agoI consulted with one of the co-organizers of the Haskell meetup here in NYC, and while he seems to have a nuanced view that is anti-stack for professional Haskellers, he also recommends stack for new people. I'm thinking the consensus is that this is good advice.