talircd/lib/server/import.ml

36 lines
776 B
OCaml

include Irc
module Dllist = Lwt_dllist
type sockaddr = Unix.sockaddr
type fd = Lwt_unix.file_descr
let pp_sockaddr ppf = function
| Unix.ADDR_INET (adr, port) -> Fmt.pf ppf "%s:%d" (Unix.string_of_inet_addr adr) port
| Unix.ADDR_UNIX path -> Fmt.string ppf path
let defer f =
Lwt.on_success (Lwt.pause ()) f
module Result_syntax = struct
let ( let* ) = Result.bind
let ( let+ ) r f = Result.map f r
end
module List = struct
include List
let flat_map f xs =
let rec iter = function
| [] -> []
| x :: xs -> append_then_iter xs (f x)
[@@tail_mod_cons]
and append_then_iter xs = function
| [] -> iter xs
| y :: ys -> y :: append_then_iter xs ys
[@@tail_mod_cons]
in
iter xs
end
include (val Logging.logs "Irc")