yi-rope 0.7.0.2 → 0.8
raw patch · 3 files changed
+22/−19 lines, 3 filesdep ~base
Dependency ranges changed: base
Files
- src/Yi/Rope.hs +8/−9
- test/Yi/RopeSpec.hs +8/−1
- yi-rope.cabal +6/−9
src/Yi/Rope.hs view
@@ -62,7 +62,6 @@ import Codec.Text.Detect (detectEncodingName)-import Control.Applicative ((<$>)) import Control.DeepSeq import Data.Binary import qualified Data.ByteString as BS@@ -476,10 +475,10 @@ -- pre-process the list. intercalate :: YiString -> [YiString] -> YiString intercalate _ [] = mempty-intercalate (YiString t') (YiString s:ss) = YiString $ s >< go ss+intercalate (YiString t') (YiString s:ss) = YiString $ go s ss where- go [] = mempty- go (YiString t : ts') = t' >< t >< go ts'+ go !acc [] = acc+ go acc (YiString t : ts') = go (acc >< t' >< t) ts' -- | Intersperses the given character between the 'YiString's. This is -- useful when you have a bunch of strings you just want to separate@@ -496,10 +495,10 @@ -- and use 'TX.intersperse' for that instead. intersperse :: Char -> [YiString] -> YiString intersperse _ [] = mempty-intersperse c (t:ts) = t <> go ts+intersperse c (t:ts) = go t ts where- go [] = mempty- go (t':ts') = (c `cons` t') <> go ts'+ go !acc [] = acc+ go acc (t':ts') = go (acc <> (c `cons` t')) ts' -- | Add a 'Char' in front of a 'YiString'. --@@ -638,8 +637,8 @@ all p = go . fromRope where go x = case viewl x of- EmptyL -> False- Chunk _ t :< ts -> TX.all p t || go ts+ EmptyL -> True+ Chunk _ t :< ts -> TX.all p t && go ts -- | To serialise a 'YiString', we turn it into a regular 'String' -- first.
test/Yi/RopeSpec.hs view
@@ -1,7 +1,6 @@ {-# LANGUAGE OverloadedStrings #-} module Yi.RopeSpec (main, spec) where -import Control.Applicative import Data.Char (isUpper, toUpper, isSpace) import qualified Data.Text as T import Test.Hspec@@ -61,6 +60,10 @@ R.any (const True) (R.fromText t) `shouldBe` T.any (const True) t prop "\\p -> R.any p ~ T.any p $ const False" $ \t -> R.any (const False) (R.fromText t) `shouldBe` T.any (const False) t+ prop "\\p c -> R.any (== c) p ~ T.any (== c) p" $ \c t ->+ R.any (== c) (R.fromText t) `shouldBe` T.any (== c) t+ prop "\\p c -> R.all (== c) p ~ T.all (== c) p" $ \c t ->+ R.all (== c) (R.fromText t) `shouldBe` T.all (== c) t prop "\\f -> R.withText ~ f $ T.toTitle" $ R.withText T.toTitle `isLikeT` T.toTitle prop "\\p -> R.dropWhile p ~ T.dropWhile p $ isUpper" $@@ -104,3 +107,7 @@ prop "R.intercalate ~ T.intercalate" $ \t ts -> R.toText (R.intercalate (R.fromText t) (R.fromText <$> ts)) `shouldBe` T.intercalate t ts+ describe "But R.intersperse is not like T.intersperse" $ do+ prop "R.intercalate (R.singleton c) = R.intersperse c" $ \c ts ->+ let rs = R.fromText <$> ts+ in R.intercalate (R.singleton c) rs `shouldBe` R.intersperse c rs
yi-rope.cabal view
@@ -1,5 +1,5 @@ name: yi-rope-version: 0.7.0.2+version: 0.8 synopsis: A rope data structure used by Yi description: A rope data structure used by Yi license: GPL-2@@ -11,16 +11,13 @@ cabal-version: >=1.10 library- if true- ghc-options: -fpedantic-bottoms -fexpose-all-unfoldings -Wall -O2- if impl(ghc >= 7.8.1)- ghc-options: -flate-dmd-anal+ ghc-options: -fpedantic-bottoms -fexpose-all-unfoldings -Wall -O2 -flate-dmd-anal exposed-modules: Yi.Rope build-depends:- base >=4.5 && <5+ base >=4.8 && <5 , binary , bytestring , charsetdetect-ae >= 1.0.1@@ -38,7 +35,7 @@ default-language: Haskell2010 main-is: Spec.hs hs-source-dirs: test- ghc-options: -funbox-strict-fields -Wall -O2+ ghc-options: -Wall -O2 -rtsopts other-modules: Yi.RopeSpec @@ -55,10 +52,10 @@ default-language: Haskell2010 main-is: MainBenchmarkSuite.hs hs-source-dirs: bench- ghc-options: -funbox-strict-fields -Wall -O2+ ghc-options: -Wall -O2 build-depends:- base >=4.5 && <5+ base >=4.8 && <5 , criterion , deepseq , text