Install

In order to use Shrimp you have to download and install GHC (Haskell compiler). If you have not done this yet, visit https://chandoo.de/shrimp/#download and follow the instructions.

Shrimp comes with an automatic installer that sets up everything for you. If the automatic installer fails, check out the instructions for the manual installation. If that fails as well, feel free to contact me and tell me your operating system, version of GHC and provide the output of the installer.

Automatic Installation

To run the automatic installation you have to execute install.sh on Linux/Mac and install.bat on Windows. The installation might require root/admin permissions since the executable spc could be copied to a write-restricted directory.

  • Linux/Mac:
    1. Navigate to the directory Shrimp in the terminal
    2. Mark install.sh as executable: chmod +x install.sh
    3. Type ./install.sh in the terminal
  • Windows:
    1. Press Windows+S and type cmd
    2. Right-click on the command prompt application and select Run as admin
    3. Navigate to the directory Shrimp in the command prompt (e.g. cd C:/Users/xy/Shrimp)
    4. Type install.bat in the command prompt

After the installation finishes, it asks you whether you want to test the installation. If you select no then you can still do the tests later by opening Test.hs with ghci and calling the function main.

Manual Installation

The following steps are required to install Shrimp manually:

  1. Open spc.hs and modify the definition of the variable spc_pathToShrimp (appears after the imports). It needs to be defined as the path to the directory which contains the directory Shrimp.

    Example 1: suppose spc.hs is located in /home/username/downloads/Shrimp then the correct definition is spc_pathToShrimp = "/home/username/downloads"

    Example 2: suppose spc.hs is located in C:/Users/username/Downloads/Shrimp then the correct definition is spc_pathToShrimp = "C:/Users/username/Downloads"

    Note: This is what the command spc --mode=shrimpPath will print to the terminal. This is required in order for Test.hs to work.

  2. Navigate to the directory containing spc.hs in the terminal/prompt. Run the command ghc -O2 -i$PATH spc.hs where $PATH is the same as spc_pathToShrimp without the double quotes (see above). If $PATH contains spaces then you need to add quotes, e.g. ghc -O2 "-i/home/my name/downloads"

  3. Assuming compilation was successful, copy (or move) the spc-executable to a directory which is included in $PATH so that it can be called from anywhere. It is recommended to put it in the same directory as ghc.

  4. In order for the generation of traces in the Interpreted translation mode to work, the module Shrimp.Interpreter needs to be imported. To let ghci know where to find it, the path to the directory containing Shrimp needs to be added to the global ghci.conf file. Possible locations of this file:

    • $HOME/.ghc/ghci.conf (Linux/Mac)
    • $HOME/.ghci (Linux/Mac)
    • %APPDATA%/ghc/ghci.conf (Windows)

  5. Open ghci.conf (or create it if it does not exist) and add the line :set -i$PATH. If $PATH contains spaces, use quotes, e.g. :set "-i/home/my name/downloads"

  6. To see if the previous step was successful, open the file Interpreter.hs in ghci. It should print something like the following at the start: Loaded GHCi configuration from /home/username/.ghc/ghci.conf

  7. The installation is done now. To test it, you can open Test.hs with ghci and call the function main.

    Note: it might complain about an index error (e.g. *** Exception: Ix{Int}.index: Index (1035) out of range ((0,189)). This seems to be a sporadic bug (only witnessed on Windows so far), try opening Test.hs with ghci again in that case.