1
1
mirror of https://github.com/github/semantic.git synced 2024-12-18 12:21:57 +03:00

Test whether the last element in a Line is open.

This commit is contained in:
Rob Rix 2015-12-10 15:34:11 -05:00
parent c2f54ce8d8
commit 200037b509

View File

@ -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]