talircd/lib/server/import.ml

44 lines
938 B
OCaml
Raw Normal View History

2024-01-23 19:23:45 +00:00
include Irc
2024-01-10 02:20:16 +00:00
module Dllist = Lwt_dllist
2024-01-07 20:54:39 +00:00
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
2024-01-08 05:55:53 +00:00
2024-01-10 02:20:16 +00:00
let defer f =
Lwt.on_success (Lwt.pause ()) f
2024-01-11 04:38:25 +00:00
module Result_syntax = struct
let ( let* ) = Result.bind
let ( let+ ) r f = Result.map f r
end
2024-01-12 02:49:48 +00:00
2024-01-30 23:54:41 +00:00
module List = struct
include List
let flat_map f xs =
2024-01-31 00:05:35 +00:00
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]
2024-01-30 23:54:41 +00:00
in
2024-01-31 00:05:35 +00:00
iter xs
2024-01-31 16:27:27 +00:00
let iter_up_to f xs ~limit =
let rec iter n = function
| x :: xs when n > 0 ->
f x; iter (n - 1) xs
| _ -> ()
in
iter limit xs
2024-01-30 23:54:41 +00:00
end
2024-01-12 02:49:48 +00:00
include (val Logging.logs "Irc")