How to pin dhall-haskell version?


#1

Hello,

Is their a recommended way of pinning the version of dhall-haskell inside the repo with the Dhall source code? I have two requirements:

  1. ensure all team members are running the same version of the compiler (that is compatible with the source code language version).
  2. ability to easily install different versions of the compiler on the same system (e.g. if we have multiple repos with Dhall source code targeting different language versions).

Basically, I’m looking for something like rbenv, nodenv, etc.

Does something like this exist?

I had considered adding a stack.yaml file to the project and encouraging installation through stack install dhall, but this will install the binary globally for the user on the system, so this does not help with the second requirement.

Many thanks!


#2

I suppose something like dhall-env like rustup or opam would be useful :o


#3

@willsewell: Do you mean using the dhall command-line tool or do you mean using dhall Haskell package as a dependency of a Haskell project?


#4

@Gabriel439 I mean the command-line tool


#5

If you only need the command-line executable then you don’t necessarily even need cabal or stack to obtain dhall. You can download a statically-linked binary from our release page here for Windows, OS X, or Linux:

However, if you’re still interested in how to transiently obtain an executable inside a virtual environment then I highly recommend learning more about Nix for this purpose, specifically the nix-shell command.

For example, if you run:

$ nix-shell --packages dhall

That will create a virtual environment with the dhall executable added to your path.

If you’re interested in learning more about that I can show you how you can pin things down further by creating a shell.nix file.


#6

Thanks for the suggestions @Gabriel439. My main concern about using nix is it would require introducing a new tool that we are not currently familiar with. It does sound like it would solve our problem, so maybe it’s time I give it a try!

In the meantime I think the best option is to specify the compatible dhall-haskell version in repo READMEs and let devs install it however they wish (e.g. one of the prebuilt binaries stored in the repo containing the dhall source code).


#7

I use asdf to manage the versions of all the tools that I use. There is a dhall plugin for asdf: https://asdf-vm.com/#/. You can see an example of how I use it in https://github.com/ggilmore/kickstart. As an example, this PR is how I bumped the dhall version to the new 1.35.0 release: https://github.com/ggilmore/kickstart/commit/df7ff307f551bb8ec8f9f79f8a966cc985a91250


#8

Thanks @ggilmore, that looks promising! I’ll give it a go. I hadn’t actually heard about asdf before.

Btw for future readers, I think the plugin you meant to link to is at https://github.com/aaaaninja/asdf-dhall.


#9

Ah yes, that’s my bad. However you don’t need to add that repository explicitly since it’s been added to https://github.com/asdf-vm/asdf-plugins. This means that the following will just work:

asdf plugin-add dhall

#10

@ggilmore perfect! I’m going to give this a go. Thanks.