1 -- | The Bit module contains the Bit data type, which is essentially a
2 -- renamed Boolean, and some convenience functions.
6 import Test.QuickCheck (
16 instance Show Bit where
21 instance Arbitrary Bit where
22 arbitrary = elements [ Zero, One ]
25 -- | Convert a Bit to an Int.
26 bit_to_int :: Bit -> Int
30 -- | If we are passed a '0' or '1', convert it
31 -- appropriately. Otherwise, default to Nothing.
32 bit_from_char :: Char -> Maybe Bit
33 bit_from_char '0' = Just Zero
34 bit_from_char '1' = Just One
35 bit_from_char _ = Nothing