5 import Test.Tasty.QuickCheck ( Arbitrary(arbitrary), elements )
8 -- | A type representing the number of bits in a CIDR netmask.
43 deriving (Enum, Eq, Ord)
46 instance Show Maskbits where
70 show TwentyThree = "23"
71 show TwentyFour = "24"
72 show TwentyFive = "25"
74 show TwentySeven = "27"
75 show TwentyEight = "28"
76 show TwentyNine = "29"
82 instance Arbitrary Maskbits where
119 instance Read Maskbits where
121 case (reads s :: [(Int, String)]) of
123 (x,leftover):_ -> go x leftover
125 go :: Int -> String -> [(Maskbits, String)]
127 | x' < minBound || x' > maxBound = []
128 | otherwise = [(toEnum x', leftover')]