Skip to content

Instantly share code, notes, and snippets.

@paulp
Last active August 28, 2016 19:00
Show Gist options
  • Select an option

  • Save paulp/5fed2db283ec28442cfee0a465dcf437 to your computer and use it in GitHub Desktop.

Select an option

Save paulp/5fed2db283ec28442cfee0a465dcf437 to your computer and use it in GitHub Desktop.
A script for running typelevel scala.
#!/usr/bin/env bash
#
run () { echo >&2 "$@" && "$@"; }
typelevel () {
coursier fetch org.typelevel:scala-compiler:2.11.8 | paste -sd: -
}
ammonite () {
coursier fetch com.lihaoyi:ammonite_2.11.8:0.7.2 | egrep -vw 'scala-lang' | paste -sd: -
}
CP="$(typelevel)"
MAIN="scala.tools.nsc.Main"
ARGS=( -usejavacp )
case "$1" in
compile) shift ;;
repl) shift && MAIN="scala.tools.nsc.MainGenericRunner" ;;
amm) shift && MAIN="ammonite.Main" && CP="$CP:$(ammonite)" && ARGS=() ;;
esac
run java -cp "$CP" "$MAIN" "${ARGS[@]}" -Yliteral-types -Ypartial-unification "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment