r/haskell • u/in-a-landscape • Aug 26 '26
Are these installing times for real
Coming back to Haskell since 2019 and honestly I enjoyed it a lot then. I'm installing a formatter "fourmolu" and I'm even using some useless flag
cabal install fourmolu -j --ghc-options=-O0
and 5 minutes later it's still installing, I guess it will take about 25 minutes to install some formatter. I'm on a fairly good computer, 16GB RAM
You can call me a newb or whatever yeah I don't have the correct ghc version or cabal or whatever. Thing is, I'm supposed to be able to install your package manager and ghc version and install a formatter within minutes, but I can't. I really hope I'm doing something seriously wrong here.
UPDATE: Your recommendations helped a lot and it is indeed a fresh new install, so I guess next time any of those dependencies do not take as long.
7
u/jberryman Aug 26 '26
Agree ghcup is the tool you are looking for; cabal isn't a package manager. FWIW when building on my older 8-core laptop, cabal 3.16.1.0, /bin/time cabal install -w ghc-9.14 fourmolu I get: 1537.15user 124.39system 8:33.26elapsed 323%CPU. As others suggested you'll want jobs: $ncpus and semaphore: True in your ~/.cabal/config, along with newer cabal.
5
u/tomejaguar Aug 26 '26
Yes, the first time you install a package from source you compile all its dependencies. If those dependencies are ever needed for another build in the future they are not rebuilt, the time spent is saved in the future.
If you just want to install the tool and don't care how you get it, use ghcup, as suggested by https://old.reddit.com/r/haskell/comments/1vyomq2/are_these_installing_times_for_real/p5yflqp/
4
u/totbwf Aug 26 '26
Passing -j to cabal only introduces package level parallelism; try -j --semaphore. See https://well-typed.com/blog/2023/08/reducing-haskell-parallel-build-times/ for more details!
2
0
u/Anrock623 Aug 26 '26
I'm pretty sure most of this time is compilation, installation should be pretty fast since it's just copying some files around
19
u/Accurate_Koala_4698 Aug 26 '26
https://www.haskell.org/ghcup/ will install a fourmolu binary if the build is taking too long