Factor out a return

pull/1/head
Gurkenglas 2016-08-06 23:31:27 +02:00 committed by GitHub
parent 422ad9f5ac
commit bcdfea8654
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"