aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlexander Krotov <ilabdsf@gmail.com>2018-10-23 13:35:29 +0300
committerAlexander Krotov <ilabdsf@gmail.com>2018-10-23 13:35:49 +0300
commit509d2ea525cd30425b4d8c408722a7492b95fde5 (patch)
tree8389460197ae54d43776d44db3b74390419b69d4 /src
parentec2d86e34f00d8605546b2b9c8df5d52a330a0b0 (diff)
downloadpandoc-509d2ea525cd30425b4d8c408722a7492b95fde5.tar.gz
Simplify Text.Pandoc.Pretty.offset
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Pretty.hs4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Pretty.hs b/src/Text/Pandoc/Pretty.hs
index de3d54ee2..f0990c1f8 100644
--- a/src/Text/Pandoc/Pretty.hs
+++ b/src/Text/Pandoc/Pretty.hs
@@ -438,9 +438,7 @@ afterBreak s = Doc $ singleton (AfterBreak s)
-- | Returns the width of a 'Doc'.
offset :: Doc -> Int
-offset d = case map realLength . lines . render Nothing $ d of
- [] -> 0
- os -> maximum os
+offset d = maximum (0: map realLength (lines $ render Nothing d))
-- | Returns the minimal width of a 'Doc' when reflowed at breakable spaces.
minOffset :: Doc -> Int