ghc-mod icon indicating copy to clipboard operation
ghc-mod copied to clipboard

support stack script mode

Open nrolland opened this issue 10 years ago • 3 comments

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

nrolland avatar Nov 27 '15 11:11 nrolland

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.

DanielG avatar Nov 27 '15 13:11 DanielG

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 ?

miguel-negrao avatar Dec 16 '17 11:12 miguel-negrao

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? :)

DanielG avatar Dec 17 '17 04:12 DanielG