From 200037b50916cf4ba63172cae5832e03426ce9dd Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Thu, 10 Dec 2015 15:34:11 -0500 Subject: [PATCH] Test whether the last element in a Line is open. --- src/Split.hs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Split.hs b/src/Split.hs index 29da43981..389a735a5 100644 --- a/src/Split.hs +++ b/src/Split.hs @@ -8,6 +8,7 @@ import Syntax import Control.Comonad.Cofree import Range +import Control.Monad import Control.Monad.Free import Data.ByteString.Lazy.Internal import Text.Blaze.Html5 hiding (map) @@ -238,10 +239,7 @@ openElement h = Just h openLine :: [Line] -> Maybe Line openLine [] = Nothing openLine (EmptyLine : rest) = openLine rest -openLine (line : _) = case maybeLast $ unLine line of - Just Break -> Nothing - Just _ -> Just line - Nothing -> Nothing +openLine (line : _) = const line <$> (join . maybeLast $ openElement <$> unLine line) adjoin2Lines :: [Line] -> Line -> [Line] adjoin2Lines [] line = [line]