diff options
| author | tv <tv@krebsco.de> | 2026-03-07 13:35:55 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-03-07 13:35:55 +0100 |
| commit | a2d987d58aabe0bf3e15315b2541ee6dfb309608 (patch) | |
| tree | 8f0b930567b16445a54696d699da5e27fe3d8b6f /src/Blessings.hs | |
| parent | f292fb854fdbd13e474b9706e10c9a52bcb399a1 (diff) | |
add break
Diffstat (limited to 'src/Blessings.hs')
| -rw-r--r-- | src/Blessings.hs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/Blessings.hs b/src/Blessings.hs index 9602bf4..ebf14e2 100644 --- a/src/Blessings.hs +++ b/src/Blessings.hs @@ -433,6 +433,20 @@ instance (Eq a, Blessable a) => Blessable (Blessings a) where Empty -> (Empty, Empty) + break p = \case + Append t1 t2 -> + both normalizeHead $ + case Bless.break p t1 of + (t1l, t1r) + | t1r == mempty -> first (t1l<>) $ Bless.break p t2 + | otherwise -> (t1l, t1r <> t2) + Plain s -> + both (normalizeHead . Plain) $ Bless.break p s + SGR pm t -> + both (normalizeHead . SGR pm) $ Bless.break p t + Empty -> + (Empty, Empty) + intercalate i = \case [] -> mempty [t] -> t |
