Live data from Hacker News

An opinionated guide to Haskell

lexi-lambda.github.io

31–40 of 96 posts

Re: An opinionated guide to Haskell

#31
How 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?

Re: An opinionated guide to Haskell

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

Re: An opinionated guide to Haskell

#33

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.com/rikvdkleij/intellij-haskell and follow the `Getting started' guide

Re: An opinionated guide to Haskell

#34
post #28

OK, 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 follo…

Cabal version too high. Did you have a pre existing cabal installation independent of stack or something?

I don't think that I do. Is it possible that ghc-mod is broken on lts-10.5?

Re: An opinionated guide to Haskell

#35
post #25

When 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?

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

Re: An opinionated guide to Haskell

#36

Earlier quoted context omitted.

Haskell + Nix is the best environment I've ever used for any development. My go-to project manager is this script in the reflex-platform, which is a bit poorly named (it will change eventually), because it's actually an environment for doing general cross-platform full stack Haskell development: https://github.com/reflex-frp/reflex-platform/blob/develop/p... The learning curve is definitely , shamelessly high. We've…

Your go-to project manager is a script? Even if you did not intend it that way that is my impression of the reflex platform. Many have heard about the divide in Haskell package management between cabal-install and stack, but there is also reflex, which seems to rely on running arbitrary bash scripts and using Nix, thus leading to a third method of package management in Haskell. It's a big mess.

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 functionality is just leveraging nix's powerful declarative model which easily defines the build artifacts of a project along with the environments necessary to hack on or compile them.

This sits on top of cabal and stack, actually. Within a project shell provided by Nix, I'll use cabal to get a repl, for example. But since Nix is handling all the dependency management, cabal doesn't have to do any work in that regard.

Re: An opinionated guide to Haskell

#37
post #25

When 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?

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

Re: An opinionated guide to Haskell

#38

Earlier quoted context omitted.

Your go-to project manager is a script? Even if you did not intend it that way that is my impression of the reflex platform. Many have heard about the divide in Haskell package management between cabal-install and stack, but there is also reflex, which seems to rely on running arbitrary bash scripts and using Nix, thus leading to a third method of package management in Haskell. It's a big mess.

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.

Re: An opinionated guide to Haskell

#39

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…

Haskell + Nix is the best environment I've ever used for any development. My go-to project manager is this script in the reflex-platform, which is a bit poorly named (it will change eventually), because it's actually an environment for doing general cross-platform full stack Haskell development: https://github.com/reflex-frp/reflex-platform/blob/develop/p... The learning curve is definitely , shamelessly high. We've…

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 troubleshooting to get working with ghc. You can pick either stack or cabal and both sort of support Nix, but in every case some tooling will not quite work right.

Further, if you're not doing 100% open development, Nix's delivery story is also complicated. It's further challenged for projects using private docker or GitHub repos, where in many cases there is simply no support in Nix.

No one does Haskell newbies any favors by suggesting they learn a whole new package expression language and toolchain (that they will be interacting with deeply and constantly) in addition to a language that is full of fundamentally novel concepts and a vast breadth of new libraries, techniques, and a distributed documentation style.

Please. Stop recommending Nix to new Haskell users until at least the new porcelain commands are shipped.

Re: An opinionated guide to Haskell

#40
post #16

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…

Ocaml tooling has actually gotten substantially better over the past year or two. VSCode as an editor that just works. Opam for package management JBuilder for managing builds. Stdlib situation is still kind of a mess, but I think Base (which is just a stripped down Core) solves a lot of the current issues.

For the sake of clarity, I'll point out that Jbuilder has been renamed to Dune:

https://github.com/ocaml/dune

Post reply on HN