Created
July 13, 2017 20:38
-
-
Save robinp/5b2494c2216eeb1c4d7bf090fa59bc96 to your computer and use it in GitHub Desktop.
Random GHC wrapper script.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import GHC.Paths | |
import System.Posix.Process | |
import System.Environment | |
import System.IO | |
import Data.List (intercalate) | |
import Control.Monad (when) | |
lg = appendFile "/tmp/fake.lg" . (++ "\n") | |
main = do | |
args <- getArgs | |
let make = "--make" `elem` args | |
args' = do | |
arg <- args | |
case arg of | |
"--make" -> | |
["--frontend", "CabalWrapper", | |
"-plugin-package", "cabal-wrapper"] | |
_ -> return arg | |
lg "=== new run" | |
lg (intercalate ", " args) | |
lg (intercalate ", " args') | |
forkProcess (executeFile ghc False args Nothing) >>= getProcessStatus True False | |
when make $ do | |
lg "== my thing" | |
executeFile ghc False (args' ++ ["-user-package-db"]) Nothing | |
{- | |
main = do | |
args <- getArgs | |
let interactive = "--interactive" `elem` args | |
args' = do | |
arg <- args | |
case arg of | |
"--interactive" -> | |
["--frontend", "CabalWrapper", | |
"-plugin-package", "cabal-wrapper"] | |
_ -> return arg | |
executeFile ghc False (args' ++ if interactive then ["-user-package-db"] else []) Nothing | |
-} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment