Closed dx3mod closed 2 months ago
Tnaks a lot, but question ,can i use labeled args with optional together? Ocaml does not allow me to do that @dx3mod
So i found the answer, unit type at the end is the necessary thing and now i have these things
Yes, otherwise OCaml won't know where to stop.
@romanchechyotkin, you may make a payload argument for sub/pub functions positional, which makes partial application more comfortable.
let notify = Client.pub ~client ~subject:"NOTIFY"
(* val notify : payload -> unit Lwt.t *)
value
|> do_something_a
|> do_something_b
|> notify
Some suggestions for improving library's API.
Labeled functions
You can also set defaults for them
or use modules
with_connect
Automatically close a resource
first-class modules or objects for connection
signature for abstraction
Module signatures hide internal implementation.
unsafe
In some cases you can use unsafe functions (read this)
print_endline
:cactus:
monadic syntax
Prefer monadic syntax
let*
,let+
, orppx_lwt
.