instance Read Cidr where
-- | Parse everything or nothing.
- readsPrec _ = \s ->
+ readsPrec _ s =
case (octets_from_cidr_string s) of
[oct1, oct2, oct3, oct4] ->
case (maskbits_from_cidr_string s) of
instance Read Maskbits where
- readsPrec _ = \s ->
+ readsPrec _ s =
case (reads s :: [(Int, String)]) of
[] -> []
(x,leftover):_ -> go x leftover
where
go :: Int -> String -> [(Maskbits, String)]
- go y s
- | y < minBound || y > maxBound = []
- | otherwise = [(toEnum y, s)]
+ go x' leftover'
+ | x' < minBound || x' > maxBound = []
+ | otherwise = [(toEnum x', leftover')]
instance Read Octet where
- readsPrec _ = \s ->
+ readsPrec _ s =
case (reads s :: [(Int, String)]) of
[] -> []
(x,leftover):_ -> go x leftover
where
go :: Int -> String -> [(Octet, String)]
- go y s
- | y < minBound || y > maxBound = []
- | otherwise = [(toEnum y, s)]
+ go x' leftover'
+ | x' < minBound || x' > maxBound = []
+ | otherwise = [(toEnum x', leftover')]
-- Test lists.