]> gitweb.michael.orlitzky.com - hath.git/blobdiff - src/Cidr.hs
Add some more tests; minor code cleanup.
[hath.git] / src / Cidr.hs
index e23ae6c1a55a2ba0e9c9de333cc4c8bbbb369453..b5b3f744fd56651848387d7e010766bd328adb19 100644 (file)
@@ -30,6 +30,7 @@ import Test.Framework (Test, testGroup)
 import Test.Framework.Providers.HUnit (testCase)
 import Test.Framework.Providers.QuickCheck2 (testProperty)
 import Test.QuickCheck (Arbitrary(..), Gen, Property, (==>))
+import Text.Read (readMaybe)
 
 import qualified Bit as B
 import IPv4Address
@@ -78,7 +79,7 @@ maskbits_from_cidr_string s
 --   of its octets (as Ints).
 octets_from_cidr_string :: String -> [Octet]
 octets_from_cidr_string s =
-  mapMaybe octet_from_string (take 4 (splitOneOf "./" s))
+  mapMaybe readMaybe (take 4 (splitOneOf "./" s))
 
 
 -- | Return Nothing if we can't parse both maskbits and octets from