diff options
author | Joris | 2016-03-26 20:29:15 +0100 |
---|---|---|
committer | Joris | 2016-03-26 20:29:36 +0100 |
commit | 2e411664ce8da96fd50340b1ecb9e6e2e16f6ca2 (patch) | |
tree | 4d9399723a470a2fcd24b1df05aeb481468492de /Data/ConfigManager.hs | |
parent | 88aef982ff7a1be7fba2abf7264773b511608404 (diff) |
Parse durations
Diffstat (limited to 'Data/ConfigManager.hs')
-rw-r--r-- | Data/ConfigManager.hs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Data/ConfigManager.hs b/Data/ConfigManager.hs index 37da8b6..a13457c 100644 --- a/Data/ConfigManager.hs +++ b/Data/ConfigManager.hs @@ -34,7 +34,6 @@ module Data.ConfigManager ) where import Prelude hiding (lookup) -import Text.Read (readMaybe) import Data.Text (Text) import qualified Data.Text as T @@ -42,6 +41,7 @@ import qualified Data.HashMap.Strict as M import qualified Data.ConfigManager.Reader as R import Data.ConfigManager.Types +import Data.ConfigManager.Instances () -- | Load a 'Config' from a given 'FilePath'. @@ -50,13 +50,13 @@ readConfig = R.readConfig Required -- | Lookup for the value associated to a name. -lookup :: Read a => Name -> Config -> Either Text a +lookup :: Configured a => Name -> Config -> Either Text a lookup name config = case M.lookup name (hashMap config) of Nothing -> Left . T.concat $ ["Value not found for Key ", name] Just value -> - case readMaybe . T.unpack $ value of + case convert value of Nothing -> Left . T.concat $ ["Reading error for key ", name] Just result -> Right result |