Is it possible to pass command line arguments when running Haskell code using `ghc -e`?
Intuitively, I've tried
$ ghc -e "import System.Environment" -e "getArgs" -- a b c
ghc: unrecognised flag: --
did you mean one of:
-n
-F
-v
Usage: For basic information, try the `--help' option.
$
... without success.
I expected the output to be along the lines ["a","b","c"]
.
The docs here don't seem to mention any way to pass cli arguments.
AFAIK pipes in stdio work as expected.
And, perhaps, if it is not possible to pass arguments with ghc -e
, perhaps with, ghci
it is possible to supply both some code and some arguments, run and then exit?
+3
source to share