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).
This commit is contained in:
Simon Michael 2015-10-13 11:49:51 -07:00
parent 7817cf9688
commit 3be88ad6b5

View File

@ -101,10 +101,14 @@ parse _ = parseJournalWith journal
genericSourcePos :: SourcePos -> GenericSourcePos genericSourcePos :: SourcePos -> GenericSourcePos
genericSourcePos p = GenericSourcePos (sourceName p) (sourceLine p) (sourceColumn p) 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 :: [JournalUpdate] -> JournalUpdate
combineJournalUpdates us = liftM (foldl' (\acc new x -> new (acc x)) id) $ sequence us combineJournalUpdates us = liftM (foldl' (\acc new x -> new (acc x)) id) $ sequence us
-- XXX may be contributing to excessive stack use -- 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 -- cf http://neilmitchell.blogspot.co.uk/2015/09/detecting-space-leaks.html
-- $ ./devprof +RTS -K576K -xc -- $ ./devprof +RTS -K576K -xc
-- *** Exception (reporting due to +RTS -xc): (THUNK_STATIC), stack trace: -- *** Exception (reporting due to +RTS -xc): (THUNK_STATIC), stack trace: