Support for stack scripts? #1453
Description
Just C+P-ing my question from stack overflow:
I'm just getting started with learning how to use haskell for scripting, and I've got something like this:
#!/usr/bin/env stack
-- stack --resolver lts-14.13 script
{-# LANGUAGE OverloadedStrings #-}
import Turtle
main :: IO ()
main = echo "hello"
When I run this with stack script.hs
, it auto-magically installs turtle and prints "hello". However, my editor gives me this error on the import line:
[ghcmod] [E] Could not find module ‘Turtle’
This makes some sense to me because the hie-wrapper I installed (from source, if it matters), isn't aware of where stack has installed the turtle package.
The way I have my HIE hooked up is like so, using coc.nvim:
"languageserver": {
"haskell": {
"command": "hie-wrapper",
"rootPatterns": [
".stack.yaml",
"cabal.config",
"package.yaml"
],
"filetypes": [
"hs",
"lhs",
"haskell"
],
"initializationOptions": {
"languageServerHaskell": {
}
},
}
},
Are there some flags or something I can pass to hie-wrapper to get it to play nicely with Haskell scripts, ie. detect packages? Would greatly appreciate any answer that makes it a bit more clear how this stuff fits together, ghc/hie/hie-wrapper/stack/cabal are a big black box to me currently, making this hard to debug.