Skip to content

Instantly share code, notes, and snippets.

@cobalamin
Created May 11, 2016 21:09
Show Gist options
  • Select an option

  • Save cobalamin/6fc45dd81844f7788b2d77f56564cc7f to your computer and use it in GitHub Desktop.

Select an option

Save cobalamin/6fc45dd81844f7788b2d77f56564cc7f to your computer and use it in GitHub Desktop.
The Glorious Good Job Haskell Compiler
#!/bin/bash
### THE GLORIOUS GOOD JOB HASKELL COMPILER
compliments=(
"Wow, what a monad!"
"Outstanding work with the types."
"You look beautiful today, and so does your code."
"Hey, that's pretty good."
"Nice meme."
"\"If it compiles, it works\"? -- Well, I'm just the compiler, what would I know. But it did compile, so, well done."
"Live long and prosper."
"YEEEEEEEEEEEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
"Stylish indentation!"
"No need for code highlighting, your code's the highlight."
)
##
# Check if stack exists, and use "stack ghc" or "ghc" depending on the result
##
command -v stack
if [ $? -eq 0 ]; then
stack ghc "$@"
else
ghc "$@"
fi
##
# After running GHC, get its exit code. If it was a success, compliment!
##
if [ $? -eq 0 ]; then
c=${compliments[$RANDOM % ${#compliments[@]} ]}
echo
echo "$c"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment