Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 35 lines (28 sloc) 1.287 kb
b950503 @jgm Added Interact.hs to make it easier to use ghci while developing.
authored
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
447a1bb @jgm Added note to Interact.hs recommending 'cabal repl'.
authored
12 -- Note: Interact.hs doesn't work with Cabal >= 1.18. I recommend
13 -- using cabal sandboxes and the new 'cabal repl' command if you are
14 -- using a recent version.
15
b950503 @jgm Added Interact.hs to make it easier to use ghci while developing.
authored
16 import System.Process
17 import Distribution.Simple.LocalBuildInfo
18 import Distribution.Package
19 import Distribution.Version
20 import Data.List (intercalate)
21
22 main = do
23 setupConfig' <- readFile "dist/setup-config"
24 let setupConfig = read $ unlines $ drop 1 $ lines setupConfig'
25 let (Just (ComponentLocalBuildInfo { componentPackageDeps = deps })) = libraryConfig setupConfig
26 let packageSpecs = map (toPackageSpec . snd) deps
492d5e9 @jgm Fixed Interact.hs to handle the cpp macros in UTF8.
authored
27 let args = ["-optP-include", "-optP../dist/build/autogen/cabal_macros.h","-cpp","-I../dist/build/autogen","-i../dist/build/autogen"] ++ concatMap (\p -> ["-package",p]) packageSpecs
b950503 @jgm Added Interact.hs to make it easier to use ghci while developing.
authored
28 print args
29 ph <- runProcess "ghci" args (Just "src") Nothing Nothing Nothing Nothing
30 waitForProcess ph
31
32 toPackageSpec pkg = pkgN ++ "-" ++ pkgV
33 where (PackageName pkgN) = pkgName pkg
34 pkgV = intercalate "." $ map show $ versionBranch $ pkgVersion pkg
Something went wrong with that request. Please try again.