aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNikolay Yakimov <root@livid.pp.ru>2020-07-07 13:37:38 +0300
committerNikolay Yakimov <root@livid.pp.ru>2020-07-07 14:50:26 +0300
commitf09e18753b999a0f29c3717889e68f68fa643cfe (patch)
tree82efb98076a8b64af3b2f1e3fa7321053185093a /src
parent5a1e1db5266f61300601c9511b053a55360d67fb (diff)
downloadpandoc-f09e18753b999a0f29c3717889e68f68fa643cfe.tar.gz
[Docx Reader] Use null instead of isEmpty in Readers.Docx.Combine
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Readers/Docx/Combine.hs14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/Text/Pandoc/Readers/Docx/Combine.hs b/src/Text/Pandoc/Readers/Docx/Combine.hs
index f4748baa9..427a73dbe 100644
--- a/src/Text/Pandoc/Readers/Docx/Combine.hs
+++ b/src/Text/Pandoc/Readers/Docx/Combine.hs
@@ -61,7 +61,6 @@ import Data.List
import Data.Bifunctor
import Data.Sequence ( ViewL (..), ViewR (..), viewl, viewr, spanr, spanl
, (><), (|>) )
-import qualified Data.Sequence as Seq (null)
import Text.Pandoc.Builder
data Modifier a = Modifier (a -> a)
@@ -90,7 +89,7 @@ isSpace _ = False
stackInlines :: [Modifier Inlines] -> Inlines -> Inlines
stackInlines [] ms = ms
stackInlines (Modifier f : fs) ms =
- if isEmpty ms
+ if null ms
then stackInlines fs ms
else f $ stackInlines fs ms
stackInlines (AttrModifier f attr : fs) ms = f attr $ stackInlines fs ms
@@ -102,7 +101,7 @@ unstackInlines ms = case ilModifierAndInnards ms of
ilModifierAndInnards :: Inlines -> Maybe (Modifier Inlines, Inlines)
ilModifierAndInnards ils = case viewl $ unMany ils of
- x :< xs | Seq.null xs -> second fromList <$> case x of
+ x :< xs | null xs -> second fromList <$> case x of
Emph lst -> Just (Modifier emph, lst)
Strong lst -> Just (Modifier strong, lst)
SmallCaps lst -> Just (Modifier smallcaps, lst)
@@ -143,12 +142,12 @@ combineSingletonInlines x y =
y_rem_attr = filter isAttrModifier y_remaining
in
case null shared of
- True | isEmpty xs && isEmpty ys ->
+ True | null xs && null ys ->
stackInlines (x_rem_attr <> y_rem_attr) mempty
- | isEmpty xs ->
+ | null xs ->
let (sp, y') = spaceOutInlinesL y in
stackInlines x_rem_attr mempty <> sp <> y'
- | isEmpty ys ->
+ | null ys ->
let (x', sp) = spaceOutInlinesR x in
x' <> sp <> stackInlines y_rem_attr mempty
| otherwise ->
@@ -177,9 +176,6 @@ instance (Monoid a, Eq a) => Eq (Modifier a) where
(AttrModifier f attr) == (AttrModifier g attr') = f attr mempty == g attr' mempty
_ == _ = False
-isEmpty :: (Monoid a, Eq a) => a -> Bool
-isEmpty x = x == mempty
-
isAttrModifier :: Modifier a -> Bool
isAttrModifier (AttrModifier _ _) = True
isAttrModifier _ = False