]> gitweb.michael.orlitzky.com - haeredes.git/blobdiff - src/Timeout.hs
Add a "timeout" command-line argument.
[haeredes.git] / src / Timeout.hs
diff --git a/src/Timeout.hs b/src/Timeout.hs
new file mode 100644 (file)
index 0000000..6f0f3d4
--- /dev/null
@@ -0,0 +1,18 @@
+{-# LANGUAGE DeriveDataTypeable #-}
+
+-- | A newtype around the DNS query timeout, in seconds. Needed for
+--   the 'Default' instance.
+--
+module Timeout
+where
+
+import Data.Data (Data)
+import System.Console.CmdArgs.Default (Default(..))
+import Data.Typeable (Typeable)
+
+newtype Timeout =
+  Timeout { seconds :: Int }
+  deriving (Data, Show, Typeable)
+
+instance Default Timeout where
+  def = Timeout 15