Last active
March 1, 2021 14:18
-
-
Save simonmichael/42fa4828490ff71355b8c9029f036e4d to your computer and use it in GitHub Desktop.
symlinkghc - Symbolically link the ghc tools provided by the global stack resolver into PATH
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Usage: symlinkghc | |
# Symbolically link the ghc tools provided by the global stack resolver | |
# (ghc ghci runghc runhaskell ghc-pkg haddock hp2ps hpc hsc2hs, | |
# ~/.stack/global-project/stack.yaml) | |
# into ~/.local/bin, so that they are always available at the command | |
# line for quick experiments. ~/.local/bin should be in your PATH. | |
# Similarly named executables/links in that directory will be overwritten. | |
# GHC will be downloaded if needed, eg if you just updated the global stack resolver. | |
# Caveat: these will see only the ghc package db by default, not new packages you have installed. | |
cd || exit | |
stack setup | |
STACKBIN=$(stack path --compiler-bin) | |
USERBIN="$HOME/.local/bin" | |
EXES="ghc ghci runghc runhaskell ghc-pkg haddock hp2ps hpc hsc2hs" | |
for EXE in $EXES; do ln -sf "$STACKBIN"/"$EXE" "$USERBIN"/"$EXE" done | |
echo "$EXES installed in $USERBIN" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment