From f292fb854fdbd13e474b9706e10c9a52bcb399a1 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 7 Mar 2026 13:34:10 +0100 Subject: drop,take,splitAt,break: use normalizeHead --- src/Blessings.hs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'src') 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) -- cgit v1.2.3