Hi there,
while trying to learn Ocaml I have come across a few things I couldn’t wrap my mind around so far.
In the source code of the library “Fmt”, I found these signatures in fmt.mli:
val prefix : unit t -> 'a t -> 'a t
val suffix : unit t -> 'a t -> 'a t
which are both marked deprecated in the more recent versions.
Apparently both functions have 2 arguments.
However in the fmt.ml file I found these declarations
let prefix pp_p pp_v ppf v = pp_p ppf (); pp_v ppf v
let suffix pp_s pp_v ppf v = pp_v ppf v; pp_s ppf ()
It seems to me that these are functions of 4 arguments,
not 2 like the signatures suggest.
What am I missing here?
Also, in one of my own programs I have this bit of code:
let pp_header =
Fmt.suffix Fmt.(const string " ") @@ Fmt.prefix now_fmt Logs_fmt.pp_header
This is giving me warnings/errors due to Fmt.suffix and prefix being deprecated
and telling me to use Fmt.(++) instead.
How would I rewrite the code using Fmt.(++) here?
Thanks for your replies!