X-Git-Url: http://gitweb.michael.orlitzky.com/?p=haeredes.git;a=blobdiff_plain;f=src%2FMain.hs;h=f5aef9aa92e433ee1bfb2351a360491c104e457d;hp=c93697a0c7d565e431201a56c7d851e10d1f4f2e;hb=78aed23927af1734e0adf03095a617ba5ddbea01;hpb=3f25fc286646f24a1f40e0acda74a6907d2f08f9 diff --git a/src/Main.hs b/src/Main.hs index c93697a..f5aef9a 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -9,7 +9,7 @@ import qualified Data.ByteString.Char8 as BS ( getContents, pack, words ) -import Data.List ( (\\), intersperse ) +import Data.List ( (\\), intercalate, sort ) import Network.DNS ( DNSError(NameError), Domain, @@ -69,7 +69,8 @@ report _ _ (_, Left _) = return () -- report the leftovers. report delgts normalize_function (d, Right raw_hosts) = do let nrml_hosts = map normalize_function raw_hosts - let leftovers = nrml_hosts \\ delgts + -- Sort the leftovers so that we can test the expected output. + let leftovers = sort (nrml_hosts \\ delgts) unless (null leftovers) $ putStrLn $ "Domain " ++ (show d) ++ @@ -79,7 +80,7 @@ report delgts normalize_function (d, Right raw_hosts) = do -- Create one big string by joining together a list of smaller -- strings and placing a delimiter between them. join :: String -> [String] -> String - join delimiter strings = concat (intersperse delimiter strings) + join delimiter strings = intercalate delimiter strings main :: IO () @@ -141,6 +142,6 @@ main = do results <- parallelInterleaved actions -- Output the results. - _ <- mapM (report nrml_delegates normalize_function) results + mapM_ (report nrml_delegates normalize_function) results stopGlobalPool