import Data.List ((\\), intercalate)
import Data.Maybe (catMaybes, isNothing)
import Data.String.Utils (splitWs)
-import System.Exit (ExitCode(..), exitWith)
+import System.Exit (ExitCode( ExitFailure ), exitWith)
import System.IO (stderr, hPutStrLn)
import Text.Read (readMaybe)
import Cidr (
- Cidr(..),
+ Cidr(),
combine_all,
enumerate,
max_octet1,
-- 5. Stick an address boundary on either side of the result if
-- use_barriers is True.
--
-cidr_to_regex :: Bool -> Cidr.Cidr -> String
+cidr_to_regex :: Bool -> Cidr -> String
cidr_to_regex use_barriers cidr =
let f = if use_barriers then add_barriers else id in
f (intercalate "\\." [range1, range2, range3, range4])
-- Output the bad lines, safely.
let pairs = zip cidr_strings cidrs
- let print_pair (x, Nothing) = hPutStrLn stderr (" * " ++ x)
+
+ let print_pair :: (String, Maybe Cidr) -> IO ()
+ print_pair (x, Nothing) = hPutStrLn stderr (" * " ++ x)
print_pair (_, _) = return ()
mapM_ print_pair pairs