summaryrefslogtreecommitdiff
path: root/app/GhcLib.hs
diff options
context:
space:
mode:
Diffstat (limited to 'app/GhcLib.hs')
-rw-r--r--app/GhcLib.hs17
1 files changed, 17 insertions, 0 deletions
diff --git a/app/GhcLib.hs b/app/GhcLib.hs
new file mode 100644
index 0000000..3c2bf60
--- /dev/null
+++ b/app/GhcLib.hs
@@ -0,0 +1,17 @@
+module GhcLib (run) where
+
+import StackWrapper (envPrefix)
+
+import System.Environment
+import System.FilePath
+import System.Process
+
+run :: String -> IO () -> IO ()
+run name act = do
+ args <- getArgs
+ mdefaultDir <- lookupEnv $ envPrefix <> "GHC_DIR"
+ case mdefaultDir of
+ Just defaultDir ->
+ callProcess (defaultDir </> name) args
+ Nothing ->
+ act