[Haskell-beginners] ghc-mod and cabal "could not find module Prelude"

Alan Buxton alanbuxton at gmail.com
Tue Jun 23 17:47:05 UTC 2015


Thanks for the suggestions:

 

Imants: 

There is

 

library

  build-depends:              base ==4.6.*

 

(The cabal file was generated by cabal init and so I would hope it's legit :))

 

I installed Haskell on my Ubuntu just by doing sudo apt-get install haskell-platform.

 

Interestingly, if I do use ghc-mod on a real file with some errors in I get unnecessarily verbose error messages similar to described here: http://mail.haskell.org/pipermail/beginners/2015-February/014573.html I wonder if the issues are related somehow?

 

 

Norbert:

I’m not sure what exactly you are suggesting but if I even take the version constraint out of the cabal file so I have build-depends:   base (without any version specified) then I get the same issue.

 

 

From: Beginners [mailto:beginners-bounces at haskell.org] On Behalf Of Norbert Melzer
Sent: 23 June 2015 17:49
To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell
Subject: Re: [Haskell-beginners] ghc-mod and cabal "could not find module Prelude"

 

Just add base as dependency in the version constraints matching that base that is delivered with your version of GHC.

 

Alan Buxton <alanbuxton at gmail.com <mailto:alanbuxton at gmail.com> > schrieb am Di., 23.06.2015, 16:48:

Hi

 

I’ve recently set up a new Haskell working environment on Ubuntu 14.04. I installed the Ubuntu packaged version of Haskell platform.

 

My problem is that I can’t now get ghc-mod check to work if there is a cabal file in the current directory.

 

 

I am using:

*       ghc-mod 5.2.1.2 compiled by GHC 7.6.3

*       cabal 1.16.0.2

 

See below an extract of trying to run ghc-mod check in a directory that was empty until I just ran cabal init in it:

 

~/tmp-ghc-mod$ ls

Setup.hs  tmp-ghc-mod.cabal

~/tmp-ghc-mod$ ghc-mod check Setup.hs 

Setup.hs:1:1:Could not find module `Prelude'It is a member of the hidden package `base'.Perhaps you need to add `base' to the build-depends in your .cabal file.It is a member of the hidden package `haskell98-2.0.0.2'.Perhaps you need to add `haskell98' to the build-depends in your .cabal file.It is a member of the hidden package `haskell2010-1.1.1.0'.Perhaps you need to add `haskell2010' to the build-depends in your .cabal file.Use -v to see a list of the files searched for.

~/tmp-ghc-mod$ mv tmp-ghc-mod.cabal tmp-ghc-mod.cabal.NOT

~/tmp-ghc-mod$ ls

dist  Setup.hs  tmp-ghc-mod.cabal.NOT

~/tmp-ghc-mod$ ghc-mod check Setup.hs

Setup.hs:2:1:Warning: Top-level binding with no type signature: main :: IO ()

~/tmp-ghc-mod$ 

 

So… ghc-mod behaves as expected when there is no cabal file, but doesn’t behave as expected if there is a cabal file.

 

My google fu isn’t helping me out on this: the only issues I have seen are to do with a change in format of the cabal file in newer versions of cabal.

 

Any ideas?

 

Thanks

Alan

 

 

_______________________________________________
Beginners mailing list
Beginners at haskell.org <mailto:Beginners at haskell.org> 
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20150623/eb0a549b/attachment.html>


More information about the Beginners mailing list