diff options
author | Alexander Krotov <ilabdsf@gmail.com> | 2018-04-08 11:39:15 +0300 |
---|---|---|
committer | Alexander Krotov <ilabdsf@gmail.com> | 2018-04-08 11:47:10 +0300 |
commit | c6df281ace326dbce492eb22dc82a16352c8dbf1 (patch) | |
tree | 246aae425f91cada5e0c2299d7f9e538c6bde807 | |
parent | 579f4223bfca8cc306d6eefc2402d446aadce702 (diff) | |
download | pandoc-c6df281ace326dbce492eb22dc82a16352c8dbf1.tar.gz |
Muse reader: replace foldl with foldr
-rw-r--r-- | src/Text/Pandoc/Readers/Muse.hs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/Text/Pandoc/Readers/Muse.hs b/src/Text/Pandoc/Readers/Muse.hs index 6d34347c4..8851de1e5 100644 --- a/src/Text/Pandoc/Readers/Muse.hs +++ b/src/Text/Pandoc/Readers/Muse.hs @@ -686,14 +686,14 @@ museToPandocTable (MuseTable caption headers body footers) = headRow = if null headers then [] else head headers rows = (if null headers then [] else tail headers) ++ body ++ footers -museAppendElement :: MuseTable - -> MuseTableElement +museAppendElement :: MuseTableElement -> MuseTable -museAppendElement tbl element = + -> MuseTable +museAppendElement element tbl = case element of - MuseHeaderRow row -> tbl{ museTableHeaders = museTableHeaders tbl ++ [row] } - MuseBodyRow row -> tbl{ museTableRows = museTableRows tbl ++ [row] } - MuseFooterRow row -> tbl{ museTableFooters = museTableFooters tbl ++ [row] } + MuseHeaderRow row -> tbl{ museTableHeaders = row : museTableHeaders tbl } + MuseBodyRow row -> tbl{ museTableRows = row : museTableRows tbl } + MuseFooterRow row -> tbl{ museTableFooters = row : museTableFooters tbl } MuseCaption inlines -> tbl{ museTableCaption = inlines } tableCell :: PandocMonad m => MuseParser m (F Blocks) @@ -704,7 +704,7 @@ tableElements :: PandocMonad m => MuseParser m (F [MuseTableElement]) tableElements = sequence <$> (tableParseElement `sepEndBy1` eol) elementsToTable :: [MuseTableElement] -> MuseTable -elementsToTable = foldl museAppendElement emptyTable +elementsToTable = foldr museAppendElement emptyTable where emptyTable = MuseTable mempty mempty mempty mempty -- | Parse a table. |