You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 7, 2020. It is now read-only.
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:
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.
The text was updated successfully, but these errors were encountered:
Actually, preliminary tests seem to indicate that stack scripts are working right now.
What you have to do right now is to create a hie.yaml.
cradle:
stack:
component: "filename.hs"
Note though, that currently this hie.yaml is always used by haskell-ide-engine as the project root.
So, if you have a project with stack script in it, the hie.yaml is used to establish the project context and in this particular case, hie would cease to function properly. Then you would have to extend the hie.yaml properly into a multi-cradle:
cc @mpickering , this works because you can pass a filepath to stack repl but the multi-cradle clearly violates the assumption that one hie.yaml represents one project.
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:
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: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:
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.
The text was updated successfully, but these errors were encountered: