From 600105549348121bf2d6adabcf0e1d4ccb6cf4d6 Mon Sep 17 00:00:00 2001 From: Jaro Date: Sat, 15 Apr 2023 22:07:51 +0200 Subject: [PATCH] Fix compatibility with base < 4.15. --- CHANGELOG.md | 4 ++++ src/Data/Text/ParagraphLayout/Internal/Plain.hs | 2 +- src/Data/Text/ParagraphLayout/Internal/TextContainer.hs | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b1dfe4..1595146 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Revision history for Balkón +## 0.3.0.1 -- TBD + +* Fixed compatibility with base < 4.15. + ## 0.3.0.0 -- 2023-04-13 * Added partial support for bidirectional text diff --git a/src/Data/Text/ParagraphLayout/Internal/Plain.hs b/src/Data/Text/ParagraphLayout/Internal/Plain.hs index 4c3df15..fa9e715 100644 --- a/src/Data/Text/ParagraphLayout/Internal/Plain.hs +++ b/src/Data/Text/ParagraphLayout/Internal/Plain.hs @@ -87,7 +87,7 @@ layoutLines :: Int32 -> NonEmpty (WithSpan Run) -> NonEmpty [WithSpan PF.ProtoFragment] layoutLines maxWidth runs = case nonEmpty rest of -- Everything fits. We are done. - Nothing -> NonEmpty.singleton fitting + Nothing -> fitting :| [] -- Something fits, the rest goes on the next line. Just rest' -> fitting <| layoutLines maxWidth rest' where diff --git a/src/Data/Text/ParagraphLayout/Internal/TextContainer.hs b/src/Data/Text/ParagraphLayout/Internal/TextContainer.hs index 99b7f9d..036deca 100644 --- a/src/Data/Text/ParagraphLayout/Internal/TextContainer.hs +++ b/src/Data/Text/ParagraphLayout/Internal/TextContainer.hs @@ -116,7 +116,7 @@ trimTextsStartPreserve :: SeparableTextContainer a => (Char -> Bool) -> NonEmpty a -> NonEmpty a trimTextsStartPreserve p tcs = case nonEmpty $ trimTextsStart p $ NonEmpty.toList tcs of - Nothing -> NonEmpty.singleton $ truncateText $ NonEmpty.head tcs + Nothing -> truncateText (NonEmpty.head tcs) :| [] Just out -> out -- | Treat a list of text containers as a contiguous sequence, @@ -137,7 +137,7 @@ trimTextsEndPreserve :: SeparableTextContainer a => (Char -> Bool) -> NonEmpty a -> NonEmpty a trimTextsEndPreserve p tcs = case nonEmpty $ trimTextsEnd p $ NonEmpty.toList tcs of - Nothing -> NonEmpty.singleton $ truncateText $ NonEmpty.head tcs + Nothing -> truncateText (NonEmpty.head tcs) :| [] Just out -> out trimTextsStart' :: SeparableTextContainer a => (Char -> Bool) -> [a] -> [a] -- 2.30.2