2

Is there any simple way to install haskell / cabal / stack in an existing msys2 installation? I can't find one.

Note: Apparently it is possible to install both at the same time using MinGHC, see here.

0

(I can't guarantee this will work)

(I can actually guarantee this won't work)

Download a .zip file containing stack for Windows. See the manual download section of this documentation page.

To use it with msys2, copy it to /usr/bin.

To use it with mingw, copy stack.exe to /mingw64/bin (or to /mingw32/bin if using a 32-bit system)

$ stack should now be available. It allows you to use haskell.

You may want to run stack install cabal-install. This installation didn't work for me and I had to hand-copy cabal.exe using the file explorer.

I found $ stack install Stack and $ stack install Cabal to do nothing.

0

Here's the strategy I used. I'll update to mention any caveats as I find them.

Process

  1. Download the Core x64 build of the Haskell Platform.
  2. Extract all of the files to a temporary location. This is an option in the installer
    • I unchecked "Launch Stack's installer" to avoid complications. I've never used Stack before, and I didn't want to learn it while also experimenting with the install
  3. Copy the bin, lib, man, mingw and msys folders from the temp folder to my current msys2 install. The bin, lib, and man folders contain Haskell platform and compiler toolchain; the mingw folder contains the gcc compiler toolchain.

    $ cp -av /c/tmp/Haskell\ Platform/8.4.3/{bin,lib,man,mingw,msys} /usr/local/
    

    As per Unix convention, /usr/local is designated for installs which are managed by the local administrator (i.e. you), and not by the system (i.e. the package manager, pacman in this case). If Haskell becomes available via pacman at some point, my install will not conflict with the new one, except on the PATH.

  4. Add /usr/local/lib/extralibs/bin to the PATH, using my .bashrc. This is the location of cabal and a few other common 3rd-party tools.

Results

$ cabal update succeeded. However, this is my first time back to Haskell in a long while, and my first time using the new local builds feature of cabal, so I'll expect to have a lot of trial and error before I am sure that the MSYS setup is working.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.