Skip to content

Instantly share code, notes, and snippets.

@maurges
Created February 27, 2026 12:10
Show Gist options
  • Select an option

  • Save maurges/ed5d60677d149e2b68bb4fd60324b4e1 to your computer and use it in GitHub Desktop.

Select an option

Save maurges/ed5d60677d149e2b68bb4fd60324b4e1 to your computer and use it in GitHub Desktop.
Stack launcher that doesn't rebuild the world upon a sneeze of flags
#!/usr/bin/env bash
tests=false
benches=false
fast=false
for arg in "$@"; do
case "$arg" in
--test|test) tests=true ;;
--bench|bench) benches=true ;;
--fast) fast=true ;;
esac
done
workdir=".stack-work"
( $tests || $benches || $fast ) && workdir+="/target"
$tests && workdir+="-test"
$benches && workdir+="-bench"
$fast && workdir+="-fast"
stack --work-dir="$workdir" "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment