-
Notifications
You must be signed in to change notification settings - Fork 847
Description
Often, I want to send someone a small Haskell file to open in the interpreter for e.g. a bug report against a library or a StackOverflow answer. It'd be nice to be able to use the shebang system (or something like it) and have Stack open the file in ghci with the appropriate packages/GHC/etc in place. Concretely, this script
#!/usr/bin/env stack
{-
stack
--resolver lts-6.9
--install-ghc
ghci
--package unbound-0.4.4
--package RepLib-0.5.3.5
-}
main = return ()fails with
$ stack ~/junk/unbound-bug.hs
Invalid argument `ghci'
Error executing interpreter command: stack --resolver lts-6.9 --install-ghc ghci --package unbound-0.4.4 --package RepLib-0.5.3.5 -- /home/enolan/junk/unbound-bug.hs
Usage: stack [--help] [--version] [--numeric-version] [--hpack-numeric-version]
[--docker*] [--nix*] ([--verbosity VERBOSITY] | [-v|--verbose] |
[--silent]) [--stack-root STACK-ROOT] [--work-dir WORK-DIR]
[--[no-]system-ghc] [--[no-]install-ghc] [--arch ARCH] [--os OS]
[--ghc-variant VARIANT] [-j|--jobs JOBS] [--extra-include-dirs DIR]
[--extra-lib-dirs DIR] [--[no-]skip-ghc-check] [--[no-]skip-msys]
[--local-bin-path DIR] [--[no-]modify-code-page]
[--[no-]allow-different-user] [--resolver RESOLVER]
[--compiler COMPILER] [--[no-]terminal] [--stack-yaml STACK-YAML]
COMMAND|FILE
Changing ghci to runghc runs it as expected. Running stack ghci ~/junk/unbound-bug.hs results in Error parsing targets: Directory not found: /home/enolan/junk/unbound-bug.hs regardless of if the file has runghc or ghci in it. Ideally, both stack ghci $FILENAME and writing ghci instead of runghc in the header comment would open the interpreter shell.
Version 1.1.2, Git revision cebe10e845fed4420b6224d97dcabf20477bbd4b (3646 commits) x86_64 hpack-0.14.0