Skip to content

Commit 94d58dd

Browse files
committed
Avoid unnecessary use of Data.ByteString.Builder.Prim
1 parent 3c37e68 commit 94d58dd

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

src/Data/Binary/Builder.hs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ import qualified Data.ByteString.Short as T
7474
#endif
7575

7676
import qualified Data.ByteString.Builder as B
77-
import qualified Data.ByteString.Builder.Prim as Prim
77+
import qualified Data.ByteString.Builder.Extra as B
7878
import Data.ByteString.Builder ( Builder, toLazyByteString )
7979
import Data.ByteString.Builder.Extra ( flush )
8080
import Data.Monoid
@@ -208,26 +208,26 @@ putInt64le = B.int64LE
208208
-- different endian or word sized machines, without conversion.
209209
--
210210
putWordhost :: Word -> Builder
211-
putWordhost = Prim.primFixed Prim.wordHost
211+
putWordhost = B.wordHost
212212
{-# INLINE putWordhost #-}
213213

214214
-- | Write a Word16 in native host order and host endianness.
215215
-- 2 bytes will be written, unaligned.
216216
putWord16host :: Word16 -> Builder
217-
putWord16host = Prim.primFixed Prim.word16Host
217+
putWord16host = B.word16Host
218218
{-# INLINE putWord16host #-}
219219

220220
-- | Write a Word32 in native host order and host endianness.
221221
-- 4 bytes will be written, unaligned.
222222
putWord32host :: Word32 -> Builder
223-
putWord32host = Prim.primFixed Prim.word32Host
223+
putWord32host = B.word32Host
224224
{-# INLINE putWord32host #-}
225225

226226
-- | Write a Word64 in native host order.
227227
-- On a 32 bit machine we write two host order Word32s, in big endian form.
228228
-- 8 bytes will be written, unaligned.
229229
putWord64host :: Word64 -> Builder
230-
putWord64host = Prim.primFixed Prim.word64Host
230+
putWord64host = B.word64Host
231231
{-# INLINE putWord64host #-}
232232

233233
-- | /O(1)./ A Builder taking a single native machine word. The word is
@@ -237,26 +237,26 @@ putWord64host = Prim.primFixed Prim.word64Host
237237
-- different endian or word sized machines, without conversion.
238238
--
239239
putInthost :: Int -> Builder
240-
putInthost = Prim.primFixed Prim.intHost
240+
putInthost = B.intHost
241241
{-# INLINE putInthost #-}
242242

243243
-- | Write a Int16 in native host order and host endianness.
244244
-- 2 bytes will be written, unaligned.
245245
putInt16host :: Int16 -> Builder
246-
putInt16host = Prim.primFixed Prim.int16Host
246+
putInt16host = B.int16Host
247247
{-# INLINE putInt16host #-}
248248

249249
-- | Write a Int32 in native host order and host endianness.
250250
-- 4 bytes will be written, unaligned.
251251
putInt32host :: Int32 -> Builder
252-
putInt32host = Prim.primFixed Prim.int32Host
252+
putInt32host = B.int32Host
253253
{-# INLINE putInt32host #-}
254254

255255
-- | Write a Int64 in native host order.
256256
-- On a 32 bit machine we write two host order Int32s, in big endian form.
257257
-- 8 bytes will be written, unaligned.
258258
putInt64host :: Int64 -> Builder
259-
putInt64host = Prim.primFixed Prim.int64Host
259+
putInt64host = B.int64Host
260260
{-# INLINE putInt64host #-}
261261

262262

@@ -265,10 +265,10 @@ putInt64host = Prim.primFixed Prim.int64Host
265265

266266
-- | Write a character using UTF-8 encoding.
267267
putCharUtf8 :: Char -> Builder
268-
putCharUtf8 = Prim.primBounded Prim.charUtf8
268+
putCharUtf8 = B.charUtf8
269269
{-# INLINE putCharUtf8 #-}
270270

271271
-- | Write a String using UTF-8 encoding.
272272
putStringUtf8 :: String -> Builder
273-
putStringUtf8 = Prim.primMapListBounded Prim.charUtf8
273+
putStringUtf8 = B.stringUtf8
274274
{-# INLINE putStringUtf8 #-}

0 commit comments

Comments
 (0)