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:
- Navigate to the directory Shrimp in the terminal
- Mark install.sh as executable:
chmod +x install.sh - Type
./install.shin the terminal
- Windows:
- Press
Windows+Sand typecmd - Right-click on the command prompt application and select
Run as admin - Navigate to the directory Shrimp in the command prompt (e.g.
cd C:/Users/xy/Shrimp) - Type
install.batin the command prompt
- Press
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:
-
Open
spc.hsand modify the definition of the variablespc_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.hsis located in/home/username/downloads/Shrimpthen the correct definition isspc_pathToShrimp = "/home/username/downloads"Example 2: suppose
spc.hsis located inC:/Users/username/Downloads/Shrimpthen the correct definition isspc_pathToShrimp = "C:/Users/username/Downloads"Note: This is what the command
spc --mode=shrimpPathwill print to the terminal. This is required in order forTest.hsto work. -
Navigate to the directory containing
spc.hsin the terminal/prompt. Run the commandghc -O2 -i$PATH spc.hswhere$PATHis the same asspc_pathToShrimpwithout the double quotes (see above). If$PATHcontains spaces then you need to add quotes, e.g.ghc -O2 "-i/home/my name/downloads" -
Assuming compilation was successful, copy (or move) the
spc-executable to a directory which is included in$PATHso that it can be called from anywhere. It is recommended to put it in the same directory asghc. -
In order for the generation of traces in the
Interpretedtranslation mode to work, the moduleShrimp.Interpreterneeds to be imported. To letghciknow where to find it, the path to the directory containingShrimpneeds to be added to the globalghci.conffile. Possible locations of this file:$HOME/.ghc/ghci.conf(Linux/Mac)$HOME/.ghci(Linux/Mac)%APPDATA%/ghc/ghci.conf(Windows)
-
Open
ghci.conf(or create it if it does not exist) and add the line:set -i$PATH. If$PATHcontains spaces, use quotes, e.g.:set "-i/home/my name/downloads" -
To see if the previous step was successful, open the file
Interpreter.hsinghci. It should print something like the following at the start:Loaded GHCi configuration from /home/username/.ghc/ghci.conf -
The installation is done now. To test it, you can open
Test.hswithghciand call the functionmain.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 openingTest.hswithghciagain in that case.