Ticket #7424: Bool.hs
| File Bool.hs, 375 bytes (added by Aninhumer, 6 months ago) |
|---|
| Line | |
|---|---|
| 1 | module Data.Bits.Bool where |
| 2 | |
| 3 | import Data.Bits |
| 4 | |
| 5 | instance Bits Bool where |
| 6 | bitSize _ = 1 |
| 7 | isSigned _ = False |
| 8 | testBit x 0 = x |
| 9 | testBit x _ = False |
| 10 | bit 0 = True |
| 11 | bit _ = False |
| 12 | complement = not |
| 13 | (.&.) = (&&) |
| 14 | (.|.) = (||) |
| 15 | xor = (/=) |
| 16 | shiftL _ _ = False |
| 17 | shiftR _ _ = False |
| 18 | rotate x _ = x |
| 19 | popCount True = 1 |
| 20 | popCount False = 0 |
