Closed
Description
Describe the bug
Attempting to use cabal as script interpreter seems to not work in windows, even using mingw64 shell
To Reproduce
Steps to reproduce the behavior:
Create a test.hs
file:
#!/usr/bin/env cabal
{- cabal:
with-compiler: ghc-8.6.5
build-depends: base
-}
main :: IO()
main = putStrLn "Interpret me please"
- Run
cabal v2-run test.hs
command in a dos shell - Or run
./test.hs
in a mingw shell
Expected behavior
The script should be interpreted and show the message
Actual behavior
- cabal throws an error:
Resolving dependencies...
Build profile: -w ghc-8.6.5 -O1
In order, the following will be built (use -v for more details):
- fake-package-0 (exe:script) (configuration changed)
Configuring executable 'script' for fake-package-0..
Preprocessing executable 'script' for fake-package-0..
Building executable 'script' for fake-package-0..
[1 of 1] Compiling Main ( Main.hs, \path\to\test-interpreter\di
st-newstyle\build\x86_64-windows\ghc-8.6.5\fake-package-0\x\script\build\script\
script-tmp\Main.o )
Main.hs:1:1: error:
Could not load module ‘Prelude’
It is a member of the hidden package ‘base-4.12.0.0’.
Perhaps you need to add ‘base’ to the build-depends in your .cabal file.ile.
it is a hidden module in the package ‘hackage-security-0.5.3.0’
Use -v to see a list of the files searched for.
|
1 | {- cabal:
| ^
System informataion
- Windows
cabal
cabal-install version 2.4.1.0
compiled using version 2.4.1.0 of the Cabal library
- ghc, any, tested with 8.6.5
Additional context
Trying to build haskell-ide-engine
with cabal, using the script feature: haskell/haskell-ide-engine#1221