From 83a63a4ef5400ce29266da2d0e8d41730d1797fb Mon Sep 17 00:00:00 2001 From: Alex Chen Date: Thu, 22 Nov 2018 14:05:38 -0700 Subject: [PATCH] lib: minor cleanup in 'periodictransactionp' --- hledger-lib/Hledger/Read/JournalReader.hs | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/hledger-lib/Hledger/Read/JournalReader.hs b/hledger-lib/Hledger/Read/JournalReader.hs index 1a4482672..fa38990e9 100644 --- a/hledger-lib/Hledger/Read/JournalReader.hs +++ b/hledger-lib/Hledger/Read/JournalReader.hs @@ -533,17 +533,14 @@ periodictransactionp = do Nothing -> pure () -- The line can end here, or it can continue with one or more spaces -- and then zero or more of the following fields. A bit awkward. - (status, code, description, (comment, tags)) <- - (lift eolof >> return (Unmarked, "", "", ("", []))) - <|> - (do - lift $ skipSome spacenonewline - s <- lift statusp - c <- lift codep - desc <- lift $ T.strip <$> descriptionp - (cmt, ts) <- lift transactioncommentp + (status, code, description, (comment, tags)) <- lift $ + (<|>) (eolof >> return (Unmarked, "", "", ("", []))) $ do + skipSome spacenonewline + s <- statusp + c <- codep + desc <- T.strip <$> descriptionp + (cmt, ts) <- transactioncommentp return (s,c,desc,(cmt,ts)) - ) -- next lines; use same year determined above postings <- postingsp (Just $ first3 $ toGregorian refdate)