3

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.

Mark Seemann
  • 225,310
  • 48
  • 427
  • 736
  • You have to create a cabal file (or yaml file if using hpack) to list down the dependencies. You can quickly get started like this: https://haskell-lang.org/get-started – Sibi Jan 03 '18 at 18:58
  • @Sibi I've routinely been playing with `.hs` files in Atom for a year or more, and whenever I've stuck to 'basic' modules, I've been doing fine without a `.cabal` or `.yaml` file. I know how to create a 'proper' Stack project and add dependencies. This question is specifically about ad-hoc, exploratory programming. – Mark Seemann Jan 03 '18 at 19:05
  • 1
    Ah, I see. You have them installed as global dependencies. Unfortunately I don't use atom and can't be of much help. As a check you can see if `stack exec ghc-pkg list` has your dependency. – Sibi Jan 03 '18 at 19:17
  • 1
    @Sibi Thank you for looking at the question. I understand that you don't use Atom, so you probably can't help, but I'll leave this response for others to see: `vector-0.12.0.1` is included in the list produced by `stack exec ghc-pkg list`, which seems to be consistent with the fact that `stack ghci` can load the module; it's Atom that can't find it. – Mark Seemann Jan 03 '18 at 19:22
  • have you found an answer to this problem? I am having this problem even with `Data.Vector` – matt Apr 07 '18 at 23:56
  • @matthias No, I would happily post an answer to my own question if I managed to get it resolved. I've currently abandoned Atom in favour of VS Code for Haskell development, but [that comes with its own set of problems](https://stackoverflow.com/q/48770086/126014). – Mark Seemann Apr 08 '18 at 07:39

0 Answers0