1 -- | This module defines the 'Configuration' type, which is just a
2 -- wrapper around all of the configuration options we accept on the
10 import System.Console.CmdArgs.Default ( Default(..) )
12 import qualified OptionalConfiguration as OC (
13 OptionalConfiguration(..) )
14 import Hosts ( Hosts(..) )
15 import Lists ( Lists(..) )
18 -- | The main configuration data type. This will be passed to most of
19 -- the important functions once it has been created.
28 -- | A Configuration with all of its fields set to their default
31 instance Default Configuration where
32 def = Configuration { hosts = def, lists = def }
35 -- | Merge a 'Configuration' with an 'OptionalConfiguration'. This is
36 -- more or less the Monoid instance for 'OptionalConfiguration', but
37 -- since the two types are different, we have to repeat ourselves.
39 merge_optional :: Configuration
40 -> OC.OptionalConfiguration
42 merge_optional cfg opt_cfg =
43 Configuration all_hosts all_lists
46 Hosts $ (get_hosts $ hosts cfg) ++ (get_hosts $ OC.hosts opt_cfg)
48 Lists $ (get_lists $ lists cfg) ++ (get_lists $ OC.lists opt_cfg)