1 -- | A newtype around a list of Strings which represent hosts to look up.
2 -- This is all to avoid an orphan instance of 'Configured' for
3 -- [String] if we had defined one in e.g. 'OptionalConfiguration'.
5 {-# LANGUAGE DeriveDataTypeable #-}
6 {-# LANGUAGE GeneralizedNewtypeDeriving #-}
8 module Hosts ( Hosts(..) )
11 import Data.Configurator () -- Needed for predefined instances.
12 import Data.Configurator.Types ( Configured(..) )
13 import Data.Monoid ( Monoid )
14 import Data.Data ( Data )
15 import System.Console.CmdArgs.Default ( Default(..) )
16 import Data.Typeable ( Typeable )
18 import Configurator ( convert_newtype_list )
21 -- | A (wrapper around a) list of hosts.
24 Hosts { get_hosts :: [String] }
25 deriving (Data, Eq, Monoid, Show, Typeable)
28 -- | The default list of hosts. It's empty.
30 instance Default Hosts where def = Hosts []
32 instance Configured Hosts where
33 -- | This allows us to read a Hosts object out of a Configurator
34 -- config file: by default Configurator wouldn't know what to do.
35 convert = convert_newtype_list Hosts