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/dune | 3 ++- bin/leda.ml | 12 ++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'bin') diff --git a/bin/dune b/bin/dune index e161175..c24d8bf 100644 --- a/bin/dune +++ b/bin/dune @@ -1,4 +1,5 @@ (executable (public_name leda) (name leda) - (libraries base gemini)) + (libraries base gemini lwt lwt_ppx) + (preprocess (pps lwt_ppx))) 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