Skip to content

Instantly share code, notes, and snippets.

@mdjnewman
Last active February 5, 2019 16:32
Show Gist options
  • Save mdjnewman/59fb5d37b76c07041463 to your computer and use it in GitHub Desktop.
Save mdjnewman/59fb5d37b76c07041463 to your computer and use it in GitHub Desktop.
Start ghci in a docker container with workspace mounted
#!/bin/bash
set -e
# Ensure that docker is available and correctly configured if using boot2docker
docker ps > /dev/null
WORKSPACE_HOST_PATH=$(pwd)
WORKSPACE_CONTAINER_PATH=/workspace
mkdir -p $WORKSPACE_HOST_PATH
docker run -it --rm \
-v $WORKSPACE_HOST_PATH:$WORKSPACE_CONTAINER_PATH \
-w $WORKSPACE_CONTAINER_PATH \
haskell:7.10 \
ghci \
"$@"
@mdjnewman
Copy link
Author

Use this script like so:

mkdir haskell-workspace
cd haskell-workspace
wget https://gist.githubusercontent.com/mdjnewman/59fb5d37b76c07041463/raw/ghci-docker.sh
chmod u+x ghci-docker.sh
./ghci-docker.sh

If you see something that starts with 'GHCi, version 7.10.2', then you're good to go. Hit Ctrl-D or type :q to exit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment