]> gitweb.michael.orlitzky.com - haeredes.git/blobdiff - src/Main.hs
Add a doctest suite.
[haeredes.git] / src / Main.hs
index 5c6f401f7a5e839b6f5545bd4e4bba91cd6b3195..f322baae83511743b8ceb4648f9966bddbf42e4a 100644 (file)
@@ -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