atom-haskell / ide-haskell

Haskell IDE plugin for Atom editor

Home Page:https://atom.io/packages/ide-haskell

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ide-haskell gives an error when importing a package from Prelude.

miladz68 opened this issue · comments

commented

in a .hs file when I write
import Control.Monad.Random

I get the following error:

Could not find module ‘Control.Monad.Random’
Use -v to see a list of the files searched for.

I first submitted this issue here in language-haskell, but then i realized It is thrown by IDE-haskell.

I think it has something to do with ghc-mod, but I don't know exactly how to root it out and solve it. and I wonder how I can know which version of ghc is my ide-haskell is using ?

can you help me solve this?

Okay, look. I'm maintaining the whole atom-haskell stack, so you can stop switching repos, I just need to understand what's going wrong for you exactly.

Yes, 'could not find module' is ghc-mod error. I have to wonder if you actually have MonadRandom Haskell package installed.

How is your project setup? Do you use cabal, stack, or neither? Have you tried to build your project?

commented

My project does not use cabal or stack. It is not a big project and contains only one file. (I am only a beginner).
I have installed my Haskell using a full Haskell platform which includes MonadRandom. I run

ghc-pkg list | grep Monad
MonadRandom-0.4.2.3

which I think means that I have MonadRandom installed
and Also when I run

ghc-pkg describe MonadRandom
...
exposed: True
exposed-modules:
Control.Monad.Random Control.Monad.Random.Class

I think the problem is with ghc-mod. I use

ghc-mod check Risk.hs

I get nothing, which I think that it means the file contains no error. (it is the same file that gives error in atom with ide-haskell).

I used to have an older version of ghc-mod and when I ran ghc-mod check Risk.hs I got the same error as I get in atom (I mean "Could not find module ‘Control.Monad.Random’ ..."). Then I updated the ghc-mod to version 5.6.0 and now I don't get the error in terminal but I get it in atom.

I wish I could provide some useful info.

I'm terribly sorry, I missed the notification.

So, if you don't get the error in terminal, but you do in Atom, this probably means Atom uses an older version of ghc-mod then.

Try to specify full path to ghc-mod executable in Atom settings. If you're not sure of what path that is exactly, try running which ghc-mod in terminal if on Mac/Linux or where ghc-mod.exe if on Windows.

F.ex.
image

Hope this helps.

commented

This solved my problem. thanks