1 {-# LANGUAGE DeriveDataTypeable #-}
3 -- | A newtype around a list of Strings which represent the feed
4 -- hosts. This is all to avoid an orphan instance of Configured for
5 -- [String] if we had defined one in e.g. OptionalConfiguration.
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 FeedHosts { get_feed_hosts :: [String] }
20 deriving (Data, Show, Typeable)
23 instance Default FeedHosts where
24 def = FeedHosts ["feed1.sportsnetwork.com",
25 "feed2.sportsnetwork.com",
26 "feed3.sportsnetwork.com"]
29 instance DCT.Configured FeedHosts where
30 convert (DCT.List xs) =
31 fmap FeedHosts (mapM convert_string xs)
33 convert_string :: DCT.Value -> Maybe String
34 convert_string = DCT.convert