News for hackers. Stuff that matters.
Re:An opinionated guide to Haskell by resoluteteeth on Saturday February 10, 2018 @01:42PM (#16348771)
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 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.

Re:An opinionated guide to Haskell by danharaj on Saturday February 10, 2018 @02:50PM (#16349186)
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 been slowly polishing it to make it easy for complete beginners to fully up-to-speed on a project in minutes, but it's a lot of work that happens mostly on weekends.

Watch this space!

Re:An opinionated guide to Haskell by KirinDave on Saturday February 10, 2018 @04:25PM (#16349690)
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 by danharaj on Saturday February 10, 2018 @07:06PM (#16350375)
I didn't, at all, recommend nix to anybody. What are you responding to?
Re:An opinionated guide to Haskell by garmaine on Saturday February 10, 2018 @08:10PM (#16350582)
> Haskell + Nix is the best environment I've ever used for any development

That sounds like a recommendation.

Re:An opinionated guide to Haskell by danharaj on Saturday February 10, 2018 @09:54PM (#16350926)
That's because it's spefically optimized for my needs: writing Reflex apps. It's what I do for a living.

Everyone has different priorities. I know some users who started using Haskell at all with reflex-platform despite the difficulty because it scratched exactly their itch.

Re:An opinionated guide to Haskell by KirinDave on Saturday February 10, 2018 @11:03PM (#16351114)
Well, as complex as Nix+whatever-you-have-cobbled-together-to-build-and-editor-instrument-ghcjs is, it pales in comparison to the sheer ferocious confusion granted to the ecosystem by tools like webpack, so I can see where it might seem like an improvement in some regards.

Webpack: it's like lens error messages for your builds, at runtime!

Re:An opinionated guide to Haskell by ianai on Saturday February 10, 2018 @09:31PM (#16350846)
for developing haskell
Re:An opinionated guide to Haskell by KirinDave on Saturday February 10, 2018 @09:54PM (#16350922)
It sure read like that to me, but given the international nature of this forum, I'll take you at your word. Nor do I disagree with you about your assessment of your experience.

But your experience and your requirements differ from mine, and in a professional capacity I could never recommend Nix for an organization.

Re:An opinionated guide to Haskell by Buttons840 on Saturday February 10, 2018 @03:31PM (#16349413)
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.
Re:An opinionated guide to Haskell by danharaj on Saturday February 10, 2018 @04:09PM (#16349611)
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 by platz on Saturday February 10, 2018 @04:18PM (#16349662)
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 by danharaj on Saturday February 10, 2018 @07:07PM (#16350377)
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 by Buttons840 on Saturday February 10, 2018 @10:38PM (#16351045)
I just wish the reflex maintainers would push new changes to Hackage once in awhile. From GitHub I gather that reflex 0.5 was finished over a year ago but that version is not available on Hackage.
Re:An opinionated guide to Haskell by cyclinghacker on Saturday February 10, 2018 @03:37PM (#16349438)
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 by marcosdumay on Saturday February 10, 2018 @08:38PM (#16350678)
> 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 by bsummer4 on Saturday February 10, 2018 @10:28PM (#16351014)
One has to learn how to deal with cabal anyway

Nah, I haven't used cabal-install in years now. Because of hpack, you don't even need to write .cabal files.

The only time I touch cabal is when I need to write Setup.hs files, which is, mercifully, quite rare.

Re:An opinionated guide to Haskell by st1ck on Saturday February 10, 2018 @10:41PM (#16351057)
> One has to learn how to deal with cabal anyway

With *.cabal project files yes, for sure.

But `stack` has completely replaced `cabal` command for me. I don't even have it installed.

Re:An opinionated guide to Haskell by chillee on Saturday February 10, 2018 @02:04PM (#16348883)
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.

Re:An opinionated guide to Haskell by c-cube on Sunday February 11, 2018 @12:46AM (#16351391)
I agree that jbuilder (dune) more or less solved the fragmentation problem for build systems, and is nice to use. I switched most of my projects to it.

On the other hand I'm more pessimistic about the stdlib situation because Base breaks compat with the stdlib, thus making the migration impossible (or really painful) for a lot of projects. I'll therefore stick to my own extension of the stdlib (containers) in the foreseeable future…

Re:An opinionated guide to Haskell by lambdawitch on Saturday February 10, 2018 @04:38PM (#16349753)
For the sake of clarity, I'll point out that Jbuilder has been renamed to Dune:

https://github.com/ocaml/dune

Re:An opinionated guide to Haskell by embwbam on Saturday February 10, 2018 @01:45PM (#16348784)
It 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
Re:An opinionated guide to Haskell by resoluteteeth on Saturday February 10, 2018 @01:53PM (#16348820)
I 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.

Re:An opinionated guide to Haskell by embwbam on Saturday February 10, 2018 @02:05PM (#16348890)
I have no idea how to configure vscode, but stack is really simple. This will get you started.

  stack new my-project
  cd my-project
  stack ghci 
  > main
http://seanhess.github.io/2015/08/04/practical-haskell-getti...

Haskell’s community evolved very differently from JS and the rest of open source. What seems simple to many isn’t necessarily what seems simple to the rest of us. Much of what this community considers simplicity is just convention and familiarity.

But so many people from our world are using it now that things are slowly becoming more “intuitive”!

I understand your frustration. It took me a lot of effort to get over the learning curve. Well worth it. But trust me, it’s easier than ever and getting better

Re:An opinionated guide to Haskell by mintplant on Sunday February 11, 2018 @01:53AM (#16351542)
A very quick Google search found Haskelly [0] and Haskero [1] for VS Code, both of whose installation instructions say to install Intero [2] locally in your project directory with "stack build intero" if you don't want to use "stack install" to install Intero globally.

[0] https://marketplace.visualstudio.com/items?itemName=UCL.hask...

[1] https://marketplace.visualstudio.com/items?itemName=Vans.has...

[2] https://github.com/commercialhaskell/intero

Re:An opinionated guide to Haskell by platz on Saturday February 10, 2018 @01:49PM (#16348802)
ihaskell is a somewhat fragile project briding several disparate ecosystems/languages. I'm not really sure the value-add is there yet; in any case it is not a tool for beginners or the preferred method to get feedback from your programs.

Haskell proper is pretty turn-key these days with stack.

Stay away from edgelord / niche projects.

Stay away from most of the IDE tooling, including ghc-mod. You don't need to be fighting the tooling when starting. The repl and "ghcid" should be all you need (though I grant it takes some learning to use these as effectively if you're used to an IDE- you will learn with experience).

Just use the "ghcid" cli tool to get compile errors and feedback. It is rock solid.

https://github.com/ndmitchell/ghcid

Your experience will be much smoother.

It takes a bit getting used to if you're used to an IDE, but with Haskell it's usually a better to go for a multi-terminal/repl kind of setup

Re:An opinionated guide to Haskell by resoluteteeth on Saturday February 10, 2018 @01:57PM (#16348844)
> 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.

Re:An opinionated guide to Haskell by platz on Saturday February 10, 2018 @02:06PM (#16348903)
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.
Re:An opinionated guide to Haskell by twic on Saturday February 10, 2018 @07:23PM (#16350432)
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 by nh2 on Saturday February 10, 2018 @02:05PM (#16348895)
In practice, it is an acceptable (as in, not great, but sufficient) solution.

It is annoying to not have the high quality of IDE tooling you'd enjoy with Java, but in contrast to Java you can be very productive in Haskell even without advanced IDEs (though you would be even more productive with them).

There will be IDE tooling eventually.

Re:An opinionated guide to Haskell by vaibhavsagar on Sunday February 11, 2018 @01:33AM (#16351496)
I don't think it's fair to say IHaskell isn't for beginners, I found it invaluable when I was starting out as a richer REPL than GHCi. I agree with everything else you say about it though. I help maintain the project now and would love to know how I could make it easier to install and use.
Re:An opinionated guide to Haskell by emmelaich on Saturday February 10, 2018 @06:59PM (#16350350)
Same with me. I download some code (or git clone) from an article or gist or somewhere which looks cool.

I'd estimate 80% of the time I fail to compile. Typical reasons are errors from Cabal, stack is wrong version, things like that.

If it was C or Python or even Rust I'd forge ahead and make it work. But with Haskell's tooling I'm too far out of my depth to bother.

Re:An opinionated guide to Haskell by bsummer4 on Saturday February 10, 2018 @10:31PM (#16351020)
If you upgrade stack and then do stack build, it's very close to being guaranteed to work.

Stack (and stackage) is the best nicest, most-reliable build-system of any language.

Re:An opinionated guide to Haskell by emmelaich on Saturday February 10, 2018 @11:15PM (#16351144)
Thanks and fully and completely understand why and how the current situation happened. And I fully appreciate the efforts people make to alleviate it. My sole concern is that the situation is accurately seen for what it is.

So far, just in these comments I've seen:

    1. just use plain cabal
    2. use stack, you don't need cabal
    3. use gchid
    4. haskell+nix is best
    5. use hpack
To emphasise again, this is not a severe criticism. I've been around for too long not to know that this is an almost inevitable result of people working in open source with disparate purposes and heterogeneous environments.

PS. I bought HaskellForMac and it's great. It ties you a Haskell version a little older than the latest but that's OK too.

Re:An opinionated guide to Haskell by joeblau on Saturday February 10, 2018 @03:16PM (#16349341)
What operating system are you running on? I paid for and downloaded Haskell For Mac[1] and it's been a great dev experience so far. The IDE is similar to Xcode (I'm an iOS developer) and the REPL is great for trying stuff out.

[1] - http://haskellformac.com

Re:An opinionated guide to Haskell by drizze on Saturday February 10, 2018 @05:44PM (#16350067)
What sort of apps can you build with Haskell For Mac? The website gives me the impression it’s more akin to Swift Playgrounds than IntelliJ.
Re:An opinionated guide to Haskell by joeblau on Sunday February 11, 2018 @07:01AM (#16352325)
You have access to all of Haskell. I built a command line utility that downloads GitHub status from different cryptocurrency repos and ranks how productive each tokens development team is. It's similar CryptoMiso[1] but I have my own formula for figuring out what's valuable.

From the tutorials they give, you can build all types of stuff. It looks like the IDE supports game development as well as some data analytics tools. In Haskell for Mac, the right side is like Swift Playgrounds (REPL) and the left side is like IntelliJ (IDE). It's actually kinda weird but that's how it's setup.

[1] - https://cryptomiso.com

Re:An opinionated guide to Haskell by vaibhavsagar on Sunday February 11, 2018 @01:21AM (#16351460)
I help maintain IHaskell and I'm sorry to hear you had trouble setting it up. If you'd like to open an issue on the IHaskell repo I can try to help you troubleshoot your install.
Re:An opinionated guide to Haskell by xfer on Saturday February 10, 2018 @02:05PM (#16348889)
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.

Re:An opinionated guide to Haskell by Tomte on Saturday February 10, 2018 @02:23PM (#16349001)
Is OPAM finally abailable for Windows? If not, it‘s definitely worse.

That‘s something Rust got very right from the beginning.

Re:An opinionated guide to Haskell by gmfawcett on Saturday February 10, 2018 @08:42PM (#16350688)
I just installed this today on a Windows machine, and it's working great so far:

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