1 {-# LANGUAGE DeriveDataTypeable #-}
3 -- | A newtype around a list of Strings which represent the usernames
4 -- to watch. This is all to avoid an orphan instance of Configured
5 -- for [String] if we had defined one in e.g. OptionalConfiguration.
7 module Usernames ( Usernames(..) )
10 -- DC is needed only for the DCT.Configured instance of String.
11 import qualified Data.Configurator as DC()
12 import qualified Data.Configurator.Types as DCT
13 import Data.Data ( Data )
14 import System.Console.CmdArgs.Default ( Default(..) )
15 import Data.Typeable ( Typeable )
19 Usernames { get_usernames :: [String] }
20 deriving (Data, Show, Typeable)
23 instance Default Usernames where
27 instance DCT.Configured Usernames where
28 convert (DCT.List xs) =
29 fmap Usernames (mapM convert_string xs)
31 convert_string :: DCT.Value -> Maybe String
32 convert_string = DCT.convert