From 49639d9796c36b8601beff86c6aa1b1d232ac652 Mon Sep 17 00:00:00 2001 From: Joris Date: Sat, 26 Mar 2016 20:46:18 +0100 Subject: Document durations --- Data/ConfigManager.hs | 9 ++++++++- README.md | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) 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 -- > ) diff --git a/README.md b/README.md index 6212027..079c3a3 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,8 @@ Config Manager A configuration management library. +[http://hackage.haskell.org/packages/archive/config-manager/latest/doc/html/Data-ConfigManager.html](http://hackage.haskell.org/packages/archive/config-manager/latest/doc/html/Data-ConfigManager.html) + TODO ---- -- cgit v1.2.3