From 3be88ad6b52ad380ae1c10dc42a633a9851c376a Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Tue, 13 Oct 2015 11:49:51 -0700 Subject: [PATCH] simplify combineJournalUpdates I really don't see why that extra x parameter is needed or works.. rewrite it in simpler form. I also might be introducing breakage for older GHC's by using unconditionally <$>, but I'm not seeing that for some reason (tested back to ghc 7.6). --- hledger-lib/Hledger/Read/JournalReader.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hledger-lib/Hledger/Read/JournalReader.hs b/hledger-lib/Hledger/Read/JournalReader.hs index ec3861c57..225d8ce04 100644 --- a/hledger-lib/Hledger/Read/JournalReader.hs +++ b/hledger-lib/Hledger/Read/JournalReader.hs @@ -101,10 +101,14 @@ parse _ = parseJournalWith journal genericSourcePos :: SourcePos -> GenericSourcePos genericSourcePos p = GenericSourcePos (sourceName p) (sourceLine p) (sourceColumn p) --- | Flatten a list of JournalUpdate's into a single equivalent one. +-- | Flatten a list of JournalUpdate's (journal-transforming +-- monadic actions which can do IO or raise an exception) into a +-- single equivalent action. combineJournalUpdates :: [JournalUpdate] -> JournalUpdate combineJournalUpdates us = liftM (foldl' (\acc new x -> new (acc x)) id) $ sequence us -- XXX may be contributing to excessive stack use +--combineJournalUpdates us = foldl' (flip (.)) id <$> sequence us + -- cf http://neilmitchell.blogspot.co.uk/2015/09/detecting-space-leaks.html -- $ ./devprof +RTS -K576K -xc -- *** Exception (reporting due to +RTS -xc): (THUNK_STATIC), stack trace: