aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoris2016-03-26 20:46:18 +0100
committerJoris2016-03-26 20:46:18 +0100
commit49639d9796c36b8601beff86c6aa1b1d232ac652 (patch)
tree04bf8e728d14ee759ad1274381073444747dc9f5
parent09befe1f8026a9b3c4c4295e533e481284000802 (diff)
downloadconfig-manager-49639d9796c36b8601beff86c6aa1b1d232ac652.tar.gz
config-manager-49639d9796c36b8601beff86c6aa1b1d232ac652.tar.bz2
config-manager-49639d9796c36b8601beff86c6aa1b1d232ac652.zip
Document durations
-rw-r--r--Data/ConfigManager.hs9
-rw-r--r--README.md2
2 files changed, 10 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
-- > )
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
----