Commit 9c2eee50 authored by William Yao's avatar William Yao

Merge branch 'remove-interpolation' into 'master'

Remove Interpolation and bump version

See merge request !16
parents dd1e4d44 ddbb6568
Pipeline #60066282 passed with stages
in 5 minutes and 13 seconds
......@@ -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
......
......@@ -181,3 +181,7 @@ the pack in `Text` cases.
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.)
......@@ -10,7 +10,7 @@ import qualified Data.Text as T
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 @@ stringI str = [I.i|A fine day to die, #{str}.|]
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 @@ textI t = [I.i|A fine day to die, #{t}.|]
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 @@ byteStringSI b = [SI.i|A fine day to die, #{b}.|]
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 :: (Int, String, Bool) -> String
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 :: (Int, T.Text, Bool) -> T.Text
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 @@ multiByteStringSI (x, y, z) = [SI.i| foo #{x} bar #{y} baz #{z} quux |]
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 @@ main = defaultMain $
[ 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
]
]
......
name: string-interpolate
version: 0.1.0.0
version: 0.1.0.1
license: BSD3
author: "William Yao"
maintainer: "williamyaoh@gmail.com"
......@@ -55,6 +55,5 @@ benchmarks:
- string-interpolate
- interpolate
- formatting
- Interpolation
- interpolatedstring-perl6
- QuickCheck
......@@ -33,12 +33,7 @@ resolver: lts-11.13
# - auto-update
# - wai
packages:
- .
# Dependency packages to be pulled from upstream that are not in the resolver
# using the same syntax as the packages field.
# (e.g., acme-missiles-0.3)
extra-deps:
- Interpolation-0.3.0@sha256:b0381214e6036ed2b6a0a04b7e4ec89736ca531ef03e315a3ec2c494059ff8fb
- .
# Override default flag values for local packages and extra-deps
# flags: {}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment