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.sh
in the terminal
- Windows:
- Press
Windows
+S
and 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.bat
in 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.hs
and 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.hs
is located in/home/username/downloads/Shrimp
then the correct definition isspc_pathToShrimp = "/home/username/downloads"
Example 2: suppose
spc.hs
is located inC:/Users/username/Downloads/Shrimp
then the correct definition isspc_pathToShrimp = "C:/Users/username/Downloads"
Note: This is what the command
spc --mode=shrimpPath
will print to the terminal. This is required in order forTest.hs
to work. -
Navigate to the directory containing
spc.hs
in the terminal/prompt. Run the commandghc -O2 -i$PATH spc.hs
where$PATH
is the same asspc_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"
-
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 asghc
. -
In order for the generation of traces in the
Interpreted
translation mode to work, the moduleShrimp.Interpreter
needs to be imported. To letghci
know where to find it, the path to the directory containingShrimp
needs to be added to the globalghci.conf
file. 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$PATH
contains spaces, use quotes, e.g.:set "-i/home/my name/downloads"
-
To see if the previous step was successful, open the file
Interpreter.hs
inghci
. 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.hs
withghci
and 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.hs
withghci
again in that case.