[Haskell-cafe] HLS in VS Code is identifying problems that don't when I run stack on the command line

Dennis Raddle dennis.raddle at gmail.com
Sat Jan 7 20:53:06 UTC 2023


Sorry it was a bit late when I wrote that last night so it was unclear.

stack is using GHC  8.10.7 while Haskell Language Server seems to be using
GHC 9.4.4. At various points while using VS Code I've gotten popups like
"HLS is unable to determine GHC version" but later those stopped happening.

Is this a problem that they are using different versions? Would this
explain why HLS thinks mtl is hidden even though it's exposed in my cabal
file?

Mike


On Sat, Jan 7, 2023 at 5:40 AM Dennis Raddle <dennis.raddle at gmail.com>
wrote:

> I'm opening the project by running VS Code first, then opening the root
> folder of the project. I don't have a 'code' command installed or no path
> to it set; this doesn't happen by default on MacOS but I could look it up.
>
> But I think I got a better clue by running haskell-language-server-wrapper:
>
> I got this line.
> Run entered for
> haskell-language-server-wrapper(haskell-language-server-wrapper) Version
> 1.9.0.0 x86_64 ghc-9.4.4
>
> And then:
>
> Tool versions found on the $PATH
> cabal:          3.6.2.0
> stack:          2.3.3
> ghc:            8.10.7
>
> My stack.yaml is using the resolver
> lts-18.19
> which does specify GHC 8.10.7 according to what I looked up.
>
> But that ghc-9.4.4 seems to be a problem.
>
> Thanks! But how to fix?
>
>
>
> On Sat, Jan 7, 2023 at 5:13 AM Fendor <power.walross at gmail.com> wrote:
>
>> How are you launching VSCode? Make sure you open the root of the project
>> in VSCode.
>> Opening VSCode from the cli via `code .` when you are in the correct
>> directory is the most reliable.
>>
>> Further, on the cli, try running HLS like this:
>> `haskell-language-server-wrapper --debug <some-path-to-a-source-file>` from
>> the root of your project.
>> Does this report the same error? If yes, more info about the project is
>> needed like the .cabal file and the logs. Otherwise, it is a problem with
>> the editor (e.g., PATH variable shenanigans).
>>
>> Best regards,
>> Fendor
>> On 07/01/2023 10:00, Dennis Raddle wrote:
>>
>> I'm trying to get HLS set up with a stack project on VS Code. I'm getting
>> messages like this:
>>
>> Could not load module ‘Control.Monad.Except’
>> It is a member of the hidden package ‘mtl-2.2.2’.
>> You can run ‘:set -package mtl’ to expose it.
>> (Note: this unloads all the modules in the current scope.)
>>
>> But these are in the "Problems" tab of VS Code (and show as red
>> underlines).
>>
>> When I run stack clean, stack build I don't see any error like this at
>> all.
>>
>> And yes, I made sure mtl was added everywhere in cac.cabal. (I'm using
>> cac.cabal not stack.yaml... is that my problem?)
>>
>> I tried stack clean; stack build; restart HLS several times.
>>
>>
>>
>> _______________________________________________
>> Haskell-Cafe mailing list
>> To (un)subscribe, modify options or view archives go to:http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>> Only members subscribed via the mailman list are allowed to post.
>>
>> _______________________________________________
>> Haskell-Cafe mailing list
>> To (un)subscribe, modify options or view archives go to:
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>> Only members subscribed via the mailman list are allowed to post.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20230107/1b74f873/attachment.html>


More information about the Haskell-Cafe mailing list