on master help sign in
Deprecate functions with "be" suffix
7124284Sylvain HENRY
Data/Binary/Bits.hs+3−3
@@ -34,12 +34,12 @@ instance BinaryBit Word8 where
34
34
35instance BinaryBit Word16 where
35instance BinaryBit Word16 where
36 putBits = putWord16be
36 putBits = putWord16be
37− getBits = getWord16be
37+ getBits = getWord16
38
38
39instance BinaryBit Word32 where
39instance BinaryBit Word32 where
40 putBits = putWord32be
40 putBits = putWord32be
41− getBits = getWord32be
41+ getBits = getWord32
42
42
43instance BinaryBit Word64 where
43instance BinaryBit Word64 where
44 putBits = putWord64be
44 putBits = putWord64be
45− getBits = getWord64be
45+ getBits = getWord64
Data/Binary/Bits/Get.hs+36−6
@@ -62,6 +62,9 @@ module Data.Binary.Bits.Get
62 -- ** Get bytes
62 -- ** Get bytes
63 , getBool
63 , getBool
64 , getWord8
64 , getWord8
65+ , getWord16
66+ , getWord32
67+ , getWord64
65 , getWord16be
68 , getWord16be
66 , getWord32be
69 , getWord32be
67 , getWord64be
70 , getWord64be
@@ -79,6 +82,9 @@ module Data.Binary.Bits.Get
79 -- ** Read in Blocks
82 -- ** Read in Blocks
80 , bool
83 , bool
81 , word8
84 , word8
85+ , word16
86+ , word32
87+ , word64
82 , word16be
88 , word16be
83 , word32be
89 , word32be
84 , word64be
90 , word64be
@@ -395,16 +401,28 @@ getWord8 :: Int -> BitGet Word8
395getWord8 n = block (word8 n)
401getWord8 n = block (word8 n)
396
402
397-- | Get @n@ bits as a 'Word16'. @n@ must be within @[0..16]@.
403-- | Get @n@ bits as a 'Word16'. @n@ must be within @[0..16]@.
404+getWord16 :: Int -> BitGet Word16
405+getWord16 n = block (word16 n)
406+
398getWord16be :: Int -> BitGet Word16
407getWord16be :: Int -> BitGet Word16
399−getWord16be n = block (word16be n)
408+getWord16be = getWord16
409+{-# DEPRECATED getWord16be "Use 'getWord16' instead" #-}
400
410
401-- | Get @n@ bits as a 'Word32'. @n@ must be within @[0..32]@.
411-- | Get @n@ bits as a 'Word32'. @n@ must be within @[0..32]@.
412+getWord32 :: Int -> BitGet Word32
413+getWord32 n = block (word32 n)
414+
402getWord32be :: Int -> BitGet Word32
415getWord32be :: Int -> BitGet Word32
403−getWord32be n = block (word32be n)
416+getWord32be = getWord32
417+{-# DEPRECATED getWord32be "Use 'getWord32' instead" #-}
404
418
405-- | Get @n@ bits as a 'Word64'. @n@ must be within @[0..64]@.
419-- | Get @n@ bits as a 'Word64'. @n@ must be within @[0..64]@.
420+getWord64 :: Int -> BitGet Word64
421+getWord64 n = block (word64 n)
422+
406getWord64be :: Int -> BitGet Word64
423getWord64be :: Int -> BitGet Word64
407−getWord64be n = block (word64be n)
424+getWord64be = getWord64
425+{-# DEPRECATED getWord64be "Use 'getWord64' instead" #-}
408
426
409-- | Get @n@ bytes as a 'ByteString'.
427-- | Get @n@ bytes as a 'ByteString'.
410getByteString :: Int -> BitGet ByteString
428getByteString :: Int -> BitGet ByteString
@@ -458,16 +476,28 @@ word8 :: Int -> Block Word8
458word8 n = Block n (readWordChecked 8 n)
476word8 n = Block n (readWordChecked 8 n)
459
477
460-- | Read @n@ bits as a 'Word16'. @n@ must be within @[0..16]@.
478-- | Read @n@ bits as a 'Word16'. @n@ must be within @[0..16]@.
479+word16 :: Int -> Block Word16
480+word16 n = Block n (readWordChecked 16 n)
481+
461word16be :: Int -> Block Word16
482word16be :: Int -> Block Word16
462−word16be n = Block n (readWordChecked 16 n)
483+word16be = word16
484+{-# DEPRECATED word16be "Use 'word16' instead" #-}
463
485
464-- | Read @n@ bits as a 'Word32'. @n@ must be within @[0..32]@.
486-- | Read @n@ bits as a 'Word32'. @n@ must be within @[0..32]@.
487+word32 :: Int -> Block Word32
488+word32 n = Block n (readWordChecked 32 n)
489+
465word32be :: Int -> Block Word32
490word32be :: Int -> Block Word32
466−word32be n = Block n (readWordChecked 32 n)
491+word32be = word32
492+{-# DEPRECATED word32be "Use 'word32' instead" #-}
467
493
468-- | Read @n@ bits as a 'Word64'. @n@ must be within @[0..64]@.
494-- | Read @n@ bits as a 'Word64'. @n@ must be within @[0..64]@.
495+word64 :: Int -> Block Word64
496+word64 n = Block n (readWordChecked 64 n)
497+
469word64be :: Int -> Block Word64
498word64be :: Int -> Block Word64
470−word64be n = Block n (readWordChecked 64 n)
499+word64be = word64
500+{-# DEPRECATED word64be "Use 'word64' instead" #-}
471
501
472-- | Read @n@ bytes as a 'ByteString'.
502-- | Read @n@ bytes as a 'ByteString'.
473byteString :: Int -> Block ByteString
503byteString :: Int -> Block ByteString