1 -- | This module defines the 'Configuration' type, which is just a
2 -- wrapper around all of the configuration options we accept on the
11 import System.Console.CmdArgs.Default ( Default(..) )
13 -- Harbl library imports.
14 import Network.DNS.RBL.Weight ( Weight )
17 import qualified OptionalConfiguration as OC (
18 OptionalConfiguration(..),
21 import Hosts ( Hosts(..) )
22 import Lists ( Lists(..) )
25 -- | The main configuration data type. This will be passed to most of
26 -- the important functions once it has been created.
36 -- | A Configuration with all of its fields set to their default
39 instance Default Configuration where
40 def = Configuration { hosts = def,
45 -- | Merge a 'Configuration' with an 'OptionalConfiguration'. This is
46 -- more or less the Monoid instance for 'OptionalConfiguration', but
47 -- since the two types are different, we have to repeat ourselves.
49 merge_optional :: Configuration
50 -> OC.OptionalConfiguration
52 merge_optional cfg opt_cfg = Configuration hs ls t
54 hs = OC.merge_monoid (hosts cfg) (OC.hosts opt_cfg)
55 ls = OC.merge_monoid (lists cfg) (OC.lists opt_cfg)
56 t = OC.merge_maybe (threshold cfg) (OC.threshold opt_cfg)