merge_optional )
where
+import Data.Monoid ( Monoid(..) )
import System.Console.CmdArgs.Default ( Default(..) )
+-- From the harbl library.
+import Network.DNS.RBL.Weight ( Weight )
+
import qualified OptionalConfiguration as OC (
OptionalConfiguration(..) )
import Hosts ( Hosts(..) )
Configuration {
hosts :: Hosts,
lists :: Lists }
+-- threshold :: Weight }
deriving (Show)
-- values.
--
instance Default Configuration where
- def = Configuration { hosts = def, lists = def }
+ def = Configuration { hosts = def,
+ lists = def }
+-- threshold = def }
-- | Merge a 'Configuration' with an 'OptionalConfiguration'. This is
merge_optional cfg opt_cfg =
Configuration all_hosts all_lists
where
- all_hosts =
- Hosts $ (get_hosts $ hosts cfg) ++ (get_hosts $ OC.hosts opt_cfg)
- all_lists =
- Lists $ (get_lists $ lists cfg) ++ (get_lists $ OC.lists opt_cfg)
+ all_hosts = (hosts cfg) `mappend` (OC.hosts opt_cfg)
+ all_lists = (lists cfg) `mappend` (OC.lists opt_cfg)