CS 3040: Installing Glasgow Haskell Compiler

Windows Users

Directions for Mac and Linux users are given at the bottom.

  1. Install Chocolatey:
    1. Visit https://chocolatey.org/install (or go to https://chocolatey.org and click on Get Started)
    2. You can skip the Chocolatey Newsletter prompt.
    3. Follow the steps for the Individual installation using Windows PowerShell. In particular:
      1. Click on the Windows Start icon, type "PowerShell", and select Run as Administrator
      2. Type Set-ExecutionPolicy AllSigned and hit return.
      3. Click on the clipboard icon to copy the command and paste it into the PowerShell prompt.
    4. Close the PowerShell Prompt.
    5. Open a new elevated prompt. You can re-open PowerShell (as administrator) or right click on the Command Prompt icon in the Start menu, select More, then select Run as administrator. Type
                  choco  
      
      If you get a command not found error, ask for help.
  2. To install Haskell:
    1. Open a command prompt with administrator access.
    2. Type
              choco install -y haskell-dev
              refreshenv
      
    3. Confirm it's running:
              ghci
      

If it is not working correctly, you may wish to reboot your laptop. This would ensure the PATH variable is correct in all environments.

If you get the error "user specified .o/.so/.DLL could not be loaded (addDLL: pthread or dependencies not loaded. (Win32 error 5))", one solution is run ghci as administrator, but better is to change the security settings for c:\Windows\System32\pthread.dll and add a permission for "Users" to read & execute the dll. The system will ask about granting permissions to folders, but this is a spurious warning (you're just changing a file) and it can be ignored.

Note you can now type choco install -y xyz or cinst -y xyz to install other packages. If you enter

       choco feature enable -n=allowGlobalConfirmation 
then you don't have to give the -y option or affirm installation. Packages to consider: A win of using Chocolatey is you can update all packages with cup all.

Mac Users

The simplest way is

        brew install ghc
However, a distributed installer is also available; see the distribution_packages page

Ubuntu/Linux Users

apt-get should likely work. There are also distribution packages here.