From 98c8032f47316d5f6808cd9901c4d42600ed676f Mon Sep 17 00:00:00 2001 From: Ryan Kavanagh Date: Mon, 1 Jun 2020 10:44:17 -0400 Subject: Revise with better understanding of lwt library --- bin/leda.ml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'bin/leda.ml') 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 -- cgit v1.2.3