Skip to content
Snippets Groups Projects
Commit 1297ce13 authored by Iustin Pop's avatar Iustin Pop
Browse files

Small syntax improvement

D'oh, one can extract from a wrapped variable, not only from functions.
parent fd22ce8e
No related branches found
Tags htools-v0.0.6
No related merge requests found
...@@ -39,19 +39,19 @@ getInstances :: String -> IO (Result String) ...@@ -39,19 +39,19 @@ getInstances :: String -> IO (Result String)
getInstances master = do getInstances master = do
let url2 = printf "%s/2/instances?bulk=1" (formatHost master) let url2 = printf "%s/2/instances?bulk=1" (formatHost master)
body <- getUrl url2 body <- getUrl url2
return $ (body >>= \x -> do return $ (do x <- body
arr <- loadJSArray x arr <- loadJSArray x
ilist <- mapM parseInstance arr ilist <- mapM parseInstance arr
return $ unlines ilist) return $ unlines ilist)
getNodes :: String -> IO (Result String) getNodes :: String -> IO (Result String)
getNodes master = do getNodes master = do
let url2 = printf "%s/2/nodes?bulk=1" (formatHost master) let url2 = printf "%s/2/nodes?bulk=1" (formatHost master)
body <- getUrl url2 body <- getUrl url2
return $ (body >>= \x -> do return $ (do x <- body
arr <- loadJSArray x arr <- loadJSArray x
nlist <- mapM parseNode arr nlist <- mapM parseNode arr
return $ unlines nlist) return $ unlines nlist)
parseInstance :: JSObject JSValue -> Result String parseInstance :: JSObject JSValue -> Result String
parseInstance a = parseInstance a =
......
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