Skip to content

Instantly share code, notes, and snippets.

@robotlolita
Forked from joepie91/map.js
Last active August 28, 2015 20:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robotlolita/ab461ac7268d8b825a66 to your computer and use it in GitHub Desktop.
Save robotlolita/ab461ac7268d8b825a66 to your computer and use it in GitHub Desktop.
Bluebird map + bhttp
(* Assume bhttp-get is available here somehow *)
let HTTP = {
def get: url
(* This would actually need to be imported properly. Yeah, FFI sucks, but oh well... *)
Task from-promise: (FFI invoke: bhttp-get in-context: unit with-arguments: [FFI export: url])
}
do {
response <- HTTP get: "http://somesite.com/all-the-urls.txt";
url <- response at: "body" >> as-string >> split: "\n";
HTTP get: url
} recover: { error |
Console log!: error
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment