Skip to content

Commit 01b5f36

Browse files
committed
Cosmetic renames asc -> ascii
1 parent 7f1aca0 commit 01b5f36

File tree

5 files changed

+31
-31
lines changed

5 files changed

+31
-31
lines changed

Data/ByteString/Builder.hs

+4-4
Original file line numberDiff line numberDiff line change
@@ -451,11 +451,11 @@ string8 = P.primMapListFixed P.char8
451451
{-# RULES
452452
"string8/unpackCString#" forall s.
453453
string8 (unpackCString# s) =
454-
ascLiteralCopy (Ptr s) (byteCountLiteral s)
454+
asciiLiteralCopy (Ptr s) (byteCountLiteral s)
455455

456456
"string8/unpackFoldrCString#" forall s.
457457
string8 (build (unpackFoldrCString# s)) =
458-
ascLiteralCopy (Ptr s) (byteCountLiteral s)
458+
asciiLiteralCopy (Ptr s) (byteCountLiteral s)
459459
#-}
460460

461461
------------------------------------------------------------------------------
@@ -482,11 +482,11 @@ stringUtf8 = P.primMapListBounded P.charUtf8
482482

483483
"stringUtf8/unpackCString#" forall s.
484484
stringUtf8 (unpackCString# s) =
485-
ascLiteralCopy (Ptr s) (byteCountLiteral s)
485+
asciiLiteralCopy (Ptr s) (byteCountLiteral s)
486486

487487
"stringUtf8/unpackFoldrCString#" forall s.
488488
stringUtf8 (build (unpackFoldrCString# s)) =
489-
ascLiteralCopy (Ptr s) (byteCountLiteral s)
489+
asciiLiteralCopy (Ptr s) (byteCountLiteral s)
490490
#-}
491491

492492
instance IsString Builder where

Data/ByteString/Builder/Internal.hs

+4-4
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ module Data.ByteString.Builder.Internal (
8484
-- , sizedChunksInsert
8585

8686
, byteStringCopy
87-
, ascLiteralCopy
87+
, asciiLiteralCopy
8888
, modUtf8LitCopy
8989
, byteStringInsert
9090
, byteStringThreshold
@@ -889,9 +889,9 @@ byteStringInsert =
889889
-- @0xC0 0x80@) null characters.
890890
--
891891
-- @since 0.11.5.0
892-
{-# INLINABLE ascLiteralCopy #-}
893-
ascLiteralCopy :: Ptr Word8 -> Int -> Builder
894-
ascLiteralCopy = \ !ip !len -> builder $ \k br -> do
892+
{-# INLINABLE asciiLiteralCopy #-}
893+
asciiLiteralCopy :: Ptr Word8 -> Int -> Builder
894+
asciiLiteralCopy = \ !ip !len -> builder $ \k br -> do
895895
let !ipe = ip `plusPtr` len
896896
wrappedBytesCopyStep (BufferRange ip ipe) k br
897897

Data/ByteString/Builder/Prim.hs

+2-2
Original file line numberDiff line numberDiff line change
@@ -668,9 +668,9 @@ primMapLazyByteStringBounded w =
668668
-- @0xC0 0x80@) null characters.
669669
--
670670
-- @since 0.11.0.0
671-
{-# DEPRECATED cstring "Use ascLiteralCopy instead" #-}
671+
{-# DEPRECATED cstring "Use asciiLiteralCopy instead" #-}
672672
cstring :: Addr# -> Builder
673-
cstring s = ascLiteralCopy (Ptr s) (S.byteCountLiteral s)
673+
cstring s = asciiLiteralCopy (Ptr s) (S.byteCountLiteral s)
674674
{-# INLINE cstring #-}
675675

676676
-- | Builder for raw 'Addr#' pointers to null-terminated primitive UTF-8

bench/BenchAll.hs

+16-16
Original file line numberDiff line numberDiff line change
@@ -251,17 +251,17 @@ largeTraversalInput = S.concat (replicate 10 byteStringData)
251251
smallTraversalInput :: S.ByteString
252252
smallTraversalInput = S8.pack "The quick brown fox"
253253

254-
ascBuf, utfBuf :: Ptr Word8
255-
ascBuf = Ptr "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"#
256-
utfBuf = Ptr "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\xc0\x80xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"#
254+
asciiBuf, utf8Buf :: Ptr Word8
255+
asciiBuf = Ptr "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"#
256+
utf8Buf = Ptr "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\xc0\x80xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"#
257257

258-
asclit, utflit :: Ptr Word8 -> Builder
259-
asclit str@(Ptr addr) = BI.ascLiteralCopy str (byteCountLiteral addr)
260-
utflit str@(Ptr addr) = BI.modUtf8LitCopy str (byteCountLiteral addr)
258+
asciiLit, utf8Lit :: Ptr Word8 -> Builder
259+
asciiLit str@(Ptr addr) = BI.asciiLiteralCopy str (byteCountLiteral addr)
260+
utf8Lit str@(Ptr addr) = BI.modUtf8LitCopy str (byteCountLiteral addr)
261261

262-
ascStr, utfStr :: String
263-
ascStr = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
264-
utfStr = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\0xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
262+
asciiStr, utf8Str :: String
263+
asciiStr = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
264+
utf8Str = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\0xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
265265

266266
main :: IO ()
267267
main = do
@@ -272,15 +272,15 @@ main = do
272272
, benchB' "ensureFree 8" () (const (ensureFree 8))
273273
, benchB' "intHost 1" 1 intHost
274274
, benchB' "UTF-8 String (naive)" "hello world\0" fromString
275-
, benchB' "UTF-8 String" () $ \() -> utflit (Ptr "hello world\xc0\x80"#)
275+
, benchB' "UTF-8 String" () $ \() -> utf8Lit (Ptr "hello world\xc0\x80"#)
276276
, benchB' "String (naive)" "hello world!" fromString
277-
, benchB' "String" () $ \() -> asclit (Ptr "hello world!"#)
278-
, benchB' "AsciiLit" () $ \() -> asclit ascBuf
279-
, benchB' "Utf8Lit" () $ \() -> utflit utfBuf
280-
, benchB' "strLit" () $ \() -> string8 ascStr
281-
, benchB' "utfLit" () $ \() -> stringUtf8 utfStr
277+
, benchB' "String" () $ \() -> asciiLit (Ptr "hello world!"#)
278+
, benchB' "AsciiLit" () $ \() -> asciiLit asciiBuf
279+
, benchB' "Utf8Lit" () $ \() -> utf8Lit utf8Buf
280+
, benchB' "strLit" () $ \() -> string8 asciiStr
281+
, benchB' "stringUtf8" () $ \() -> stringUtf8 utf8Str
282282
, benchB' "strLitInline" () $ \() -> string8 "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
283-
, benchB' "utfLitInline" () $ \() -> stringUtf8 "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\0XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
283+
, benchB' "utf8LitInline" () $ \() -> stringUtf8 "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\0XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
284284
]
285285

286286
, bgroup "Encoding wrappers"

tests/builder/Data/ByteString/Builder/Tests.hs

+5-5
Original file line numberDiff line numberDiff line change
@@ -991,18 +991,18 @@ testsUtf8 =
991991
testCString :: [TestTree]
992992
testCString =
993993
[ testProperty "cstring" $
994-
toLazyByteString (asclit (Ptr "hello world!"#)) ==
994+
toLazyByteString (asciiLit (Ptr "hello world!"#)) ==
995995
LC.pack "hello" `L.append` L.singleton 0x20
996996
`L.append` LC.pack "world!"
997997
, testProperty "cstringUtf8" $
998-
toLazyByteString (utflit (Ptr "hello\xc0\x80\xc0\x80world\xc0\x80!"#)) ==
998+
toLazyByteString (utf8Lit (Ptr "hello\xc0\x80\xc0\x80world\xc0\x80!"#)) ==
999999
LC.pack "hello" `L.append` L.singleton 0x00
10001000
`L.append` L.singleton 0x00
10011001
`L.append` LC.pack "world"
10021002
`L.append` L.singleton 0x00
10031003
`L.append` LC.singleton '!'
10041004
]
10051005

1006-
asclit, utflit :: Ptr Word8 -> Builder
1007-
asclit str@(Ptr addr) = BI.ascLiteralCopy str (S.byteCountLiteral addr)
1008-
utflit str@(Ptr addr) = BI.modUtf8LitCopy str (S.byteCountLiteral addr)
1006+
asciiLit, utf8Lit :: Ptr Word8 -> Builder
1007+
asciiLit str@(Ptr addr) = BI.asciiLiteralCopy str (S.byteCountLiteral addr)
1008+
utf8Lit str@(Ptr addr) = BI.modUtf8LitCopy str (S.byteCountLiteral addr)

0 commit comments

Comments
 (0)