companion_cube changed the topic of #ocaml to: Discussion about the OCaml programming language | http://www.ocaml.org | OCaml 5.2.0 released: https://ocaml.org/releases/5.2.0 | Try OCaml in your browser: https://try.ocamlpro.com | Public channel logs at https://libera.irclog.whitequark.org/ocaml/
gweithio has joined #ocaml
gweithio has quit [Ping timeout: 240 seconds]
gweithio has joined #ocaml
luc4 has quit [Quit: Konversation terminated!]
gweithio has quit [Ping timeout: 252 seconds]
luc4 has joined #ocaml
luc4 has quit [Quit: Konversation terminated!]
gweithio has joined #ocaml
luc4 has joined #ocaml
gweithio has quit [Ping timeout: 268 seconds]
gweithio has joined #ocaml
gweithio has quit [Ping timeout: 252 seconds]
xam_ has quit [Ping timeout: 240 seconds]
dev2 has joined #ocaml
gweithio has joined #ocaml
gweithio has quit [Ping timeout: 252 seconds]
luc4 has quit [Quit: Konversation terminated!]
gweithio has joined #ocaml
gweithio has quit [Ping timeout: 264 seconds]
waleee has quit [Ping timeout: 268 seconds]
gweithio has joined #ocaml
gweithio has quit [Ping timeout: 252 seconds]
jabuxas has quit [Ping timeout: 256 seconds]
gweithio has joined #ocaml
gweithio has quit [Ping timeout: 268 seconds]
pi3ce has quit [Ping timeout: 268 seconds]
pi3ce has joined #ocaml
gweithio has joined #ocaml
gweithio has quit [Ping timeout: 268 seconds]
troydm has joined #ocaml
troydm has quit [Client Quit]
troydm has joined #ocaml
gweithio has joined #ocaml
gweithio has quit [Ping timeout: 252 seconds]
troydm has quit [Ping timeout: 246 seconds]
gweithio has joined #ocaml
gweithio has quit [Ping timeout: 268 seconds]
gweithio has joined #ocaml
gweithio has quit [Ping timeout: 264 seconds]
toastal has joined #ocaml
sailorCat has quit [Ping timeout: 268 seconds]
sailorCat has joined #ocaml
gweithio has joined #ocaml
gweithio has quit [Ping timeout: 260 seconds]
bartholin has joined #ocaml
gweithio has joined #ocaml
gweithio has quit [Ping timeout: 256 seconds]
chiselfuse has quit [Remote host closed the connection]
chiselfuse has joined #ocaml
Serpent7776 has joined #ocaml
gweithio has joined #ocaml
gweithio has quit [Ping timeout: 252 seconds]
gweithio has joined #ocaml
gweithio has quit [Ping timeout: 260 seconds]
Serpent7776 has quit [Ping timeout: 252 seconds]
Tuplanolla has joined #ocaml
gweithio has joined #ocaml
gweithio has quit [Ping timeout: 264 seconds]
waleee has joined #ocaml
vsiles has quit [Remote host closed the connection]
luc4 has joined #ocaml
toastal has quit [Ping timeout: 252 seconds]
waleee has quit [Quit: WeeChat 4.1.2]
bartholin has quit [Remote host closed the connection]
gweithio has joined #ocaml
gweithio has quit [Ping timeout: 260 seconds]
bartholin has joined #ocaml
Serpent7776 has joined #ocaml
<luc4> Hello! I'm trying to efficiently print bytes using printf. I found online that this should work: `Printf.printf "%a" output_bytes bytes`. I tried it with: `Printf.sprintf "%c%a" (char_of_int opcode) output_bytes s`, but I'm getting a compiler error: "This expression has type out_channel -> bytes -> unit but an expression was expected of type unit -> 'a -> string". Can someone explain why?
<discocaml> <otini_> To use `%a` you need `asprintf` instead of `sprintf`
<discocaml> <otini_> ah, that being said, output_bytes is not a Printf or Format formatter, it takes a channel directly
<discocaml> <otini_> nvm, it actually should work
<luc4> So should I use Format instead of Printf?
<discocaml> <otini_> I’m not sure
<luc4> unsafe is probably safer in this case :-)
<discocaml> <otini_> yeah that’s probably the best thing to do
<discocaml> <otini_> we really need Printf and Format specifiers for bytes
<luc4> it would be very useful in my case
waleee has joined #ocaml
<discocaml> <otini_> well, it’s been discussed for a while… https://github.com/ocaml/ocaml/issues/6429
patrick has quit [Remote host closed the connection]
_alix has quit [Remote host closed the connection]
henrytill has quit [Read error: Connection reset by peer]
richardhuxton has quit [Remote host closed the connection]
arya_elfren has quit [Remote host closed the connection]
kuruczgy has quit [Write error: Connection reset by peer]
ursa-major has quit [Write error: Connection reset by peer]
whereiseveryone has quit [Read error: Connection reset by peer]
xvilka has quit [Remote host closed the connection]
pmk has quit [Read error: Connection reset by peer]
jmcantrell has quit [Write error: Connection reset by peer]
seeg has quit [Remote host closed the connection]
pluviaq has quit [Remote host closed the connection]
immutable has quit [Write error: Connection reset by peer]
rustyne has quit [Remote host closed the connection]
philipwhite_ has quit [Remote host closed the connection]
Ankhers has quit [Remote host closed the connection]
brettgilio has quit [Remote host closed the connection]
soni_ has quit [Remote host closed the connection]
ggb has quit [Remote host closed the connection]
ymherklotz has quit [Remote host closed the connection]
b0o has quit [Read error: Connection reset by peer]
lane has quit [Remote host closed the connection]
sleepydog has quit [Read error: Connection reset by peer]
philipwhite has joined #ocaml
lane has joined #ocaml
whereiseveryone has joined #ocaml
ggb has joined #ocaml
patrick has joined #ocaml
jmcantrell has joined #ocaml
pmk has joined #ocaml
pluviaq has joined #ocaml
immutable has joined #ocaml
henrytill has joined #ocaml
rustyne has joined #ocaml
richardhuxton has joined #ocaml
brettgilio has joined #ocaml
seeg has joined #ocaml
b0o has joined #ocaml
ursa-major has joined #ocaml
kuruczgy has joined #ocaml
sleepydog has joined #ocaml
arya_elfren has joined #ocaml
_alix has joined #ocaml
ymherklotz has joined #ocaml
xvilka has joined #ocaml
Ankhers has joined #ocaml
soni_ has joined #ocaml
<discocaml> <otini_> only, no one has put in the work. There is also a slight design disagreement, gasche thinks there h
<discocaml> <otini_> only, no one has put in the work. There is also a slight design disagreement, gasche thinks there should be only a specifier to print "escaped bytes", whereas you seem to need to print bytes directly.
jabuxas has joined #ocaml
<discocaml> <otini_> sorry I edited my message, I don’t know how that renders on IRC
waleee has quit [Quit: WeeChat 4.1.2]
torretto has quit [Remote host closed the connection]
gweithio has joined #ocaml
torretto has joined #ocaml
<discocaml> <otini_> @luc4 in the meantime you can just define:
<discocaml> <otini_> ```ocaml
<discocaml> <otini_> let fmt_str_byte () b = Bytes.unsafe_to_string b
<discocaml> <otini_> ```
<discocaml> <otini_> and use it: `Printf.sprintf "b = %a" fmt_str_bytes b`
<discocaml> <otini_> fmt_str_bytes being unsafe to use outside of this context
gweithio has quit [Ping timeout: 264 seconds]
torretto has quit [Remote host closed the connection]
deadmarshal_ has quit [Ping timeout: 256 seconds]
<luc4> otini_ good idea, thanks!
torretto has joined #ocaml
<luc4> Anyone who knows if it is normal that building ocaml 4.14 on arm64 fails with "configure: error: C99 float ops unavailable, enable replacements with --enable-imprecise-c99-float-ops"?
waleee has joined #ocaml
waleee has quit [Client Quit]
waleee has joined #ocaml
YuGiOhJCJ has joined #ocaml
waleee has quit [Ping timeout: 255 seconds]
tremon has joined #ocaml
YuGiOhJCJ has quit [Quit: YuGiOhJCJ]
waleee has joined #ocaml
<discocaml> <otini_> mmmh… from INSTALL.adoc
<discocaml> <otini_> ```
<discocaml> <otini_>
<discocaml> <otini_> * In the unlikely case that a platform does not offer all C99 float operations
<discocaml> <otini_> that the runtime needs, a configuration error will result. Users
<discocaml> <otini_> can work around this problem by calling `configure` with the flag
<discocaml> <otini_> `--enable-imprecise-c99-float-ops`. This will enable simple but potentially
<discocaml> <otini_> imprecise implementations of C99 float operations. Users with exacting
<discocaml> <otini_> requirements for mathematical accuracy, numerical precision, and proper
<discocaml> <otini_> handling of mathematical corner cases and error conditions may need to
<discocaml> <otini_> consider running their code on a platform with better C99 support.
<discocaml> <otini_> ```
<discocaml> <otini_> it seemed to be an issue rather on Windows though
waleee has quit [Ping timeout: 255 seconds]
<luc4> otini_ yes, I read about that. Apparently this happens when building for arm64 on docker.
<luc4> otini_ might be related to the emulator
reynir has joined #ocaml
reynir has quit [Quit: WeeChat 3.8]
luc4 has quit [Ping timeout: 272 seconds]
luc4 has joined #ocaml
jabuxas has quit [Remote host closed the connection]
jabuxas has joined #ocaml
xgqt has quit [Quit: WeeChat 4.1.2]
xgqt has joined #ocaml
<discocaml> <yawaramin> so some time ago someone suggested defining `let ( let@ ) = ( @@ )` and this turned out to be a quite general-purpose letop that can work with a variety of functions: https://github.com/yawaramin/letops/blob/6954adb65f1156597405149d5d0116599b1d2049/letops.mli#L18
<discocaml> <yawaramin> i think it could be the answer (having a single letop for nearly all use cases) to the perceived problem of having different symbolic letops for different functions
<discocaml> <otini_> yeah it’s the bind operator for a monad sometimes called the continuation monad
<discocaml> <otini_> but I fail to see how it replaces other let operators
<luc4> otini_ I confirm it properly builds on an arm64 physical machine. Is it possible to pass that switch to configure using opam?
<discocaml> <otini_> Yes, but you need a bit more commands
<discocaml> <otini_> ```
<discocaml> <otini_> # Get a copy of the right version of the code and cd into it
<discocaml> <otini_> opam switch create . --empty
<discocaml> <otini_> ./configure --prefix=$(opam var prefix) # put extra configuration args here
<discocaml> <otini_> make -j
<discocaml> <otini_> opam install . --assume-built
<discocaml> <otini_> ```
<discocaml> <yawaramin> it could replace or supplant some of them if used with functions of the right signature. eg ```ocaml
<discocaml> <yawaramin> let lwt_map p f = Lwt.map f p
<discocaml> <yawaramin> ...
<discocaml> <yawaramin> let@ x = lwt_map (Lwt.return 1) in
<discocaml> <yawaramin> x * 2
<discocaml> <yawaramin> ```
<discocaml> <yawaramin> this makes it obvious what operation is happening while at the same time turning a callback style call into a 'direct' style call
<bartholin> hmmm
<discocaml> <deepspacejohn> I’ve used `let@` a lot in some projects and it is indeed very nice. Mainly for continuation-heavy code but also as a general purpose letop
<companion_cube> @yawaramin glad you're liking let@ :p
<companion_cube> I think gleam has adopted syntactic sugar that's the equivalent of let@, too
<discocaml> <otini_> I’d still use Lwt.Syntax.(let+) :
<discocaml> <otini_> ```ocaml
<discocaml> <otini_> let open Lwt.Syntax in
<discocaml> <otini_> let+ x = Lwt.return 1 in
<discocaml> <otini_> x * 2
<discocaml> <otini_> ```
<companion_cube> Ideally we'd just leave lwt behind, but still
<discocaml> <otini_> works for any functor/applicative/monad
<discocaml> <yawaramin> sure, but my point is that having a single letop for the _majority_ of use cases addresses the concern of having several symbolic letops that people would have to learn
<discocaml> <otini_> `let@` is nice in that it hides the clunky continuation-passing, but the libraries' own operators have that added convenience of applying the map/return too
<discocaml> <yawaramin> which is what has blocked the letops PR from being merged into the stdlib
<bartholin> companion_cube: why let lwt behind?
<companion_cube> Because we have ocaml 5 :)
<companion_cube> We can now get more ergonomic, more efficient, and more parallel libraries
jabuxas has quit [Quit: oops :p]
<bartholin> :^)
<companion_cube> there are things I don't like in Eio but it's clearly a big step forward compared to lwt :)
<companion_cube> (lwt did what it could given the constraints of the time)
troydm has joined #ocaml
Anarchos has joined #ocaml
patrick is now known as Guest1550
Guest1550 has quit [Killed (zirconium.libera.chat (Nickname regained by services))]
patrick_ has joined #ocaml
gweithio has joined #ocaml
gweithio has quit [Client Quit]
<discocaml> <toppressure> hi guys, considering ocaml for a piece of a project I'm working on, but having trouble finding a library to build on top of
<discocaml> <toppressure> i need to build an API that has multiple instances running (for high availability) and can durably handle long-running background tasks off of a schedule
<discocaml> <toppressure> and its a little more complicated because the schedule itself can be managed via API so needs to be stored in db
jabuxas has joined #ocaml
<discocaml> <toppressure> this stuff is really annoying to build from scratch so I was hoping there is some kind of lib
<discocaml> <toppressure> any knowers?
<discocaml> <limp.biskit> companion_cube: miou (!)
<discocaml> <yawaramin> looks like Sihl can do it: https://github.com/oxidizing/sihl
<companion_cube> Or miou, indeed
<companion_cube> Or fuseau :p
<discocaml> <yawaramin> i don't think Miou has a full-fledged database-backed persistent job queue in the way that full-stack projects typically need. see eg Sidekiq, Celery, Oban. Sihl seems closer to that.
<discocaml> <toppressure> these are cool, thanks
<discocaml> <toppressure> had my eye on dream for the API itself but if sihl takes care of the tasks maybe I just go with that
<discocaml> <limp.biskit> the ecosystem even in eio is early
<discocaml> <yawaramin> yeah but i'm not comparing with Eio
<discocaml> <limp.biskit> design of the libraries is still much nicer if you do have to implement things yourself
<discocaml> <limp.biskit> yeah, i'm not disagreeing. lwt is still more useful for real-world use
<discocaml> <toppressure> whats eio vs lwt
<discocaml> <limp.biskit> lwt is the dominant concurrency library for ocaml 4
<discocaml> <limp.biskit> ocaml 5 introduces effects allowing for direct-style io schedulers, eio being the biggest atm
<discocaml> <yawaramin> Lwt vs Eio is not relevant in this discussion, we are talking about persistent background job scheduling. check out the tools i mentioned earlier
<companion_cube> I was replying to another discussion
<companion_cube> Not talking about persistent jobs :p
<companion_cube> Use nats.io I guess
<discocaml> <toppressure> i was going to say, sihl has persistence but looking through the code it doesn't seem to have any notion of clustering
<discocaml> <toppressure> so if I have three of the same API pointed to the same db
<discocaml> <toppressure> its gonna run everything three times lol
<discocaml> <toppressure> still a bunch of manual work to do there
jabuxas has quit [Ping timeout: 246 seconds]
Anarchos has quit [Quit: Vision[]: i've been blurred!]
<discocaml> <toppressure> writing a client lib on top of https://cadenceworkflow.io/ seems like the least painful option if I really really want to use ocaml
<discocaml> <yawaramin> if you're using Postgres then `skip locked`?
<discocaml> <toppressure> im not a postgres user, didn't know about that one
<discocaml> <toppressure> that works on reads?
<discocaml> <toppressure> hah yeah I just found that
waleee has joined #ocaml
torretto_ has joined #ocaml
torretto has quit [Ping timeout: 260 seconds]
bartholin has quit [Quit: Leaving]
jabuxas has joined #ocaml
deadmarshal_ has joined #ocaml
Serpent7776 has quit [Ping timeout: 272 seconds]
jabuxas has quit [Ping timeout: 240 seconds]
tremon has quit [Quit: getting boxed in]
Tuplanolla has quit [Quit: Leaving.]
YuGiOhJCJ has joined #ocaml