News for hackers. Stuff that matters.
Re:Leaving Haskell Behind by Tainnor on Thursday August 24, 2023 @08:14AM (#37247904)
I've also used several languages and IMHO, Haskell's tooling is some of the worst. Language server breaks with random errors all the time for me, I'm always confused about whether I should have ghcup or stack manage my Haskell versions (and what the benefits and drawbacks are), and so on. I have a project I work on from time to time, and I'm 100% sure that the next time I'll open it up, it will stop working again.

Python's mess of dependency and venv management system is probably equally bad, although my experience was that Poetry is decent.

By contrast, Ruby tooling usually works well (you can choose between chruby, rbenv and rvm, but they all work similarly, and Bundler just works(TM)), and Java has its warts but one of the best IDE experiences I've ever seen. Maybe the refactorings aren't as safe as in Haskell, but they're extremely easy to do.

Re:Leaving Haskell Behind by pyrale on Thursday August 24, 2023 @08:21AM (#37247953)
I've used stack+stackage, and I can still run all of my older projects. I agree that as a newcomer the choice is not evident, haskell is a small enough community that finding mentorship is not always evident if you don't know where to look.
Re:Leaving Haskell Behind by mananaysiempre on Thursday August 24, 2023 @08:48AM (#37248151)
> haskell is a small enough community that finding mentorship is not always evident

I don’t know about today, but ten years ago the answer was to hop on IRC and you’d get all of your IRC-sized non-FAQs answered, however difficult they are.

Re:Leaving Haskell Behind by bradrn on Thursday August 24, 2023 @09:22AM (#37248446)
I’m not on IRC, but the subreddit, the Discourse forum and the Discord server are all pretty good for this kind of thing too.
Re:Leaving Haskell Behind by pyrale on Thursday August 24, 2023 @08:54AM (#37248185)
There's libera chat now. But not everyone has the idea of looking there.
Re:Leaving Haskell Behind by tome on Thursday August 24, 2023 @10:54AM (#37249483)
It's still the case, as far as I know. Big list of channels: https://www.haskell.org/irc/
Re:Leaving Haskell Behind by revskill on Thursday August 24, 2023 @08:42AM (#37248101)
Not quite. I'm not sure about how Ruby with Bundler related to each other.

Recently, i upgraded Ruby, but then what's to do about Bundler then ? I'm confused.

Re:Leaving Haskell Behind by Tainnor on Thursday August 24, 2023 @08:46AM (#37248135)
Bundler is Ruby's dependency management tool, basically like npm or similar. It's come preinstalled with Ruby for a while now.
Re:Leaving Haskell Behind by bradrn on Thursday August 24, 2023 @09:21AM (#37248434)
> I'm always confused about whether I should have ghcup or stack manage my Haskell versions (and what the benefits and drawbacks are)

There was a long and drawn-out transition, but these days it’s quite simple: use GHCup to manage your tooling, and Cabal to manage your packages. At one point Stack was the best option, but no longer: it’s not as well maintained, and is missing a lot of features (see e.g. https://discourse.haskell.org/t/6849/23).

Re:Leaving Haskell Behind by Tainnor on Thursday August 24, 2023 @09:39AM (#37248642)
You say "don't use stack" and the other person in this comment thread says "use stack". Do you see the issue?
Re:Leaving Haskell Behind by bradrn on Thursday August 24, 2023 @09:59AM (#37248870)
Fair enough, though I’ll note that only I’ve given an up-to-date reference.
Re:Leaving Haskell Behind by Eddygandr on Thursday August 24, 2023 @10:27AM (#37249117)
Stack vs Cabal was a huge argument where I worked with multiple teams using different build tools. Add Nix and nix2whatever, and it was more fun. Spent half my time debugging build instructions
Re:Leaving Haskell Behind by pastage on Thursday August 24, 2023 @10:45AM (#37249347)
It is not that much better in Java land. Getting builds right takes lots of resources, keeping new and old things running is not trivial.
Re:Leaving Haskell Behind by Tainnor on Thursday August 24, 2023 @10:54AM (#37249480)
I haven't had that experience for newer code bases. Yes, there's some ancient "works only in my IDE" stuff but that's really not how modern Java is written.

Yes, there is a disagreement about whether to use maven or gradle, but IMHO they both work reasonably well out of the box.

Re:Leaving Haskell Behind by Mateon1 on Thursday August 24, 2023 @11:31AM (#37249994)
In my experience, if you have to build an older maven project, you have to go through a lot of painful hoops, mostly around HTTP vs HTTPS repos and java source/compiler versions. I have encountered many old projects that don't build out of the box, and of those, I've only managed to get about half working.
Re:Leaving Haskell Behind by twic on Thursday August 24, 2023 @05:46PM (#37254959)
Right now, things are pretty good. But this is surprisingly recent. Gradle and Maven have both been good at managing dependency versions for a long time. Gradle has also been good at managing the Gradle version, via the wrapper, for a long time; Maven has equivalent wrapper now, but it's quite new, and support in the wider ecosystem is patchy (eg a TeamCity Maven build step can't use a wrapper, i don't think). Meanwhile, there is no standard way to manage JDK versions; there are SDKMAN! and asdf, and they work fine, but they aren't de facto standards. Gradle lets you specify the JDK version to build with via toolchains, but this is quite new (6.7 in 2020). I have no idea if Maven has an equivalent.
Re:Leaving Haskell Behind by Tainnor on Friday August 25, 2023 @09:15AM (#37261351)
While what you say is true, the point about the JDK versions is mitigated a bit by the fact many things are backwards compatible. Although yes, if you jump from 8 to 17, you're going to run into some problems.

I'm not a huge fan of the gradle toolchain tool (I don't think gradle should be managing my JDKs and I would prefer if it could instead just fail the build if you use the wrong JDK version), but I do understand why it exists.

Re:Leaving Haskell Behind by mrkeen on Thursday August 24, 2023 @04:01PM (#37253820)
Yes. I've been in teams where there has been gradle vs maven arguments.

Right now the Mac (M1 or M2) users in our team can't run our integration tests. It has been suggested that if we migrate our 50-100 services to Java 17 then the tests will work for them again. Trying to do this breaks the Gradle scripts, and the errors are so vague I can't tell why it's complaining.

Re:Leaving Haskell Behind by Tainnor on Friday August 25, 2023 @09:17AM (#37261368)
While I understand what you're saying, the "XY doesn't work for mac users on M1/M2" is a really pervasive problem across all technologies.
Re:Leaving Haskell Behind by Tainnor on Thursday August 24, 2023 @10:56AM (#37249526)
In that same thread that you've linked, other people have later replied arguing for why they prefer Stack so... I don't really think that you've given an argument that is persuasive enough to someone who is new to Haskell.

(And I'm not even that new to Haskell. It's just that I don't use it every day and when I come back to it and have to remember the weird incantations and dances I have to perform to make HLS not crash or want to overwrite my stack-installed Haskell version, I'm usually rather annoyed.)

Re:Leaving Haskell Behind by pyrale on Friday August 25, 2023 @04:11AM (#37259307)
> In that same thread that you've linked, other people have later replied arguing for why they prefer Stack so...

I merely stated that I have no trouble running old projects using stack.

> I don't really think that you've given an argument that is persuasive enough to someone who is new to Haskell.

Honestly, cabal improved a lot since the old ages. For a beginner, either stack or cabal should be very fine imo.

> or want to overwrite my stack-installed Haskell version, I'm usually rather annoyed.

Not sure why you would want to do that. Either you use stack and let it handle your ghc install, or you don't, and I really don't see why you would use stack only for compiler install.

Re:Leaving Haskell Behind by Tainnor on Friday August 25, 2023 @09:12AM (#37261319)
> I merely stated that I have no trouble running old projects using stack.

I was referring to the linked forum thread.

> Not sure why you would want to do that. Either you use stack and let it handle your ghc install, or you don't, and I really don't see why you would use stack only for compiler install.

What I mean is that when I start VS Code on my Haskell project again after a couple months, it tells me that it needs to donwload a new version of GHC. And I don't know why since I didn't change anything about my project. And when I try to click on update, it fails and the HLS extension crashes. I can't tell you where exactly this goes wrong, but it's obvious that these tools don't all work well together.

edit: Now I see that my wording was confusing. You quoted me as saying that I want HLS to overwrite my GHC version, but what I meant was that I want to prevent HLS (actually, I should have said the VS Code Haskell plugin) from doing that. The subject of "want" in that sentence you quoted is "HLS".

Re:Leaving Haskell Behind by pyrale on Friday August 25, 2023 @11:42AM (#37262980)
Ah, didn't run into this issue, as I don't use vscode.

Apparently there is some work being done to improve the stack <> hls experience, but I wouldn't know how it's going and when it's being delivered: https://github.com/commercialhaskell/stack/issues/6154

Re:Leaving Haskell Behind by nonameiguess on Thursday August 24, 2023 @10:58AM (#37249556)
You posted a link to a forum. The official Haskell language "get started" page says to use both: https://www.haskell.org/get-started/
Re:Leaving Haskell Behind by george_____t on Thursday August 24, 2023 @05:34PM (#37254846)
It's listed after Cabal as an "alternative", so a lot of people will presumably ignore it if they don't see any reason why they'd want anything else.

I personally wish that page were even more opinionated, but it's politically tricky.

Re:Leaving Haskell Behind by talideon on Thursday August 24, 2023 @11:13AM (#37249771)
I expect that now that things are settling down around pyproject.yaml, Python's tooling will settle down. I've been settling on Hatch for most projects rather than using Poetry these days and Flit for smaller projects. It's managing to replace the mess of makefiles and shell scripts I used to have and supports standardised metadata. These days, I mostly use a combination of hatch, pip-tools (mostly when I'm dealing with lambdas and Django projects), and pipx whenever I'm doing anything with Python. it's not perfect yet, but it's much improved. The new pip dependency resolver still has its issues though if you haven't clamped your dependencies sufficiently and its solver can get caught in loops of excessive backtracking. Hopefully that'll improve too. pyenv is still somewhat hit-and-miss though.

What's really surprised me lately is how much better OCaml's opam tool has gotten! Last time I was using OCaml in anger, the experience was very, very clunky, but these days it's quite smooth.

Re:Leaving Haskell Behind by pdonis on Thursday August 24, 2023 @05:51PM (#37255017)
> I expect that now that things are settling down around pyproject.yaml, Python's tooling will settle down

First, a nitpick: it's pyproject.toml. YAML was considered for the language of this file and rejected in favor of TOML.

Second, unfortunately, I'm not sure I share your optimism. This is an area where IMO the Python developers have never been able to do things right. In fairness, they are trying to support a lot of very different use cases, but the proper way to do that would have been to let the communities surrounding each of those use cases invent their own tools, while focusing the standard tools in the Python standard library on the vast majority of Python projects that are pure python code--no extension modules, no weird compilation issues, just pure Python modules and packages for which build and install ought to be simple and straightforward. But even that simplest use case was never quite properly and standardly supported.

Even pyproject.toml illustrates this pattern: a new markup language was adopted, one which has no support in Python's standard library, which has no obvious advantages over previous file formats, and which now creates ambiguity between pyproject.toml and the previous supposed "standard" for declarative project metadata, setup.cfg. Which do I use now? I can't just use pyproject.toml because it doesn't include everything that setup.cfg does; and I can't just use setup.cfg if I want my project to be compliant with the latest build tool specs because setup.cfg alone is now considered a "legacy" build format. So now I have to use both, even for pure Python projects where this should have been a solved problem years ago.

At least the actual installation of pure Python projects is now a lot easier; once you have a properly built sdist or wheel, pip install will put it wherever you need. But the "properly built sdist or wheel" part is still IMO a lot harder than it needs to be for most projects.

Re:Leaving Haskell Behind by __d on Thursday August 24, 2023 @07:19PM (#37255800)
100% agree re: TOML. Just ... why? Is there really something so compelling about it that makes it worthwhile being different to everything else?

The fact that the PEP was proposed with this, discussed, accepted, implemented and deployed with this is indicative of the failures of process that lead to many of Python's problems. Python3, async, threads, GUI toolkits, the whole mess of tooling ...

Languages and their ecosystems need someone to say "no". To maintain a pragmatic path forward for users of the language, not developers of the language. Python hasn't got this. With all respect to Guido, and now the core group, they let this slide way too often.

Re:Leaving Haskell Behind by js2 on Thursday August 24, 2023 @11:40AM (#37250160)
[delayed]
Re:Leaving Haskell Behind by movpasd on Thursday August 24, 2023 @12:24PM (#37250807)
I don't have any issues with Python's packaging ecosystem anymore, having settled comfortably into a pyenv+virtualenv+pip-tools as my "stack" after going around the block a few times.

But even so, I must recognise how awful the experience is for new users. It's taken me years to settle into this system, and it can take half a day to get someone up to speed with these tools if they haven't used them.

I also work a lot with non-developers who need to use or contribute to Python models, so that doesn't help — but I bet it would take an order of magnitude less time to get them up to speed with something like cargo. Coaching them has helped me see how user-hostile the process is to beginners.

It also doesn't help how infectious "all-in-one" Python distributions like Anaconda can be, to the point that whenever anyone has an unexpected issue one of my first reflexes is to check their PATH. The fact that Rust has a widespread default toolchain multiplexer completely solves this issue.

I appreciate that maintaining such a toolchain is work, and there is value as well in the diversity and choice of an open ecosystem. But perhaps building is one place where first-class support by the reference implementation creates a worthwhile tradeoff.

Re:Leaving Haskell Behind by systems on Thursday August 24, 2023 @01:56PM (#37252338)
why do sometimes people say things like "and it can take half a day to get someone up to speed with these tools if they haven't used them"

half a day is like almost no time at all

half a day is just few hours, how is this a long time .. how is this any time at all

makes me doubt myself a bit, am i too mediocre to think that way

the previous line make more sense to me "It's taken me years to settle into this system" , now this is more like it

Re:Leaving Haskell Behind by carbotaniuman on Thursday August 24, 2023 @03:20PM (#37253381)
I don't think it's half a day to get proficient, it's half a day to hack something half working together so they're unblocked and can do the other stuff they want to do.
Re:Leaving Haskell Behind by throwawaymaths on Thursday August 24, 2023 @04:21PM (#37254043)
And then another half a day to get pissed off because you don't remember what settings are/are not in your venv and trying to exit and/or get back into the venv (assuming no prior experience with venv)

Fundamentally venv breaks your conceptions of what a shell is through cleverness, and that's a problem for people who are new.

Re:Leaving Haskell Behind by codeflo on Thursday August 24, 2023 @05:09PM (#37254585)
Half a day to get something running that's a "one off" for you is insane. With a compiled language project, I'd download a binary. In Python, I need to reproduce the developer's setup. And I've yet to find two different Python projects where the official build instructions are compatible -- each one recommends a different environment virtualizer, a different runtime, different settings, and different C libraries that aren't part of the virtualized environment.
Re:Leaving Haskell Behind by earthboundkid on Thursday August 24, 2023 @07:27PM (#37255873)
The thing that drives me insane about Python packaging is the degree of Stockholm Syndrome. PYTHON PACKAGING HAS KIDNAPPED YOU. YOU DON’T ACTUALLY LOVE IT.

None of Go, JavaScript, or Rust require a half a day to figure out packaging. Don’t defend Python. Push for it to change or leave it behind.

Re:Leaving Haskell Behind by mattgreenrocks on Thursday August 24, 2023 @08:06PM (#37256154)
Half a day is an eternity when it is makework.

Trudging through old SO answers, bad docs, GitHub issues, overly enthusiastic blog posts by someone making a todo app, and, the coup de gras: hitting paywalls on the one tutorial that might help you.

Factor in much higher rates for more senior devs and it amounts to a lot of waste.

Re:Leaving Haskell Behind by Aerbil313 on Friday August 25, 2023 @04:02PM (#37266356)
This whole thread is a discussion of ease vs. simplicity. Easiness is subjective, simplicity is not. We should not compare tools in terms of their ease of use. There was a famous talk on this, maybe someone can link.
Re:Leaving Haskell Behind by kevin_thibedeau on Thursday August 24, 2023 @05:25PM (#37254739)
I have issues precisely because of the misguided preference for virtualenvs in favor of traditional system package installation. It's obnoxious that pip now admonishes you for installing into site-packages even on a Debian system where that can't cause massive breakage. When you need isolated containers it's great. Everyone doesn't need a webdev focused, reproducible build for everyday shell life.
Re:Leaving Haskell Behind by dcow on Thursday August 24, 2023 @05:29PM (#37254775)
You really shouldn’t, though. If you use a dependency manager for some deps you should use it for all deps. Using a global/system cache would be great if dependencies were versioned and each script could specify which version is needed, but they’re not to my knowledge. And it’s all fun and games until some random install script somewhere updates a global dep and your stuff breaks and you don’t know where to even begin looking.
Re:Leaving Haskell Behind by Aerbil313 on Friday August 25, 2023 @04:06PM (#37266401)
I’m still waiting for Nix to mature and for its UX to improve.
Re:Leaving Haskell Behind by movpasd on Friday August 25, 2023 @03:15AM (#37258997)
In my personal experience, it's absolutely necessary. Breaking changes are all over the place. I have non-dev coworkers who have built Python tools without any knowledge of package management, and it's a minefield getting it up and running.

For individualised shell usage, sure. I have global installations of common data science utilities like pandas and jupyter, or requests.

Reproducibility isn't just about deployment, it's also about coordination with colleagues.

Re:Leaving Haskell Behind by dcow on Thursday August 24, 2023 @05:26PM (#37254751)
As someone new to using Python professionally after having used it here and there over the course of 15+ years, I’ve run into exactly this problem. It’s pretty standard for a language these days to bundle the dependency manager and build tooling. Python still does this via shell infection. And since there’s 5 different ways to do it it can leave someone trying to figure out what the right vibe is in 2023 spending hours reading about the pros and cons of everything. And all that just to land back on venv+pip+requirements.txt.

Python needs a cargo. Is Poetry it? I’ve been meaning to try it…

Re:Leaving Haskell Behind by impulser_ on Thursday August 24, 2023 @10:13PM (#37257091)
Have you tried Rye?

https://github.com/mitsuhiko/rye

This is probably the best package manager I used for Python. It feels a lot like Cargo. It sticks to the standards of Python. No custom lock files ect. Uses prebuilt Python so you don't have to build it. Handles global installs easily.

Re:Leaving Haskell Behind by movpasd on Friday August 25, 2023 @03:19AM (#37259020)
This is very interesting indeed! A lot of the design choices fix issues I've also personally encountered. The "experimental" dissuades me from using it for real projects, but I'll be keeping an eye on it.
Re:Leaving Haskell Behind by js2 on Friday August 25, 2023 @01:48PM (#37264758)
> Correctly installed, rye will automatically pick up the right Python without manually activating the virtualenv. That is enabled by having ~/.rye/shims at higher priority in your PATH.

I dislike this pattern. I don't want every language/tool manager in my PATH all the time. I much prefer the direnv. I hook only direnv into my shell. Then I can do what I need with an `.envrc` in each project directory.

Re:Leaving Haskell Behind by dcow on Saturday August 26, 2023 @03:46AM (#37270672)
I hate shell infection because 1) it only works in the shell, 2) it’s not stateless, and 3) depends on your working directory. I mean there’s a reason it’s called “shell infection”. Sounds like Rye specifically aims to address that issue. To each their own, I guess.
Re:Leaving Haskell Behind by movpasd on Friday August 25, 2023 @03:02AM (#37258934)
I've tried Poetry, the CLI is nice and user friendly to be sure, but it has many flaws that made me ultimately avoid it.

In my opinion, it tries to be far too "magic", hiding everything about the virtual environment and dependency management within it. This means that if anything breaks (and it does break!), I find it basically impossible to fix it without wiping everything and rebuilding the environment from scratch.

I find the documentation nice and clean to look at but somewhat clunky to navigate and very incomplete or not explicit enough — especially for beginners. For a tool that seems to want to be a "one-stop shop", you need to know a good deal already about Python packaging already to navigate it. The lack of explicitness also makes it hard to troubleshoot (as evoked above).

These are by far my biggest complaints, with the below bring mostly minor gripes.

Additionally, it seems to be targeted at library developers rather than applications (a distinction which to be fair none of the Python ecosystem makes, to the detriment of DX). This doesn't usually end up being a big issue as it's reasonably easy to "librarify" applications, but it's something else to learn. (Not every project wants wheelification as its end goal.)

The usage of pyproject.toml is nice, but the semantics of the file isn't quite as standardised as one might hope, especially when it comes to reflecting the package you're writing in the virtual environment. And the documentation around pyproject.toml is scattered and sparse. (A PEP is not documentation!)

I've complained a lot, so I should round off by saying that Poetry is a commendable project and I have high hopes for it; but as it exists now it's just too rickety for me to recommend it. But others may disagree, and by all means I'd give it a try for your next project.

My personal recommendation remains pyenv + virtualenv (or venv) + pip-tools, with simple projects just using a requirements.in files and then moving to pyproject.toml once it reaches a modest degree of maturity.

Re:Leaving Haskell Behind by scruple on Thursday August 24, 2023 @01:03PM (#37251483)
I've used Python intermittently throughout my career but today it is my primary language. I've also never really had issues and have pretty much always stuck with the basics. I'm not on a very large team, though. Only 5 developers will ever touch the Python we're writing. I've only ever worked on Python on very small teams, so I wonder if that factors in?
Re:Leaving Haskell Behind by nologic01 on Thursday August 24, 2023 @07:13PM (#37255752)
I think complaining about Python's tooling has become like complaining about the weather in some cold and rainy country. Good for chit-chat and noding in resigned consensus.

In the meantime I cant recall any instance in the last five years (at least) where a project would fail to get going based on a simple venv and pip setup.

An exception is CUDA but I think we can agree this is not what you need to setup every day.

I wonder if that benign view due to Linux and people experiencing something very different in other OS's.

Re:Leaving Haskell Behind by pharmakom on Friday August 25, 2023 @02:41AM (#37258817)
How do you build a bundle for Linux from macOS? In my experience this is only possible with Docker, and is a huge weakness of the Python ecosystem. Would love to hear solutions.
Re:Leaving Haskell Behind by Tainnor on Friday August 25, 2023 @09:06AM (#37261247)
> I got so annoyed with bundler I wrote a simple shell script to provide the moral equivalent of Python venvs to gem:

This already exists: https://rvm.io/gemsets

Most people don't use it because they haven't felt the need. Bundler already makes sure it loads exactly the right versions of gems for your project, so there's no need to isolate them from each other.

Re:Leaving Haskell Behind by grumpyprole on Thursday August 24, 2023 @04:54PM (#37254410)
Having developed Haskell professionally for many years, I've spent the last two years programming OCaml professionally. I've been really enjoying the OCaml tooling: dune, Merlin and ocamlformat work extremely well for me. Dune especially is packed full of features, for example a file-watch mode for tests. Merlin doesn't choke on large codebases like some of the Haskell tooling did and ocamlformat works better than any code formatter I have ever used. The tooling is so good, I can forgive the rather minimal standard library. OCaml is also very good regarding backwards compatibility, new releases don't break our builds.
Re:Leaving Haskell Behind by belmont_sup on Friday August 25, 2023 @11:15AM (#37262659)
I have to agree so much. Been following for years, and started new experiments this week. It all worked so well.

dune init …

opam install some tools like lsp

restart vscode

dune build --watch and I’m good to go.

Re:Leaving Haskell Behind by yawaramin on Sunday August 27, 2023 @12:53AM (#37279520)
1. I agree. And this is being worked on, in the future dune will take on more package management tasks.

2. Agree, YAML has decisively won the config format wars. But dune it's extremely unlikely that dune will change this, and we can at least tell ourselves that s-exprs are pretty cool after all.

3. Yup, I hope Eio becomes the de facto standard in the future.

Re:Leaving Haskell Behind by epolanski on Thursday August 24, 2023 @07:12PM (#37255742)
+1.

I have in most years learned some nicher languages: Elm, Rescript, Racket, Common Lisp.

But nothing is even remotely bad as Haskell is.

Even just setting up an IDE to have basics like syntax highlight or go to definition is a giant chore.

On the official Haskell devcontainer offered by GitHub is nearly impossible to add any external dependency, so having a one-click shareable Haskell environment in the cloud (the very basic to onboard people on the language without wasting them days into having their own inconsistent environment) is a must.

Another thing that I feel sucks is the default documentation for Haskell libraries. Doesn't say anything useful at all, bundles few definitions here and there, 0 examples, and more often than not there's 0 documentation.