I'm trying to get used to wreq
in Haskell with an exercice.
Basically, I'm calling a first API that returns me a list of ID, and then I would like to call the API that returns the object from the ID.
My code looks like this
getAllIds :: IO ()
getAllIds = do
r <-
asJSON =<< get "https://dummyUrl/objectA.json" :: IO A
let body = r ^. responseBody
print body
getOneItemFromId :: IO ()
getOneItemFromId = do
r <-
asJSON =<< get "https://dummyUrl/objectB/idOfObject.json" :: IO B
let body = r ^. responseBody
print body
How can I pass the result of getAllIds
into a call to getOneItemFromId recursively so that I can get a list of all the items based on the list of ID ?