]> gitweb.michael.orlitzky.com - hath.git/blob - src/Bit.hs
Switch from test-framework to tasty.
[hath.git] / src / Bit.hs
1 -- | The Bit module contains the Bit data type, which is essentially a
2 -- renamed Boolean, and some convenience functions.
3 module Bit (
4 Bit(..)
5 )
6 where
7
8 import Test.Tasty.QuickCheck (
9 Arbitrary,
10 arbitrary,
11 elements )
12
13
14 data Bit = Zero | One
15 deriving (Enum, Eq)
16
17 instance Show Bit where
18 show Zero = "0"
19 show One = "1"
20
21
22 instance Arbitrary Bit where
23 arbitrary = elements [ Zero, One ]
24
25
26 instance Ord Bit where
27 Zero <= Zero = True
28 Zero <= One = True
29 One <= Zero = False
30 One <= One = True
31
32 instance Bounded Bit where
33 minBound = Zero
34 maxBound = One