Apply brittany to Main.hs
parent
bd10c3c4ef
commit
033fdc6517
|
@ -57,8 +57,7 @@ data WriteMode = Display | Inplace
|
|||
|
||||
instance Read WriteMode where
|
||||
readPrec = val "display" Display <|> val "inplace" Inplace
|
||||
where
|
||||
val iden v = ReadPrec.lift $ ReadP.string iden >> return v
|
||||
where val iden v = ReadPrec.lift $ ReadP.string iden >> return v
|
||||
|
||||
instance Show WriteMode where
|
||||
show Display = "display"
|
||||
|
@ -226,13 +225,14 @@ mainCmdParser helpDesc = do
|
|||
$ trace (showConfigYaml config)
|
||||
$ return ()
|
||||
|
||||
results <- zipWithM (coreIO putStrErrLn config (suppressOutput || checkMode))
|
||||
results <- zipWithM
|
||||
(coreIO putStrErrLn config (suppressOutput || checkMode))
|
||||
inputPaths
|
||||
outputPaths
|
||||
|
||||
if checkMode
|
||||
then when (any (==Changes) (Data.Either.rights results)) $
|
||||
System.Exit.exitWith (System.Exit.ExitFailure 1)
|
||||
then when (any (== Changes) (Data.Either.rights results))
|
||||
$ System.Exit.exitWith (System.Exit.ExitFailure 1)
|
||||
else case results of
|
||||
xs | all Data.Either.isRight xs -> pure ()
|
||||
[Left x] -> System.Exit.exitWith (System.Exit.ExitFailure x)
|
||||
|
@ -278,8 +278,7 @@ coreIO putErrorLnIO config suppressOutput inputPathM outputPathM =
|
|||
viaDebug =
|
||||
config & _conf_debug & _dconf_roundtrip_exactprint_only & confUnpack
|
||||
|
||||
let
|
||||
cppCheckFunc dynFlags = if GHC.xopt GHC.Cpp dynFlags
|
||||
let cppCheckFunc dynFlags = if GHC.xopt GHC.Cpp dynFlags
|
||||
then case cppMode of
|
||||
CPPModeAbort -> do
|
||||
return $ Left "Encountered -XCPP. Aborting."
|
||||
|
@ -359,8 +358,7 @@ coreIO putErrorLnIO config suppressOutput inputPathM outputPathM =
|
|||
let hackF s = fromMaybe s $ TextL.stripPrefix
|
||||
(TextL.pack "-- BRITANY_INCLUDE_HACK ")
|
||||
s
|
||||
let
|
||||
out = TextL.toStrict $ if hackAroundIncludes
|
||||
let out = TextL.toStrict $ if hackAroundIncludes
|
||||
then
|
||||
TextL.intercalate (TextL.pack "\n")
|
||||
$ fmap hackF
|
||||
|
|
Loading…
Reference in New Issue