Search code examples
haskellcabal

Add local files to haskell libraries search path


I am running Examples/Producer.hs from the hafka project. It throws error as,

Could not find module ‘Network.Kafka.Producer’

Library file Network.Kafka.Producer is sitting in my local repository and not inside default library paths (/home/user/.cabal). How can i add this local file system path to the Cabal/Haskell library?

In python terms, this question is equivalent to appending an entry to PYTHONPATH list as,

export PYTHONPATH=$PYTHONPATH:/path/to/local/fs

Solution

  • You can include it as is by using -i when compiling with ghc.

    Fore example, ghc ...... -i/path/to/local/fs