vscode-haskell
vscode-haskell copied to clipboard
Running HLS features on a standalone Haskell script
Having a following script:
#!/usr/bin/env cabal
{- cabal:
build-depends: base
, split
-}
import Data.List.Split (splitOn)
main :: IO ()
main = do
let orders = splitOn "x" "axbxc"
putStrLn $ head orders
I want to be able to have HLS features on this script. Is it possible in any way?
Hi! Unfortunately, this is not possible at the moment. You might be able to get a similar result by using cabal install --lib base split --package-env=.
and creating a hie.yaml
file with the contents:
cradle:
direct:
arguments:
- -package-env
- .ghc.environment.x86_64-linux-<version> # check what file has been generated after `cabal install --lib --package-env=.`
- Script.hs
Native support ticket: https://github.com/haskell/hie-bios/issues/217 Some context for environment files: https://ghc.gitlab.haskell.org/ghc/doc/users_guide/packages.html#package-environments
closing, since no activity, and also, not the job of vscode-haskell. See here the discussion for a workaround: https://github.com/haskell/haskell-language-server/discussions/3572