6 import Test.QuickCheck (Arbitrary(..), elements)
9 -- | A type representing the number of bits in a CIDR netmask.
44 deriving (Enum, Eq, Ord)
47 instance Show Maskbits where
71 show TwentyThree = "23"
72 show TwentyFour = "24"
73 show TwentyFive = "25"
75 show TwentySeven = "27"
76 show TwentyEight = "28"
77 show TwentyNine = "29"
83 instance Arbitrary Maskbits where
120 instance Read Maskbits where
122 case (reads s :: [(Int, String)]) of
124 (x,leftover):_ -> go x leftover
126 go :: Int -> String -> [(Maskbits, String)]
128 | x' < minBound || x' > maxBound = []
129 | otherwise = [(toEnum x', leftover')]