Changed behavior of `readJournalFiles` to be identical to `readJournalFile` for singleton lists #437

Merged
merged 1 commit into from Dec 1, 2016

Projects

None yet

2 participants

@johannesgerer
Contributor

This solves #436.

<$> mapM (readJournalFile mformat mrulesfile assrt) prefixedfiles
+ where mconcat1 :: Monoid t => [t] -> t
+ mconcat1 [] = mempty
+ mconcat1 x = foldr1 mappend x
@simonmichael
simonmichael Dec 1, 2016 Owner

I often hear foldr is the wrong fold to use.. is it the right one here, do you think ?

@simonmichael
simonmichael Dec 1, 2016 Owner

Is the haddock for readJournalFiles still correct (about the parse state) ?

@johannesgerer
johannesgerer Dec 1, 2016 Contributor

the old mconcat also used it, so no change here. At least it is explicitly visible now.

@johannesgerer
johannesgerer Dec 1, 2016 Contributor

Yes the docs are correct. Actually, only the new version of the function does what the docs say, as the parse state from the last file now lives on, due to the use of mconcat1, which only uses mempty for empty lists.

@simonmichael simonmichael merged commit 54adf5a into simonmichael:master Dec 1, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@johannesgerer
Contributor

This is marked as 'merged', yet i cannot find the commit in branch master. Why?

@simonmichael simonmichael added a commit that referenced this pull request Dec 7, 2016
@johannesgerer @simonmichael johannesgerer + Changed behavior of `readJournalFiles` to be identical to `readJourna…
…lFile` for singleton lists (#437)
2e8e67a
@simonmichael
Owner

I don't know! I just clicked the merge button on github. I've redone it manually, thanks.

@mstksg mstksg added a commit to mstksg/hledger that referenced this pull request Feb 3, 2017
@johannesgerer @mstksg johannesgerer + mstksg Changed behavior of `readJournalFiles` to be identical to `readJourna…
…lFile` for singleton lists (#437)
9ae325b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment