core-text 0.3.7.0 → 0.3.7.1
raw patch · 2 files changed
+9/−11 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- core-text.cabal +1/−1
- lib/Core/Text/Rope.hs +8/−10
core-text.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack name: core-text-version: 0.3.7.0+version: 0.3.7.1 synopsis: A rope type based on a finger tree over UTF-8 fragments description: A rope data type for text, built as a finger tree over UTF-8 text fragments. The package also includes utiltiy functions for breaking and
lib/Core/Text/Rope.hs view
@@ -124,7 +124,7 @@ (><), (|>), )-import Data.Foldable (foldl', foldr', toList)+import Data.Foldable (foldl', toList) import Data.Hashable (Hashable, hashWithSalt) import Data.String (IsString (..)) import qualified Data.Text as T (Text)@@ -148,14 +148,14 @@ fromByteString, fromText, length,- null, pack, replicate, singleton, splitAt, toBuilder, toText,- unpack, uncons+ uncons,+ unpack, ) import qualified Data.Text.Short.Unsafe as S (fromByteStringUnsafe) import GHC.Generics (Generic)@@ -324,14 +324,13 @@ Get the length of this text, in characters. -} widthRope :: Rope -> Int-widthRope = foldr' f 0 . unRope- where- f piece count = S.length piece + count+widthRope text =+ let x = unRope text+ (Width w) = F.measure x+ in w nullRope :: Rope -> Bool-nullRope (Rope x) = case F.viewl x of- F.EmptyL -> True- (F.:<) piece _ -> S.null piece+nullRope text = widthRope text == 0 {- | Read the first character from a 'Rope', assuming it's length 1 or greater,@@ -349,7 +348,6 @@ case S.uncons piece of Nothing -> Nothing Just (c, piece') -> Just (c, Rope ((F.<|) piece' x'))- {- | Break the text into two pieces at the specified offset.