text-builder-core 0.1.1 → 0.1.1.1
raw patch · 4 files changed
+10/−15 lines, 4 files
Files
- library/TextBuilderCore.hs +1/−3
- test/Features.hs +7/−2
- test/Main.hs +1/−9
- text-builder-core.cabal +1/−1
library/TextBuilderCore.hs view
@@ -39,9 +39,7 @@ #endif -- |--- Specification of how to efficiently construct strict 'Text'.------ For this task it is much more efficient than @Data.Text.Lazy.Builder.'Data.Text.Lazy.Builder.Builder'@ and even the recently introduced @Data.Text.Encoding.'Data.Text.Encoding.StrictTextBuilder'@.+-- Composable specification of how to efficiently construct strict 'Text'. -- -- Provides instances of 'Semigroup' and 'Monoid', which have complexity of /O(1)/. data TextBuilder
test/Features.hs view
@@ -1,6 +1,7 @@ module Features (tests) where import Control.Monad+import Data.Char import Data.String import qualified Data.Text as Text import qualified Data.Text.Lazy as Text.Lazy@@ -44,10 +45,14 @@ lazyText (Text.Lazy.fromStrict (toText builder)) === builder ], testGroup "char" $- [ mapsToMonoid char+ [ mapsToMonoid char,+ testProperty "Is isomorphic to Text.singleton" \a ->+ toText (char a) === Text.singleton a ], testGroup "unicodeCodepoint" $- [ mapsToMonoid unicodeCodepoint+ [ mapsToMonoid unicodeCodepoint,+ testProperty "Is isomorphic to Text.singleton" \a ->+ toText (unicodeCodepoint (ord a)) === Text.singleton a ], testGroup "unsafeSeptets" $ [ isMonoidWithCustomGen do
test/Main.hs view
@@ -1,8 +1,6 @@ module Main where -import qualified Data.Char as Char import Data.Proxy-import Data.Text (Text) import qualified Data.Text as Text import qualified Features import Test.QuickCheck.Classes@@ -36,11 +34,7 @@ \texts -> let trimmedTexts = fmap (Text.drop 3) texts in mconcat trimmedTexts- === B.toText (mconcat (map B.text trimmedTexts)),- testProperty "(TextBuilderCore.unicodeCodepoint <>) is isomorphic to Text.cons" $- withMaxSuccess bigTest $- \(text :: Text) (c :: Char) ->- B.toText (B.unicodeCodepoint (Char.ord c) <> B.text text) === Text.cons c text+ === B.toText (mconcat (map B.text trimmedTexts)) ], testGroup "Laws" $ [ followsLaws $ showLaws (Proxy @B.TextBuilder),@@ -50,5 +44,3 @@ ], testGroup "Features" Features.tests ]- where- bigTest = 10000
text-builder-core.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: text-builder-core-version: 0.1.1+version: 0.1.1.1 category: Text, Builders synopsis: Internals of "text-builder" description: