X-Git-Url: http://gitweb.michael.orlitzky.com/?p=dead%2Fhtsn.git;a=blobdiff_plain;f=src%2FTSN%2FFeedHosts.hs;h=58831e5cc2fd5d06b87c30792d55444af37d94ea;hp=0b2056ec3ee983587b2ed74133ebfebc15fa6bdd;hb=a2c2a1a6865be7b4cd17fb72de635bb9385728b9;hpb=95e23e65db31cf51c9f207a6b447da19920ee1a1 diff --git a/src/TSN/FeedHosts.hs b/src/TSN/FeedHosts.hs index 0b2056e..58831e5 100644 --- a/src/TSN/FeedHosts.hs +++ b/src/TSN/FeedHosts.hs @@ -34,11 +34,18 @@ instance Default FeedHosts where instance DCT.Configured FeedHosts where + -- | This allows us to read a FeedHosts 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 FeedHosts constructor to + -- it. convert (DCT.List xs) = + -- mapM gives us a Maybe [String] here. fmap FeedHosts (mapM convert_string xs) where convert_string :: DCT.Value -> Maybe String convert_string = DCT.convert + -- If we read anything other than a list of values out of the file, + -- fail. convert _ = Nothing -