-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Description
Currently,
lookupDefault def cfg name = fromMaybe def <$> lookup cfg nameI'd have expected
lookupDefault def cfg name = maybe (return def) return =<< lookup cfg namelookup is also a bit weird:
lookup :: Configured a => Config -> Name -> IO (Maybe a)
lookup (Config root BaseConfig{..}) name =
(join . fmap convert . H.lookup (root `T.append` name)) <$> readIORef cfgMapThere's no obvious reason to delay the lookup to the use site (which keeps the entire HashMap live). Why not use something like this?
lookup (Config root BaseConfig{..}) name = do
mp <- readIORef cfgMap
let result = convert =<< H.lookup (root `T.append` name) mp
evaluate result
return resultMetadata
Metadata
Assignees
Labels
No labels