Merge pull request #1 from Gurkenglas/patch-1

Factor out a return
pull/3/head
Lennart Spitzner 2016-08-06 23:37:15 +02:00 committed by GitHub
commit 46119abd1e
1 changed files with 4 additions and 4 deletions

View File

@ -107,11 +107,11 @@ parsePrintModule
parsePrintModule conf filename input = do
let inputStr = Text.unpack input
parseResult <- ExactPrint.Parsers.parseModuleFromString filename inputStr
case parseResult of
Left (_, s) -> return $ Left $ "parsing error: " ++ s
return $ case parseResult of
Left (_, s) -> Left $ "parsing error: " ++ s
Right (anns, parsedModule) ->
let (errs, ltext) = pPrintModule conf anns parsedModule
in return $ if null errs
in if null errs
then Right $ TextL.toStrict $ ltext
else
let errStrs = errs <&> \case
@ -271,4 +271,4 @@ _bindHead :: HsBind RdrName -> String
_bindHead = \case
FunBind fId _ _ _ [] -> "FunBind " ++ (Text.unpack $ lrdrNameToText $ fId)
PatBind _pat _ _ _ ([], []) -> "PatBind smth"
_ -> "unknown bind"
_ -> "unknown bind"