[ANN] Stack 2.9.1

The feature is documented here: Configuration (project and global) - The Haskell Tool Stack

You could already do it. Something like this (haven’t tested, am on mobile):

#!/bin/bash

set -euo pipefail

case $HOOK_GHC_TYPE in
    bindist)
		echo "$(ghcup run --ghc "$HOOK_GHC_VERSION" --install)/ghc"
        ;;
    git)
		# TODO: should be somewhat possible
        >&2 echo "Hook doesn't support installing from source"
        exit 1
        ;;
    *)
        >&2 echo "Unsupported GHC installation type: $HOOK_GHC_TYPE"
        exit 2
        ;;
esac

Place these contents into ~/.stack/hooks/ghc-install.sh and make the file executable. That should pipe installation through GHCup.

We will then update the GHCup bootstrap script to:

  1. Always install stack by default (you’ll still be able to disable it with an env var)
  2. Ask the user if they want to install the new hook for better integration
3 Likes