string-interpolate 0.1.0.0 → 0.1.0.1
raw patch · 4 files changed
+33/−25 lines, 4 filesdep −Interpolation
Dependencies removed: Interpolation
Files
- CHANGELOG.md +5/−0
- README.md +4/−0
- bench/Bench.hs +21/−21
- string-interpolate.cabal +3/−4
CHANGELOG.md view
@@ -2,6 +2,11 @@ ## Unreleased +## v0.1.0.1 (2019-05-06)+++ Remove Interpolation from the default benchmarks because it's not+ on Stackage+ ## v0.1.0.0 (2019-03-17) + Add support for using Text and ByteString `Builder`s as both sinks
README.md view
@@ -181,3 +181,7 @@ All results were tested on my local machine. If you'd like to attempt to replicate the results, the benchmarks are in `bench/` and can be run with a simple `stack bench`.++(NB: If you're attempting to reproduce these benchmarks, note that the+benchmarks for **Interpolation** are commented out by default, due to+that package not being in Stackage.)
bench/Bench.hs view
@@ -10,7 +10,7 @@ import qualified "string-interpolate" Data.String.Interpolate as SI import qualified "interpolate" Data.String.Interpolate.IsString as I-import "Interpolation" Data.String.Interpolation as N+-- import "Interpolation" Data.String.Interpolation as N import "formatting" Formatting ( (%) ) import qualified "formatting" Formatting as F import qualified "formatting" Formatting.ShortFormatters as F@@ -31,8 +31,8 @@ stringF :: String -> String stringF = F.formatToString ("A fine day to die, " % F.s % ".") -stringN :: String -> String-stringN s = [str|A fine day to die, $s$.|]+-- stringN :: String -> String+-- stringN s = [str|A fine day to die, $s$.|] stringP :: String -> String stringP str = [qc|A fine day to die, {str}.|]@@ -50,8 +50,8 @@ textF :: T.Text -> T.Text textF = F.sformat ("A fine day to die, " % F.st % ".") -textN :: T.Text -> T.Text-textN t = [str|A fine day to die, $t$.|]+-- textN :: T.Text -> T.Text+-- textN t = [str|A fine day to die, $t$.|] textP :: T.Text -> T.Text textP t = [qc|A fine day to die, {t}.|]@@ -66,8 +66,8 @@ byteStringI :: B.ByteString -> B.ByteString byteStringI b = [I.i|A fine day to die, #{b}.|] -byteStringN :: B.ByteString -> B.ByteString-byteStringN b = [str|A fine day to die, $b$.|]+-- byteStringN :: B.ByteString -> B.ByteString+-- byteStringN b = [str|A fine day to die, $b$.|] byteStringP :: B.ByteString -> B.ByteString byteStringP b = [qc|A fine day to die, {b}.|]@@ -86,8 +86,8 @@ multiStringF (x, y, z) = F.formatToString (" foo " % F.d % " bar " % F.s % " baz " % F.sh % " quux ") x y z -multiStringN :: (Int, String, Bool) -> String-multiStringN (x, y, z) = [str| foo $:x$ bar $y$ baz $:z$ quux |]+-- multiStringN :: (Int, String, Bool) -> String+-- multiStringN (x, y, z) = [str| foo $:x$ bar $y$ baz $:z$ quux |] multiStringP :: (Int, String, Bool) -> String multiStringP (x, y, z) = [qc| foo {x} bar {y} baz {z} quux |]@@ -106,8 +106,8 @@ multiTextF (x, y, z) = F.sformat (" foo " % F.d % " bar " % F.st % " baz " % F.sh % " quux ") x y z -multiTextN :: (Int, T.Text, Bool) -> T.Text-multiTextN (x, y, z) = [str| foo $:x$ bar $y$ baz $:z$ quux |]+-- multiTextN :: (Int, T.Text, Bool) -> T.Text+-- multiTextN (x, y, z) = [str| foo $:x$ bar $y$ baz $:z$ quux |] multiTextP :: (Int, T.Text, Bool) -> T.Text multiTextP (x, y, z) = [qc| foo {x} bar {y} baz {z} quux |]@@ -122,8 +122,8 @@ multiByteStringI :: (Int, B.ByteString, Bool) -> B.ByteString multiByteStringI (x, y, z) = [I.i| foo #{x} bar #{y} baz #{z} quux |] -multiByteStringN :: (Int, B.ByteString, Bool) -> B.ByteString-multiByteStringN (x, y, z) = [str| foo $:x$ bar $y$ baz $:z$ quux |]+-- multiByteStringN :: (Int, B.ByteString, Bool) -> B.ByteString+-- multiByteStringN (x, y, z) = [str| foo $:x$ bar $y$ baz $:z$ quux |] multiByteStringP :: (Int, B.ByteString, Bool) -> B.ByteString multiByteStringP (x, y, z) = [qc| foo {x} bar {y} baz {z} quux |]@@ -134,56 +134,56 @@ [ bench "string-interpolate" $ nf stringSI "William" , bench "interpolate" $ nf stringI "William" , bench "formatting" $ nf stringF "William"- , bench "Interpolation" $ nf stringN "William"+ -- , bench "Interpolation" $ nf stringN "William" , bench "interpolatedstring-perl6" $ nf stringP "William" ] , bgroup "Small Text Bench" $ [ bench "string-interpolate" $ nf textSI "William" , bench "interpolate" $ nf textI "William" , bench "formatting" $ nf textF "William"- , bench "Interpolation" $ nf textN "William"+ -- , bench "Interpolation" $ nf textN "William" , bench "interpolatedstring-perl6" $ nf textP "William" ] , bgroup "Small ByteString Bench" $ [ bench "string-interpolate" $ nf byteStringSI "William" , bench "interpolate" $ nf byteStringI "William" -- "formatting" doesn't support ByteStrings.- , bench "Interpolation" $ nf byteStringN "William"+ -- , bench "Interpolation" $ nf byteStringN "William" , bench "interpolatedstring-perl6" $ nf byteStringP "William" ] , bgroup "Multiple Interpolations String Bench" $ [ bench "string-interpolate" $ nf multiStringSI (42, "CATALLAXY", True) , bench "interpolate" $ nf multiStringI (42, "CATALLAXY", True) , bench "formatting" $ nf multiStringF (42, "CATALLAXY", True)- , bench "Interpolation" $ nf multiStringN (42, "CATALLAXY", True)+ -- , bench "Interpolation" $ nf multiStringN (42, "CATALLAXY", True) , bench "interpolatedstring-perl6" $ nf multiStringP (42, "CATALLAXY", True) ] , bgroup "Multiple Interpolations Text Bench" $ [ bench "string-interpolate" $ nf multiTextSI (42, "CATALLAXY", True) , bench "interpolate" $ nf multiTextI (42, "CATALLAXY", True) , bench "formatting" $ nf multiTextF (42, "CATALLAXY", True)- , bench "Interpolation" $ nf multiTextN (42, "CATALLAXY", True)+ -- , bench "Interpolation" $ nf multiTextN (42, "CATALLAXY", True) , bench "interpolatedstring-perl6" $ nf multiTextP (42, "CATALLAXY", True) ] , bgroup "Multiple Interpolations ByteString Bench" $ [ bench "string-interpolate" $ nf multiByteStringSI (42, "CATALLAXY", True) , bench "interpolate" $ nf multiByteStringI (42, "CATALLAXY", True) -- "formatting" doesn't support ByteStrings.- , bench "Interpolation" $ nf multiByteStringN (42, "CATALLAXY", True)+ -- , bench "Interpolation" $ nf multiByteStringN (42, "CATALLAXY", True) , bench "interpolatedstring-perl6" $ nf multiByteStringP (42, "CATALLAXY", True) ] , env largeishText $ \ ~t -> bgroup "Largeish Text Bench" $ [ bench "string-interpolate" $ nf textSI t , bench "interpolate" $ nf textI t , bench "formatting" $ nf textF t- , bench "Interpolation" $ nf textN t+ -- , bench "Interpolation" $ nf textN t , bench "interpolatedstring-perl6" $ nf textP t ] , env largeishByteString $ \ ~bs -> bgroup "Largeish ByteString Bench" $ [ bench "string-interpolate" $ nf byteStringSI bs , bench "interpolate" $ nf byteStringI bs -- "formatting" doesn't support ByteStrings.- , bench "Interpolation" $ nf byteStringN bs+ -- , bench "Interpolation" $ nf byteStringN bs , bench "interpolatedstring-perl6" $ nf byteStringP bs ] ]
string-interpolate.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: e5e0c8e769850dc5f6451b53b84d5b2e9afce9ef6393e668d971ef3bfe810401+-- hash: ad28f2a20ac261f412c88b067c9a85fa660b138da915365baa1638e0528d7adc name: string-interpolate-version: 0.1.0.0+version: 0.1.0.1 synopsis: Haskell string/text/bytestring interpolation that just works description: Unicode-aware string interpolation that handles all textual types. .@@ -69,8 +69,7 @@ hs-source-dirs: bench build-depends:- Interpolation- , QuickCheck+ QuickCheck , base ==4.* , bytestring , criterion