X-Git-Url: http://gitweb.michael.orlitzky.com/?p=dead%2Fhalcyon.git;a=blobdiff_plain;f=src%2FUsernames.hs;h=6aec228ed06397873a3dc496afcf221f5dc9a19c;hp=6f2fb2874108bd436a18ad0aedde8ad4db5112a3;hb=1b72ed45ef890ed1329a32457b4d7f3a7fb37788;hpb=dd4abc21674b98bc55a3775291a8667dffec2863 diff --git a/src/Usernames.hs b/src/Usernames.hs index 6f2fb28..6aec228 100644 --- a/src/Usernames.hs +++ b/src/Usernames.hs @@ -4,27 +4,37 @@ -- to watch. This is all to avoid an orphan instance of Configured -- for [String] if we had defined one in e.g. OptionalConfiguration. -- -module Usernames +module Usernames ( Usernames(..) ) where -- DC is needed only for the DCT.Configured instance of String. import qualified Data.Configurator as DC() import qualified Data.Configurator.Types as DCT -import Data.Data (Data) -import System.Console.CmdArgs.Default (Default(..)) -import Data.Typeable (Typeable) +import Data.Data ( Data ) +import System.Console.CmdArgs.Default ( Default(..) ) +import Data.Typeable ( Typeable ) +-- | Wrapper around a list of strings (usernames). +-- newtype Usernames = Usernames { get_usernames :: [String] } deriving (Data, Show, Typeable) instance Default Usernames where + -- | The default list of usernames is empty. + -- def = Usernames [] + instance DCT.Configured Usernames where + -- | This allows us to read a 'Usernames' object out of a + -- Configurator config file. By default Configurator wouldn't know + -- what to do, so we have to tell it that we expect a list, and if + -- that list has strings in it, we can apply the Usernames + -- constructor to it. convert (DCT.List xs) = fmap Usernames (mapM convert_string xs) where