aboutsummaryrefslogtreecommitdiff
path: root/Data/ConfigManager.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Data/ConfigManager.hs')
-rw-r--r--Data/ConfigManager.hs9
1 files changed, 8 insertions, 1 deletions
diff --git a/Data/ConfigManager.hs b/Data/ConfigManager.hs
index a13457c..02c3469 100644
--- a/Data/ConfigManager.hs
+++ b/Data/ConfigManager.hs
@@ -83,8 +83,11 @@ lookupDefault defaultValue name config = foldl (flip const) defaultValue $ looku
-- > a_double = 4.0
-- > thatIsABoolean = True
-- > a_double = 5.0
+-- > diffTime = 1 day
+-- > otherDiffTime = 3 hours
--
-- If two or more bindings have the same name, only the last one is kept.
+-- Accepted duration values are seconds, minutes, hours, days and weeks.
-- $import
--
@@ -107,15 +110,18 @@ lookupDefault defaultValue name config = foldl (flip const) defaultValue $ looku
-- > port = 3000
-- > mailFrom = "no-reply@mail.com"
-- > currency = "$"
+-- > expiration = 30 minutes
--
-- Read the configuration:
--
-- > import qualified Data.ConfigManager as Conf
+-- > import Data.Time.Clock (DiffTime)
-- >
-- > data Conf = Conf
-- > { port :: Int
-- > , mailFrom :: String
-- > , currency :: String
+-- > , expiration :: DiffTime
-- > } deriving (Read, Eq, Show)
-- >
-- > getConfig :: IO (Either Text Conf)
@@ -125,5 +131,6 @@ lookupDefault defaultValue name config = foldl (flip const) defaultValue $ looku
-- > Conf <$>
-- > Conf.lookup "port" conf <*>
-- > Conf.lookup "mailFrom" conf <*>
--- > Conf.lookup "currency" conf
+-- > Conf.lookup "currency" conf <*>
+-- > Conf.lookup "expiration" conf
-- > )