Fix whitespace violations
[cabal.git] / cabal-testsuite / PackageTests / TestCodeGenerator / test-code-gen / app / Main.hs
blob5fadfd6c04be9d2087ae079a748b14d1dde48cef
1 module Main where
2 import System.FilePath
3 import System.Environment
5 main :: IO ()
6 main = do
7 (tgt:rest) <- getArgs
8 let (srcDirs, ghcArgs) = splitArgs rest
9 let isGood = srcDirs == ["."] && "-outputdir" `elem` ghcArgs
10 if isGood
11 then writeFile (tgt </> "Main.hs") $ "module Main where main = pure ()"
12 else writeFile (tgt </> "Main.hs") $ "module Main where main = error \"failure\""
14 splitArgs = go []
15 where
16 go r ("--":xs) = (reverse r, xs)
17 go r (x:xs) = go (x:r) xs
18 go r [] = (reverse r, [])