Revision 3f6af65c Ganeti/HTools/Utils.hs
b/Ganeti/HTools/Utils.hs | ||
---|---|---|
21 | 21 |
, getStringElement |
22 | 22 |
, getIntElement |
23 | 23 |
, getListElement |
24 |
, getObjectElement |
|
25 |
, asJSObject |
|
26 |
, asObjectList |
|
24 | 27 |
, concatEitherElems |
25 | 28 |
, applyEither1 |
26 | 29 |
, applyEither2 |
... | ... | |
166 | 169 |
-> Either String [JSValue] |
167 | 170 |
getListElement = fromObj |
168 | 171 |
|
172 |
getObjectElement :: String -> JSObject JSValue |
|
173 |
-> Either String (JSObject JSValue) |
|
174 |
getObjectElement = fromObj |
|
175 |
|
|
176 |
asJSObject :: JSValue -> Either String (JSObject JSValue) |
|
177 |
asJSObject (JSObject a) = Right a |
|
178 |
asJSObject _ = Left "not an object" |
|
179 |
|
|
180 |
asObjectList :: [JSValue] -> Either String [JSObject JSValue] |
|
181 |
asObjectList = |
|
182 |
ensureEitherList . map asJSObject |
|
183 |
|
|
169 | 184 |
concatEitherElems :: Either String String |
170 | 185 |
-> Either String String |
171 | 186 |
-> Either String String |
Also available in: Unified diff