Skip to content

Instantly share code, notes, and snippets.

@CGenie
Created February 2, 2019 08:51
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 CGenie/ac54f76b0c90e0b70206fd5162dc9413 to your computer and use it in GitHub Desktop.
Save CGenie/ac54f76b0c90e0b70206fd5162dc9413 to your computer and use it in GitHub Desktop.
File "src/x.ml", line 43, characters 36-39:
Error: This expression has type int32 list -> key
but an expression was expected of type int32
Lwt_main.run begin
Imap.connect ~host:host ~port:port ~username:username ~password:password >>= fun imap ->
Imap.examine imap mbox >>= fun () ->
Imap.uid_search imap Imap.all >>= fun (uids, _) ->
Lwt_list.iter_s (fun (uid: Imap.uid) ->
(* APPARENTLY THE COMPILER DOESN'T LIKE THE FOLLOWING LINE, THE [uid] part *)
let msg = Imap.(uid_fetch imap [uid] [Request.body_section ~peek:true ()]) in
Lwt_stream.to_list msg >>= function
| [_, {Imap.Response.body_section = [([], none), some s]; _}] ->
Lwt_io.printlf "uid: %ld" uid
Lwt_io.printlf "body section incorrect for uid: %ld" uid
| _ ->
Lwt_io.printlf "error fetching message %ld\n" uid
) uids
>>= fun () -> Imap.disconnect imap
end
Lwt_main.run begin
Imap.connect ~host:host ~port:port ~username:username ~password:password >>= fun imap ->
Imap.examine imap mbox >>= fun () ->
Imap.uid_search imap Imap.all >>= fun (uids, _) ->
Lwt_list.iter_s (fun (uid : Imap.uid) -> Lwt_io.printf "uid: %ld\n" uid) uids
>>= fun () -> Imap.disconnect imap
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment