@@ -0,0 +1,30 @@
1+-- Get an interactive shell with the right packages to load
2+-- pandoc modules.
3+
4+-- To use:
5+-- runghc Interact.hs
6+-- then,
7+-- :l Text/Pandoc.hs
8+-- (or whichever package you like)
9+
10+-- You must have first done a 'cabal configure' or 'cabal install'
11+
12+import System.Process
13+import Distribution.Simple.LocalBuildInfo
14+import Distribution.Package
15+import Distribution.Version
16+import Data.List (intercalate)
17+
18+main = do
19+ setupConfig' <- readFile "dist/setup-config"
20+ let setupConfig = read $ unlines $ drop 1 $ lines setupConfig'
21+ let (Just (ComponentLocalBuildInfo { componentPackageDeps = deps })) = libraryConfig setupConfig
22+ let packageSpecs = map (toPackageSpec . snd) deps
23+ let args = ["-cpp","-i../dist/build/autogen"] ++ concatMap (\p -> ["-package",p]) packageSpecs
24+ print args
25+ ph <- runProcess "ghci" args (Just "src") Nothing Nothing Nothing Nothing
26+ waitForProcess ph
27+
28+toPackageSpec pkg = pkgN ++ "-" ++ pkgV
29+ where (PackageName pkgN) = pkgName pkg
30+ pkgV = intercalate "." $ map show $ versionBranch $ pkgVersion pkg