John Red
John Red

Reputation: 717

Why can't I import this Haskell module/package?

I installed the SourceGraph package using cabal:
cabal install SourceGraph
It was installed perfectly without any errors.
Now, I've created a file called Test.hs to test if I am able to import this package and use it. These are the contents of Test.hs:

    module Test where

    import SourceGraph

    main = putStrLn "Hello World!"  

When I do ghc Test I get the following error:
Could not find the module 'SourceGraph'

When I do ghc-pkg list I cannot find SourceGraph in the list, though all dependencies installed along with it are visible.
I checked in C:\Users\MyName\AppData\Roaming\cabal\packages\hackage.haskell.org and I can see the SourceGraph folder there.
But there is no .conf file for SourceGraph in C:\Users\MyName\AppData\Roaming\ghc\x86_64-mingw32-7.10.2\package.conf.d.
Also, all the .log files in C:\Users\MyName\AppData\Roaming\cabal\logs have a line In-place registering packagename-version... at the end, but SourceGraph-0.7.0.7,log doesn't.

Help please?

[System Specifications: GHCi version 7.10.2, Cabal Version: 1.22.4.0, OS: Windows 8 Pro, Processor: Intel Core i5 (64 bit)]

Upvotes: 3

Views: 1303

Answers (1)

AJF
AJF

Reputation: 11923

SourceGraph is not a library, it is a program to be run on the command line.

See it's hackage page

There it says (with added $s for the bash prompt):

To use SourceGraph, call it as either:

$ SourceGraph path/to/Foo.cabal

Or, if your project doesn't use Cabal, then there is limited support for > using an overall module from your program/library:

$ SourceGraph path/to/Foo.hs

Upvotes: 4

Related Questions