Why can I load a module in GHCi, while Atom can

2019-07-09 05:52发布

问题:

I'm using Haskell with Stack and Atom on Windows 10. Sometimes, I like to just write a stand-alone .hs file to play around with various things. When I do that, I prefer to interact with it using GHCi.

Usually, I start it from Git Bash:

$ stack ghci --color never

From here, I can add modules:

Prelude> :m +Data.Vector.Unboxed
Prelude Data.Vector.Unboxed>

In Atom, however, I'm having trouble with that particular package:

  1. Open Atom
  2. Create a new .hs file
  3. Add this following content to it and hit Save:

File contents:

module Ploeh where

import qualified Data.Vector.Unboxed as V

When I save the file, I get this error message in Atom:

Failed to load interface for `Data.Vector.Unboxed'
Use -v to see a list of the files searched for.

If I remove the import of Data.Vector.Unboxed, the error message goes away.

This problem happens specifically with Data.Vector.Unboxed. Other modules are either consistently present in both GHCi and Atom, or consistently missing in both environments, but particularly this module behaves inconsistently.

I suppose Atom uses a different engine than the 'global' configuration used by stack ghci, but if so, where is it, and can I configure/update it? Why the difference?


I'm using the following Atom packages:

  • autocomplete-haskell 1.0.1
  • haskell-ghc-mod 2.2.2
  • ide-haskell 2.2.2
  • ide-haskell-cabal 2.1.0
  • language-haskell 1.17.2

Atom itself is version 1.23.2 x64.

$ stack --version
Version 1.6.3, Git revision b27e629b8c4ce369e3b8273f04db193b060000db (5454 commits) x86_64 hpack-0.20.0

I believe that everything is up-to-date.

I've read https://atom-haskell.github.io/core-packages/haskell-ghc-mod/#using-with-stack and other parts of the documentation to see if I could find some useful information, but I've failed to find something to enlighten me.