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:
parent
75133aad3f
commit
caaa9cb79f
@ -31,7 +31,7 @@ lineIncrement line | isEmpty line = 0
|
|||||||
-- | line.
|
-- | line.
|
||||||
wrapLineContents :: ([a] -> b) -> Line a -> Line b
|
wrapLineContents :: ([a] -> b) -> Line a -> Line b
|
||||||
wrapLineContents transform line | isEmpty line = mempty
|
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.
|
-- | Return the first item in the Foldable, or Nothing if it's empty.
|
||||||
maybeFirst :: Foldable f => f a -> Maybe a
|
maybeFirst :: Foldable f => f a -> Maybe a
|
||||||
|
Loading…
Reference in New Issue
Block a user