diff options
author | Ryan Kavanagh <rak@rak.ac> | 2020-06-01 10:44:17 -0400 |
---|---|---|
committer | Ryan Kavanagh <rak@rak.ac> | 2020-06-01 10:44:17 -0400 |
commit | 98c8032f47316d5f6808cd9901c4d42600ed676f (patch) | |
tree | 66234f4bf4d284be92a4e03dee9193817771cf5c /bin/leda.ml | |
parent | We can now make requests (diff) |
Revise with better understanding of lwt library
Diffstat (limited to '')
-rw-r--r-- | bin/leda.ml | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/bin/leda.ml b/bin/leda.ml index 40074ff..8b98762 100644 --- a/bin/leda.ml +++ b/bin/leda.ml @@ -5,7 +5,11 @@ let test_parse s = M.gemini_to_canon_str (M.str_to_gemini s) module T = Gemini.MimeType.MimeType module R = Gemini.Request.GeminiTransaction(T) -let main = - match R.request "gemini://gemini.circumlunar.space/\r\n" with - | Some (_, _, s) -> print_endline s - | _ -> print_endline "oops" +let () = + Lwt_main.run begin + let req = R.string_to_request "gemini://gemini.circumlunar.space/\r\n" in + let%lwt response = R.transaction req in + match response with + | Some (_, _, s) -> Lwt_io.printl s + | _ -> Lwt_io.printl "ooops" + end |