on master help sign in
Deprecate putWord*be
cb2cbc4Sylvain Henry
BitsQC.hs+4−4
@@ -268,7 +268,7 @@ prop_bitreq (W w) = property $
268prop_composite_case :: Bool -> W Word16 -> Property
268prop_composite_case :: Bool -> W Word16 -> Property
269prop_composite_case b (W w) = w < 0x8000 ==>
269prop_composite_case b (W w) = w < 0x8000 ==>
270 let p = do putBool b
270 let p = do putBool b
271− putWord16be 15 w
271+ putWord16 15 w
272 g = do v <- getBool
272 g = do v <- getBool
273 case v of
273 case v of
274 True -> getWord16 15
274 True -> getWord16 15
@@ -446,9 +446,9 @@ putPrimitive p =
446 case p of
446 case p of
447 Bool b -> putBool b
447 Bool b -> putBool b
448 W8 n x -> putWord8 n x
448 W8 n x -> putWord8 n x
449− W16 n x -> putWord16be n x
449+ W16 n x -> putWord16 n x
450− W32 n x -> putWord32be n x
450+ W32 n x -> putWord32 n x
451− W64 n x -> putWord64be n x
451+ W64 n x -> putWord64 n x
452 BS _ bs -> putByteString bs
452 BS _ bs -> putByteString bs
453 LBS _ lbs -> mapM_ putByteString (L.toChunks lbs)
453 LBS _ lbs -> mapM_ putByteString (L.toChunks lbs)
454 IsEmpty -> return ()
454 IsEmpty -> return ()
Data/Binary/Bits.hs+3−3
@@ -33,13 +33,13 @@ instance BinaryBit Word8 where
33 getBits = getWord8
33 getBits = getWord8
34
34
35instance BinaryBit Word16 where
35instance BinaryBit Word16 where
36− putBits = putWord16be
36+ putBits = putWord16
37 getBits = getWord16
37 getBits = getWord16
38
38
39instance BinaryBit Word32 where
39instance BinaryBit Word32 where
40− putBits = putWord32be
40+ putBits = putWord32
41 getBits = getWord32
41 getBits = getWord32
42
42
43instance BinaryBit Word64 where
43instance BinaryBit Word64 where
44− putBits = putWord64be
44+ putBits = putWord64
45 getBits = getWord64
45 getBits = getWord64
Data/Binary/Bits/Put.hs+15
@@ -23,6 +23,9 @@ module Data.Binary.Bits.Put
23
23
24 -- ** Words
24 -- ** Words
25 , putWord8
25 , putWord8
26+ , putWord16
27+ , putWord32
28+ , putWord64
26 , putWord16be
29 , putWord16be
27 , putWord32be
30 , putWord32be
28 , putWord64be
31 , putWord64be
@@ -111,16 +114,28 @@ putWord8 :: Int -> Word8 -> BitPut ()
111putWord8 = putWord
114putWord8 = putWord
112
115
113-- | Put the @n@ lower bits of a 'Word16'.
116-- | Put the @n@ lower bits of a 'Word16'.
117+putWord16 :: Int -> Word16 -> BitPut ()
118+putWord16 = putWord
119+
114putWord16be :: Int -> Word16 -> BitPut ()
120putWord16be :: Int -> Word16 -> BitPut ()
115putWord16be = putWord
121putWord16be = putWord
122+{-# DEPRECATED putWord16be "Use 'putWord16' instead" #-}
116
123
117-- | Put the @n@ lower bits of a 'Word32'.
124-- | Put the @n@ lower bits of a 'Word32'.
125+putWord32 :: Int -> Word32 -> BitPut ()
126+putWord32 = putWord
127+
118putWord32be :: Int -> Word32 -> BitPut ()
128putWord32be :: Int -> Word32 -> BitPut ()
119putWord32be = putWord
129putWord32be = putWord
130+{-# DEPRECATED putWord32be "Use 'putWord32' instead" #-}
120
131
121-- | Put the @n@ lower bits of a 'Word64'.
132-- | Put the @n@ lower bits of a 'Word64'.
133+putWord64 :: Int -> Word64 -> BitPut ()
134+putWord64 = putWord
135+
122putWord64be :: Int -> Word64 -> BitPut ()
136putWord64be :: Int -> Word64 -> BitPut ()
123putWord64be = putWord
137putWord64be = putWord
138+{-# DEPRECATED putWord64be "Use 'putWord64' instead" #-}
124
139
125-- | Put a 'ByteString'.
140-- | Put a 'ByteString'.
126--
141--