For working with projects, I’m using apps from Stack. Besides, I usually also have GHCi running for quick checks. And for I didn’t really want duplicating shared libraries and file cache in RAM (i.e. the ones the system GHC is using, plus the ones that Stack does), I’m trying to stick to Stack for everything.
So to force Stack to pass RTS options to ghc and ghci you’d have to use
I.e. I saved aliases to my
~/.zshrc (if you’re using bash, it’d be a
alias ghci512="stack ghci --ghci-options '+RTS -M512m -RTS'" alias ghci="stack ghci --ghci-options ''" alias ghc="stack ghc --ghc-options ''"
Aliases won’t always work (like if you’re using a script not knowing about them), nevertheless are useful most of the time.
UPD: with aliases were problems that I fed up with, so I made up scripts instead:
$ cat /usr/bin/ghciMath512 #!/bin/sh stack ghci --ghci-options "+RTS -M512m -RTS -ghci-script /home/constantine/.ghciMath `echo $@`" $ cat /usr/bin/ghci #!/bin/sh stack ghci --ghci-options "`echo $@`"
echo — it’s needed to collapse multiple arguments into a single with space-separated words.