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 instance Ord Bit where
31 instance Bounded Bit where
36 -- | Convert a Bit to an Int.
37 bit_to_int :: Bit -> Int
41 -- | If we are passed a '0' or '1', convert it
42 -- appropriately. Otherwise, return Nothing.
43 bit_from_char :: Char -> Maybe Bit
44 bit_from_char '0' = Just Zero
45 bit_from_char '1' = Just One
46 bit_from_char _ = Nothing