+ Args{..} <- apply_args
+
+ -- Get the input from either stdin, or the file given on the command
+ -- line.
+ input <- case input_file of
+ Nothing -> BS.hGetContents stdin
+ Just path -> do
+ is_file <- doesFileExist path
+ when (not is_file) $ do
+ exitWith (ExitFailure exit_input_file_doesnt_exist)
+ BS.readFile path
+
+ -- Do the same for the output handle and stdout.
+ output_handle <- case output_file of
+ Nothing -> return stdout
+ Just path -> openFile path WriteMode
+
+ -- Split the input into lines.
+ let addresses = BSU.lines input
+
+ -- And remove the empty ones.