1
1
mirror of https://github.com/github/semantic.git synced 2024-12-23 23:11:50 +03:00

Rewrapping line contents preserves closedness.

This commit is contained in:
Rob Rix 2016-03-10 09:32:37 -05:00
parent 75133aad3f
commit caaa9cb79f

View File

@ -31,7 +31,7 @@ lineIncrement line | isEmpty line = 0
-- | line.
wrapLineContents :: ([a] -> b) -> Line a -> Line b
wrapLineContents transform line | isEmpty line = mempty
| otherwise = Line [ transform (unLine line) ]
| otherwise = pureBy (const (isOpen line)) (transform (unLine line))
-- | Return the first item in the Foldable, or Nothing if it's empty.
maybeFirst :: Foldable f => f a -> Maybe a