X-Git-Url: http://gitweb.michael.orlitzky.com/?p=haeredes.git;a=blobdiff_plain;f=src%2FMain.hs;h=f322baae83511743b8ceb4648f9966bddbf42e4a;hp=5c6f401f7a5e839b6f5545bd4e4bba91cd6b3195;hb=2104fcab31ed92c308ce6b05c03d10f9f8b4cf16;hpb=4f6bb3da01e7136f1e17a7d2d28518eefe18fc36 diff --git a/src/Main.hs b/src/Main.hs index 5c6f401..f322baa 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -32,7 +32,12 @@ import DNS ( resolve_address ) import ExitCodes (exit_bad_server) -report :: (Domain, Maybe [Domain]) -> IO () + +-- | Report results for this LookupResult. If there's a Nothing in the +-- second component, there were no query results, so we report that +-- the domain was not delegated. If there were some results and +-- there are leftovers (after "cleaning"), we report those as well. +report :: LookupResult -> IO () report (d, Nothing) = putStrLn $ "Domain " ++ (show d) ++ " not delegated." report (d, Just leftovers) = @@ -42,6 +47,11 @@ report (d, Just leftovers) = " delegates somewhere else: " ++ (join " " (map show leftovers)) + +-- | "Clean" a lookup result by subtracting out the list of delegates. +-- There shouldn't be anything left over. If there were no lookup +-- results, we leave the Nothing in place so that 'report' can +-- pattern match on it. clean :: [Domain] -- ^ List of delegates, @ds@ -> LookupResult -> LookupResult