-- | A newtype around a list of Strings representing blacklists. -- This is all to avoid an orphan instance of 'Configured' for -- [String] if we had defined one in e.g. 'OptionalConfiguration'. -- {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} module Lists ( Lists(..) ) where import Data.Configurator () -- Needed for predefined instances. import Data.Configurator.Types ( Configured(..) ) import Data.Data ( Data ) import Data.Monoid ( Monoid ) import System.Console.CmdArgs.Default ( Default(..) ) import Data.Typeable ( Typeable ) import Configurator ( convert_newtype_list ) -- | A (wrapper around a) list of blacklists. -- newtype Lists = Lists { get_lists :: [String] } deriving (Data, Eq, Monoid, Show, Typeable) -- | The default list of white/blacklists. It's empty. -- instance Default Lists where def = Lists [] instance Configured Lists where -- | This allows us to read a 'Lists' object out of a Configurator -- config file: by default Configurator wouldn't know what to do. convert = convert_newtype_list Lists