From 4649aa290ab6144222b2bf5dba985faa54cb6614 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Mon, 28 Mar 2016 04:39:08 -0400 Subject: [PATCH] Use `null` to test for emptiness. --- src/Alignment.hs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Alignment.hs b/src/Alignment.hs index 641b0ab5f..0843dea72 100644 --- a/src/Alignment.hs +++ b/src/Alignment.hs @@ -135,24 +135,24 @@ groupChildrenByLine :: Join These [Range] -> [AlignedDiff leaf] -> [Join These ( groupChildrenByLine ranges children = go (fromThese [] [] $ runJoin ranges) (join children) where go ranges children | (l:ls, r:rs) <- ranges , (lines, rest) <- span (intersecting l r) children - , length lines > 0 + , null lines = Join (uncurry These $ bimap ((,) l . catMaybes) ((,) r . catMaybes) (unalign $ runJoin <$> lines)) : go (ls, rs) rest | (l:ls, rs) <- ranges , (lines, rest) <- span (and . bimapJoin ((<= end l) . end . getRange) (const True)) children - , length lines > 0 + , null lines = Join (This $ (l, catMaybes (Prelude.fst . unalign $ runJoin <$> lines))) : go (ls, rs) rest | (ls, r:rs) <- ranges , (lines, rest) <- span (and . bimapJoin (const True) ((<= end r) . end . getRange)) children - , length lines > 0 + , null lines = Join (That $ (r, catMaybes (Prelude.snd . unalign $ runJoin <$> lines))) : go (ls, rs) rest | (l:ls, r:rs) <- ranges - , length children > 0 + , null children = Join (These (l, []) (r, [])) : go (ls, rs) children | (l:ls, rs) <- ranges - , length children > 0 + , null children = Join (This (l, [])) : go (ls, rs) children | (ls, r:rs) <- ranges - , length children > 0 + , null children = Join (That (r, [])) : go (ls, rs) children | otherwise = uncurry (alignWith (fmap (flip (,) []) . Join)) ranges getRange (Free (Annotated (Info range _) _)) = range