Add module Bits, with BinaryBit class and instances

This commit is contained in:
Lennart Kolmodin 2010-08-26 18:40:22 +04:00
parent 4b75399ed5
commit 352913f332
2 changed files with 23 additions and 1 deletions

22
Bits.hs Normal file
View File

@ -0,0 +1,22 @@
module Bits where
import BitsGet
import BitsPut
import Data.Word
class BinaryBit a where
putBits :: Int -> a -> BitPut ()
getBits :: Int -> BitGet a
instance BinaryBit Bool where
putBits _ = putBool
getBits _ = getBool
instance BinaryBit Word8 where
putBits = putWord8
getBits = getWord8
instance BinaryBit Word16 where
putBits = putWord16be
getBits = getWord16be

View File

@ -20,7 +20,7 @@ cabal-version: >=1.8
library
exposed-modules: BitsGet
exposed-modules: BitsGet, BitsPut, Bits
build-depends: base==4.*, binary, bytestring
-- other-modules: