7 ms·
> OCaml's is also excellent but not immediately obvious (their docs have improved a lot) Interesting! The last time I tried OPAM, it actually seemed more frust
by bjz_ 6y ago
> OCaml's is also excellent but not immediately obvious (their docs have improved a lot)
Interesting! The last time I tried OPAM, it actually seemed more frustrating than Cabal! Maybe it's improved? Last time I tried OPAM it would install packages globally by default, and avoiding that was a confusing process, when that should be the default behavior.
Cargo (while not perfect) has really nice defaults out of the box - ie. it generates a lockfile by default, scopes packages locally to individual projects, and lets you use more than one package of the same version in the same project.
Really hoping OCaml and Haskell can improve their package management story - they are getting there, but it still holds me back from really using them on a daily basis.
- pdimitar 6y agoI got told some months ago to look for these docs: https://news.ycombinator.com/item?id=22395595 https://news.ycombinator.com/item?id=22395595 It seems all we want can be made to work but it does require some tinkering and being aware of the tools' options.
- ghostwriter 6y ago> Really hoping OCaml and Haskell can improve their package management story - they are getting there, but it still holds me back from really using them on a daily basis. Cabal 3.x with Nix-style buildscovers all packaging needs that I ever had with Haskell ecosystem[1]. And there's a new wave of tooling based on incremental Nix builds, that you can begin using today [2] [1] https://cabal.readthedocs.io/en/latest/nix-local-build-overview.html https://cabal.readthedocs.io/en/latest/nix-local-build-overv... [2] https://github.com/nmattia/snack https://github.com/nmattia/snack
- bjz_ 6y agoYeah, it's really great to see the progress there. However, afaik, it still doesn't freeze packages by default, or let you have multiple packages of the same version in a dependency tree[1]. The former can be worked around, but it's annoying that it's not the default. The latter is more frustrating however! [1] https://news.ycombinator.com/item?id=23454711 https://news.ycombinator.com/item?id=23454711
- lallysingh 6y agoStack does this, if I understand what you're saying. Stack+nix has worked quite well for me for a few projects.
- marcosdumay 6y agoYep. Cabal 3.x is great, better than anything else I've seen for any other language. As the article says, it just needs to correct the default behavior (deprecating the old behavior is on the roadmap, interestingly, the documentation doesn't even say what is the standard right now) and some improvements on usability (just better docs goes a long way).
- nextos 6y agoA bit off topic, but is Haskell viable for production? Or is it just really intended as an experiment? Is it worthwhile to jump into Haskell now, or perhaps one should look into Idris or Agda? Any companies using Haskell where it has proven a distinct advantage? Ocaml and SML (the former being sadly quite unpopular these days) are an order of magnitude simpler than Haskell. They are easy to master. I have been quite productive with Scala which, while being a member of the ML family, is much more intricate due to OO + FP on top of great Java interop and many Haskell-like features (laziness, monads, lenses...). Haskell doesn't feel the same. I have learned some Haskell over the years. Since I come from a pure FP education (started with SML) and I have lots of type theory background, everything feels familiar, yet I've found it really hard to be productive or to justify the mental overhead of laziness. I have developed some small projects in Haskell, but I haven't found it a productive alternative to the languages above.
- the_af 6y ago> A bit off topic, but is Haskell viable for production? Or is it just really intended as an experiment? It's viable for production and there are businesses which use it, notably fintechs. Also Facebook for some things (Facebook employs Simon Marlow [1]). And I know this is an irrelevant anecdote, but I have a friend who has been working in several startups which use Haskell for the last few years. Like Paul Graham has argued of Lisp, Haskell really is a "secret weapon" and people who use it for production tend to love it. EDIT: a prior version of this post claimed Facebook employed Philip Wadler, which is incorrect. Sorry! I got my wires crossed and confused Philip Wadler with Simon Marlow! [1] https://www.linkedin.com/in/simonmarlow/ https://www.linkedin.com/in/simonmarlow/
- auggierose 6y agoFacebook employs Wadler? Since when?
- the_af 6y agoGah! I meant to say Simon Marlow [1], co-developer of the Glasgow Haskell Compiler (GHC) [2]. Sorry for the confusion, I'll edit my other post now. [1] https://www.linkedin.com/in/simonmarlow [2] https://en.wikipedia.org/wiki/Simon_Marlow
- Erlangen 6y agoPackages are not installed globally in opam by default nowadays. `opam switch` "enables the user to have several installations on disk, each with their own prefix, set of installed packages, compiler version, etc". https://opam.ocaml.org/doc/Usage.html#opam-switch https://opam.ocaml.org/doc/Usage.html#opam-switch
- bjz_ 6y agoOh that's nice to hear! Some questions: Do you have to run this command manually, and does it mutate the shell state? That's one thing that frustrated me with opam in the past as well. I couldn't just jump into a directory and build a thing, then switch to another project directory - there was a lot of manual switching and unswitching of packages if I recall correct? Is it possible to install multiple tools globally using opam that use disjoint library versions? Like, I might want to install Abella and Coq side-by-side, but they might have conflicting version requirements. I think I was super excited about opam 2, then tried installing one thing, only to have it break again when I installed something else. Is it possible to have multiple versions of the same libray in the same project, or does the constraint solver need to find a single solution for each library? [1] [1] https://news.ycombinator.com/item?id=23454917 https://news.ycombinator.com/item?id=23454917
- Erlangen 6y agoSorry I miss your reply. I create opam switches to have different versions of compiler, or allow libraries that conflict to live at different branches. 1. Dune is a relative new build system for Ocaml. You just write a configuration file, and dune will handle switches automatically. "It also supports multi-context builds, such as building against several opam roots/switches simultaneously. This helps maintaining packages across several versions of OCaml and gives cross-compilation for free." See https://opam.ocaml.org/packages/dune/ https://opam.ocaml.org/packages/dune/ 2. Yes. You can can multiple versions library at different switch. 3. I am not sure.
- talex5 6y agoBy default, opam installs everything into the current "switch". Typically you have switch one per compiler, but you can create one per project. You can also create a "local" switch directly inside your project directory: https://opam.ocaml.org/blog/opam-local-switches/ https://opam.ocaml.org/blog/opam-local-switches/ Another option is to use the duniverse tool (https://github.com/ocamllabs/duniverse https://github.com/ocamllabs/duniverse). That downloads all dependencies to the project directory, and then builds them all together as one giant project. That makes it very easy to make changes across multiple libraries at once, while keeping fast incremental builds. And a final option is to build projects with Docker, which allows you to have separate versions of non-OCaml packages too.
- bjz_ 6y agoAhh cool - had some similar questions here: https://news.ycombinator.com/item?id=23460980 https://news.ycombinator.com/item?id=23460980 - mainly, how much manual switching do you have to do? Or is it seamless, depending on what project directory your in? I think I tried the local switches in the past and got really confused when switching projects and everything broke, thinking 'wasn't all this meant to prevent this?'.
- andrepd 6y agoMaybe you tried it before v2? Imho opam now is very usable, lets you be productive for 95% tasks after reading a 5min introduction, and generally gets out of your way.