summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-03-07 13:34:10 +0100
committertv <tv@krebsco.de>2026-03-07 13:34:10 +0100
commitf292fb854fdbd13e474b9706e10c9a52bcb399a1 (patch)
treeda8b2d606fbb0a018e28310cec4d56146626fd47
parent66d76358a2b38b65d78f4aeb9dcc64a36d56a7f8 (diff)
drop,take,splitAt,break: use normalizeHead
-rw-r--r--src/Blessings.hs21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/Blessings.hs b/src/Blessings.hs
index b942565..9602bf4 100644
--- a/src/Blessings.hs
+++ b/src/Blessings.hs
@@ -394,9 +394,9 @@ instance (Eq a, Blessable a) => Blessable (Blessings a) where
in
normalizeHead $ Append t1' t2'
Plain s ->
- normalize $ Plain (Bless.drop n s)
+ normalizeHead $ Plain (Bless.drop n s)
SGR pm t ->
- normalize $ SGR pm (Bless.drop n t)
+ normalizeHead $ SGR pm (Bless.drop n t)
Empty ->
Empty
@@ -406,19 +406,20 @@ instance (Eq a, Blessable a) => Blessable (Blessings a) where
t1' = Bless.take n t1
n' = n - Bless.length t1'
in
- if n' > 0
- then t1' <> Bless.take n' t2
- else t1'
+ normalizeHead $
+ if n' > 0
+ then t1' <> Bless.take n' t2
+ else t1'
Plain s ->
- normalize $ Plain (Bless.take n s)
+ normalizeHead $ Plain (Bless.take n s)
SGR pm t ->
- normalize $ SGR pm (Bless.take n t)
+ normalizeHead $ SGR pm (Bless.take n t)
Empty ->
Empty
splitAt n = \case
Append t1 t2 ->
- both normalize $
+ both normalizeHead $
let
nt1 = Bless.length t1
in
@@ -426,9 +427,9 @@ instance (Eq a, Blessable a) => Blessable (Blessings a) where
then second (<>t2) $ Bless.splitAt n t1
else first (t1<>) $ Bless.splitAt (n - nt1) t2
Plain s ->
- both (normalize . Plain) $ Bless.splitAt n s
+ both (normalizeHead . Plain) $ Bless.splitAt n s
SGR pm t ->
- both (normalize . SGR pm) $ Bless.splitAt n t
+ both (normalizeHead . SGR pm) $ Bless.splitAt n t
Empty ->
(Empty, Empty)