Leonidas changed the topic of #ocaml to: Discussion about the OCaml programming language | http://www.ocaml.org | OCaml 5.1.1 released: https://ocaml.org/releases/5.1.1 | Try OCaml in your browser: https://try.ocamlpro.com | Public channel logs at https://libera.irclog.whitequark.org/ocaml/
<companion_cube> A hashtable is useful if you need random access
<companion_cube> If you don't need that, don't use a hashtable
pi3ce has quit [Quit: No Ping reply in 180 seconds.]
pi3ce has joined #ocaml
waleee has quit [Ping timeout: 260 seconds]
Tuplanolla has quit [Quit: Leaving.]
<discocaml> <._null._> Anarchos: opam pin edit <package>
<discocaml> <limp.biskit> landed up having to convert to lists anyway
<discocaml> <limp.biskit> i’m just using hashtbls in bits where performance is irrelevant but i don’t want duplication
masterbuilder has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
terrorjack has quit [Quit: The Lounge - https://thelounge.chat]
terrorjack has joined #ocaml
pi3ce has quit [Quit: No Ping reply in 180 seconds.]
pi3ce has joined #ocaml
<discocaml> <lroche> I was playing with dream for a personal project. Isn't the routing really subpar? It feels like I can't convert a route to a string to put it in the html, but also like all routes are completely untyped unlike what a package like `routes` can offer
n8n has quit [Quit: WeeChat 4.2.1]
jabuxas has quit [Ping timeout: 260 seconds]
gentauro has quit [Read error: Connection reset by peer]
gentauro has joined #ocaml
bibi_ has quit [Quit: Konversation terminated!]
mbuf has joined #ocaml
pi3ce has quit [Quit: No Ping reply in 180 seconds.]
pi3ce has joined #ocaml
bartholin has joined #ocaml
dnh has joined #ocaml
Serpent7776 has joined #ocaml
Tuplanolla has joined #ocaml
pi3ce has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
pi3ce has joined #ocaml
olle_ has joined #ocaml
torretto has quit [Remote host closed the connection]
torretto has joined #ocaml
waleee has joined #ocaml
jabuxas has joined #ocaml
torretto has quit [Remote host closed the connection]
torretto has joined #ocaml
myrkraverk_ is now known as myrkraverk
sailorCat has joined #ocaml
ania123 has joined #ocaml
ania123 has quit [Client Quit]
jabuxas has quit [Ping timeout: 256 seconds]
bibi_ has joined #ocaml
Anarchos has joined #ocaml
ania123 has joined #ocaml
<ania123> is there chanell to speak about MaMa?
<ania123> ?
dnh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ania123 has quit [Quit: Client closed]
dnh has joined #ocaml
mbuf has quit [Quit: Leaving]
Anarchos has quit [Quit: Vision[]: i've been blurred!]
<discocaml> <yawaramin> i think the lack of strongly typed routing is intentional. since Dream is flexible enough that you can drop in some other routing library on top of it
<companion_cube> I think `routes` is a strongly typed one?
<discocaml> <regularspatula> You can swap out dream’s router?
<discocaml> <tatchi_> Here's an example of using `routes` with `dream`: https://github.com/ulrikstrid/dream-routes/blob/main/src/bin/main.ml
<discocaml> <regularspatula> Huh interesting
<discocaml> <yawaramin> however i still think Dream's router has an edge in organizing routes using scopes and middleware, of course nothing that can't be replicated, it's just that i haven't seen it done in other OCaml libraries
<discocaml> <regularspatula> I’ve built just a few toy things with dream nothing serious yet
<discocaml> <regularspatula> Mainly I use cohttp or anuragaoni’s lib
Anarchos has joined #ocaml
<discocaml> <limp.biskit> what's great about it?
<discocaml> <limp.biskit> eio's cancellation is so confusing. i don't think its very common in green threads libraries, but i would've preferred full fat signal passing so you can SIGINT stuff like a systhread
<companion_cube> Sadly even the thread api doesn't expose that
olle_ has quit [Ping timeout: 255 seconds]
<discocaml> <murthan34> hey y'all
<discocaml> <murthan34> So I have a problem using the Graphics module
<discocaml> <murthan34> It says this: File "bin/main.ml", line 60, characters 5-13:
<discocaml> <murthan34> 60 | open Graphics
<discocaml> <murthan34> ^^^^^^^^
<discocaml> <murthan34> Error: Unbound module Graphics
<discocaml> <murthan34> does anyone know why I get this error?
<discocaml> <._null._> Did you link against the package (using eg dune)
<discocaml> <._null._> Did you link against the package (using eg dune) ?
<discocaml> <murthan34> idk
<discocaml> <murthan34> I use this to run the main.ml opam exec -- dune exec tutorial
<discocaml> <murthan34> it says Graphics module is a part of the standard library and should be installed by default
<discocaml> <Kali> graphics has not been included since 4.08
<Anarchos> murthan34 which tutorial do you use ?
<discocaml> <Kali> run `opam install graphics` then add graphics to `(depends ...)` and `(libraries ...)`
<discocaml> <Kali> depends is in dune-project and libraries is in the respective dune file
<discocaml> <murthan34> ok I have already install graphics
<discocaml> <murthan34> how do I add graphics to depends and libraries?
<discocaml> <Kali> edit ./dune-project and ./bin/dune respectively
<discocaml> <murthan34> it worked!
<discocaml> <murthan34> thanks @ilo_kali
<discocaml> <limp.biskit> in general Eio's fibers are a bit limiting. i find myself sometimes using promises and switches in a way that feels hacky to add to them
<discocaml> <limp.biskit> all my complaints though are around concurrent errors and cancellation (which is bad everywhere) and design choices that ultimately make the fibers as lightweight as they are
Serpent7776 has quit [Ping timeout: 256 seconds]
<discocaml> <murthan34> @ilo_kali hey I have another question about Graphics module
<discocaml> <murthan34> Is there a way to change the windows icon?
<discocaml> <murthan34> The lil image in the left of the window title
<companion_cube> @limp.biskit what's limiting?
<discocaml> <Kali> it does not seem so to me (but i have never used it, i just searched for "icon" in the documentation)
<discocaml> <limp.biskit> i guess for what they are fibers are fine
<discocaml> <limp.biskit> but to effectively handle cancellation and errors i usually find myself creating a switch just for one use
<discocaml> <murthan34> yeah I did the same thing and found nothing
<discocaml> <murthan34> I think you cant do that for some reason
<discocaml> <Kali> graphics is supposed to be cross platform, and not all platforms even have window icons
<discocaml> <murthan34> oh yeah mac doesnt have them
<discocaml> <murthan34> but if I remember correctly you can give an icon to an executable file
<discocaml> <murthan34> so if I convert this main.ml to main.exe and mix it with an icon it should display that icon
<discocaml> <murthan34> I once saw in a video
jabuxas has joined #ocaml
<discocaml> <limp.biskit> i think it's all more documentation than anything
<discocaml> <murthan34> well it seems like you can change it with a program called "resource hacker"
<discocaml> <murthan34> but for some reason you cant download it
<discocaml> <murthan34> it says "This site can’t be reached"
<discocaml> <murthan34> but only for the dowloand section
<discocaml> <murthan34> the only way is creating a shortcut for the executable and changing its icon, because you cant directly change an executables icon
Anarchos has quit [Quit: Vision[]: i've been blurred!]
Anarchos has joined #ocaml
bartholin has quit [Quit: Leaving]
<companion_cube> Hopefully picos makes things simpler, Jesus
<companion_cube> Not that it's guaranteed that eio will adopt but we can hope
<discocaml> <limp.biskit> i dont see any reason for eio not to adopt picos, which doesnt mean they'll actually do it haha
dnh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<discocaml> <limp.biskit> i wonder how much of a cost eio switches actually come at vs fibers
<discocaml> <limp.biskit> i land up using a lot because they're the easiest way to group, cancel and wait for child fibers
<discocaml> <yawaramin> what would be a good way to do fiber cancellation (hypothetically speaking)?
<discocaml> <limp.biskit> in some places, for concurrent code with error handling, i've used the pattern of creating a promise, forking, creating a switch wrapped in a try block
<discocaml> <limp.biskit> currently, you have to throw an exception (or call Switch.fail) inside of a switch to cancel the fibers running inside it
<discocaml> <limp.biskit> for my usecases it would be more useful if Switch.run returned a promise for the result and a callback to cancel it
<discocaml> <limp.biskit> so closer to sending a sigint to a process than throwing and catching an exception
<discocaml> <limp.biskit> i don't think you're supposed to cancel switches at all; throwing a dummy exception can't be intended usage
<discocaml> <limp.biskit> but its really really useful sometimes to have a universal mechanism to cancel operations
<discocaml> <yawaramin> this sounds closer to what leostera is building what the Riot actor system, you can send kill messages to any actor (process)
<companion_cube> In moonpool I have no switches, each fiber is a switch of its own
<companion_cube> In any case cancelation is the hardest problem in concurrency :/
<discocaml> <limp.biskit> yeah, i'm throwing eio a hard problem here
<discocaml> <limp.biskit> i don't feel though the documentation makes it clear enough that most functionality you'd associate with a thread is actually in switches, not fibers which just schedule a function and little more
<discocaml> <limp.biskit> riot looks very cool - the main thing keeping me on Eio is httpaf
<discocaml> <limp.biskit> would love to see an example of killing a riot actor if there is one
<discocaml> <yawaramin> not an example but this seems pretty clear https://ocaml.org/p/riot/0.0.7/doc/Riot/index.html#val-exit
<discocaml> <limp.biskit> that looks very very cool
<discocaml> <limp.biskit> i like the pid and message abstraction and i can already see ways i could port code from switches and promises
<discocaml> <limp.biskit> maybe ill have a tinker sometime on something where i don't need a http library
<discocaml> <yawaramin> hypothetically there's nothing about httpaf that forces it to be tied to eio
<discocaml> <limp.biskit> the eio version is using gluten which afaik is a pretty high level abstraction designed to be easily ported
<discocaml> <limp.biskit> i don't have the knowledge at all to port it but it's already on three schedulers so one more can't hurt
<discocaml> <yawaramin> i _think_ the Riot equivalent is supposed to be https://github.com/riot-ml/gluon (not implemented yet)
<discocaml> <limp.biskit> gluten's eio version is 250 lines with comments
<discocaml> <limp.biskit> i have no idea how much effort it would take to bind httpaf or cohttp though
<discocaml> <limp.biskit> i just want more standardisation in general, gluten and piaf are promising starts
<companion_cube> I'm not super fond of how riot has tons of deps but all of them are brand new :s
<discocaml> <limp.biskit> is riot going to support picos?