3

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.

2 Answers 2

1

Here's the strategy I used.

Note

Using the Haskell Platform to install Haskell is no longer recommended. Visit Haskell's homepage to see the recommended way to install Haskell, now.

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
  1. 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.

  1. 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.

1
  • 1
    Many thanks for the notes; just want to note that the Haskell Platform link now notes: "The Haskell Platform is deprecated since 2022 and is no longer the recommended way of installing Haskell. For the latest recommended way to install Haskell please see the Downloads page."
    – sdbbs
    Commented Jan 11 at 11:37
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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .