ghc-mod
ghc-mod copied to clipboard
support stack script mode
It would be nice to have support for stack script mode, where a haskell file gets turned into a runable script with no other file :
https://github.com/commercialhaskell/stack/blob/master/doc/GUIDE.md#ghcrunghc
I've thought about this a while ago, I remember coming to the conclusion that it would be easy to implement but looking at it now I can't see an easy way to get the options Stack passes to runghc.
stack runghc --with-ghc=echo doesn't work because runghc doesn't have the --with-ghc option unlike stack ghci --with-ghc=echo which seems to work, except that doesn't seem to honor --package=foo flags. We could use --system-ghc and put some mock executables on PATH but Stack seems to do too many checks to make that trivial so we'd have to simulate ghc-pkg and --numeric-version etc. which makes that unpractical. So unless you can think of another way to tickle this information out of stack we'll have to go raise an issue with them first.
I would also be interested in using ghc-mod with single file scripts either running via nix-shell or just with plain runhaskell. Are there plans for this ?
There are not plans for implementing this, no. But I'd be happy to point anyone in the right direction. Do you want to have a stab at implementing this maybe? :)