Skip to content
Snippets Groups Projects
Verified Commit 6bce3670 authored by jan.hamal.dvorak's avatar jan.hamal.dvorak
Browse files

Add configGet for convenience


At the cost of safety. :'-(

Signed-off-by: default avatarJan Hamal Dvořák <mordae@anilinux.org>
parent 615cba85
No related branches found
No related tags found
No related merge requests found
...@@ -27,6 +27,7 @@ module Hikaru.Config ...@@ -27,6 +27,7 @@ module Hikaru.Config
, configDefault , configDefault
-- * Reading Config -- * Reading Config
, configGet
, configGetMaybe , configGetMaybe
, configGetDefault , configGetDefault
...@@ -107,6 +108,16 @@ where ...@@ -107,6 +108,16 @@ where
] ]
-- |
-- Obtain value of a configuration key or raise an error.
-- You really should not use this function, you know?
--
configGet :: (Param a) => Text -> Config -> a
configGet name cfg = case configGetMaybe name cfg of
Just value -> value
Nothing -> error (name <> " not set!")
-- | -- |
-- Try to obtain value of a configuration key. -- Try to obtain value of a configuration key.
-- --
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment