From HaskellWiki
Jump to: navigation, search

SearchPath does automatic import chasing across the internet for haskell modules.

by Alex Jacobson

copyright (c) 2004-2006 HAppS LLC BSD Licensed


  • Curl/wget
  • GHC

How to install

curl > SearchPath.hs
ghc --make SearchPath.hs -o sp

How to use

Wrap your call to your haskell compiler/interpreter with a call to searchpath. Intersperse --internet URL options with your other -i command line options. The program will look recursively find the import statements in any module you pass on the command line, look up those module names in the directories passed in the --internet option, and download the modules into subdirectories of the cache directory. It will then execute your compiler replacing the --internet options with -i options pointing to the corresponding subdirectory. For example:

searchpath ghc MyModule.hs OtherModule -isomeDir --internet -iotherdir --internet -iotherDir2 -cache cache


runhugs SearchPath.hs ghc MyModule.hs OtherModule -isomeDir --internet -iotherdir --internet -iotherDir2 -cache cache

will result in the download of all the modules it can find in each directory and execute:

ghc MyModule.hs OtherModule -isomeDir --icache/internet1 -iotherdir -icache/internet2 -iotherDir2

Mapfiles have the form:

HAppS #comment
*.*.HaXml.* #another comment

Warning: If you rely on non-https URLs, you are at risk of getting owned by bad people.

How to improve

darcs get
cd searchpath