Live data from Hacker News

An opinionated guide to Haskell

lexi-lambda.github.io

51–60 of 96 posts

Re: An opinionated guide to Haskell

#51
post #38

Earlier quoted context omitted.

Ok so, calling it a script was wrong. It's a nix function which takes arguments specifying various configurations about the project I'm working on, such as any dependency overrides. It then provides a nix derivation which can define shells and compile to whatever platforms I need. No bash scripting is necessary to use this machinery except a convenience script to install Nix if you don't have it. All of the functiona…

I find it odd you are recommending this setup to someone who isn't even comfortable with the Haskell language yet, who now must learn this tooling as well.

I didn't recommend it though! I just described what I use, said it's got a super high learning curve, and we're working on it.

Re: An opinionated guide to Haskell

#52
post #21
post #8

Earlier quoted context omitted.

If 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

To 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.h... Note the author of that post is also the author behind the Haskell boo…

I'm reading LYAH at the moment, and I think it's great if you're familiar with functional programming already, and just want an introduction to haskell. It's incredibly verbose, but I just read the code, and resort to the text when I don't understand what's going on. Haskell Programming From First Principles takes a socratic approach which seems like it could be good for very dedicated students who need to learn the fundamentals of functional programming in addition to haskell.

Re: An opinionated guide to Haskell

#53
post #20

Earlier quoted context omitted.

> Stay away from most of the IDE tooling. You don't need to be fighting the tooling when starting. The repl and "ghcid" should be all you need. I'm honestly not sure I'm interested in learning haskell if this is considered an acceptable situation.

There is editor tooling, you can look at intero or dante for that. It works. My point is as a beginner, it is added friction when the focus should be on learning how to use the repl and the language. If you absolutely require an IDE, Haskell is probably not going to be your favorite language.

I make the same recommendation for people learning Java, and Java has the best IDE support there is. The fact is that an IDE is a large and complex tool with a lot of details to understand, and jt will sap mental energy that is needed for dealing with the new language.

When starting out, pick a common programmer's editor you already know, find a syntax highlighter for it, and turn on auto-indentation. If there's a plugin or tool which does auto-formatting and doesn't need a lot of tweaking, add that too. Learn an IDE once you understand the language and are getting frustrated by boilerplate, navigation, etc.

Re: An opinionated guide to Haskell

#54

> 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…

> 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."

Re: An opinionated guide to Haskell

#55
post #21

Earlier quoted context omitted.

To 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.h... Note the author of that post is also the author behind the Haskell boo…

I 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 susp…

Out of curiosity, did you finish LYAH? And have you actually started using Haskell for any substantial projects?

I was also recommended LYAH when I started, and it was only around the middle of the book when I started to get lost. I remember actually going along a GH repo somebody had made for "haskell exercises companion to LYAH", but I still found myself reading a chapter, and then having no idea how to actually use the concepts learned. Especially the concepts that are really "barriers" to understanding Haskell (monads, applicative, etc.)

The problem with LYAH is that it teaches you "what" haskell is, but not "why" haskell is the way it is, nor "how" you should you think about Haskell. If you're not at least familiar with another FP language in the same space (probably a ML language), Haskell is not a language you "get up to speed" in.

Re: An opinionated guide to Haskell

#56
post #32

A 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/

+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.

Re: An opinionated guide to Haskell

#57

Earlier quoted context omitted.

I couldn't disagree more. Nix doesn't make development easier. In fact, it substantially complicates development to ease open source delivery and client dependency management. These are things that are of questionable value to the Haskell or product dev ecosystem, as people far more often prefer fully static (admittedly large) binaries anyways. And, Nix doesn't work well with existing tools like intero, it requires t…

I didn't, at all, recommend nix to anybody. What are you responding to?

> Haskell + Nix is the best environment I've ever used for any development

That sounds like a recommendation.

Re: An opinionated guide to Haskell

#58

I'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 abo…

My advice would be start with stack and hpack, and remain with your editor or IDE of choice to start with. Learning any new language is difficult enough without having to also deal with a different workflow. This is my recipe for starting with haskell and intellij: - install stack, run `stack new helloworld simple-hpack` - make sure it builds: `cd helloworld && stack test --exec helloworld` - install https://github.c…

> My advice would be start with stack and hpack

Interesting. I would advice to start with plain cabal. One has to learn how to deal with cabal anyway, so there's no point adding stack on top of it from the start.

Re: An opinionated guide to Haskell

#59
post #22
post #17

Earlier quoted context omitted.

How is Ocaml tooling worse than rust? Merlin is very powerful and it gives me everything i want from an editor integration. I still can't get point-at type to work in emacs/vim for rust reliably(macros make it even worse). Haskell tooling is good enough(i haven't worked on big projects, so maybe it doesn't scale) now with intero if you use emacs.

Is OPAM finally abailable for Windows? If not, it‘s definitely worse. That‘s something Rust got very right from the beginning.

I just installed this today on a Windows machine, and it's working great so far:

https://fdopen.github.io/opam-repository-mingw/

Re: An opinionated guide to Haskell

#60
post #55

Earlier quoted context omitted.

I 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 susp…

Out of curiosity, did you finish LYAH? And have you actually started using Haskell for any substantial projects? I was also recommended LYAH when I started, and it was only around the middle of the book when I started to get lost. I remember actually going along a GH repo somebody had made for "haskell exercises companion to LYAH", but I still found myself reading a chapter, and then having no idea how to actually us…

I did finish it, and I thought the introduction to monads more helpful than anything else I'd come across, as it's focused on the practical use of them.

LYAH is not for everyone, but that also means it's not bad for everyone, either. There's more than one way to teach computer languages.

Post reply on HN