Revision 2f3d7a50
b/src/Ganeti/JSON.hs | ||
---|---|---|
138 | 138 |
|
139 | 139 |
-- | Reads the value of a key in a JSON object with a default if |
140 | 140 |
-- missing. Note that both missing keys and keys with value \'null\' |
141 |
-- will case the default value to be returned. |
|
141 |
-- will cause the default value to be returned.
|
|
142 | 142 |
fromObjWithDefault :: (J.JSON a, Monad m) => |
143 | 143 |
JSRecord -> String -> a -> m a |
144 | 144 |
fromObjWithDefault o k d = liftM (fromMaybe d) $ maybeFromObj o k |
Also available in: Unified diff