Personal tools

SearchPath

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

Contents

1 Requirements

  • Curl/wget
  • GHC

2 How to install

curl http://searchpath.org/searchpath/SearchPath.hs > SearchPath.hs
ghc --make SearchPath.hs -o sp

3 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 localModules.map -iotherdir --internet https://searchpath.org/default.map -iotherDir2 -cache cache

Or:

runhugs SearchPath.hs ghc MyModule.hs OtherModule -isomeDir --internet localModules.map -iotherdir --internet https://searchpath.org/default.map -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:

#comment
HAppS  http://happs.org #comment
*.*.HaXml.*  http://www.cs.york.ac.uk/fp/darcs/HaXml/src #another comment

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

4 How to improve

darcs get http://searchpath.org/searchpath
cd searchpath