hannes changed the topic of #mirage to: https://mirage.io - bug cleaning day every first friday in month (14:00 UTC - late, next: Feb 1st) - next call Jan 9th 16:00 GMT https://github.com/mirage/mirage-www/wiki/Call-Agenda - this channel is logged at http://irclog.whitequark.org/mirage/ - MirageOS 3.3.1 is released - happy hacking!
iovec has joined #mirage
mort___ has joined #mirage
Haudegen has joined #mirage
kugg has left #mirage [#mirage]
mort___ has quit [Quit: Leaving.]
<ehirdoy> newbie question: can some "sleep ()" return "unit" instead of "unit Lwt.t"? For example, https://gist.github.com/ehirdoy/e1ed3893d37ed5a62b6b429bd1370df1
mort___ has joined #mirage
mort___ has quit [Client Quit]
mort___ has joined #mirage
mort___ has quit [Client Quit]
mort___ has joined #mirage
mort___ has quit [Client Quit]
<h01ger> opam 4.0.3-1 was uploaded to debian today
mort___ has joined #mirage
mort___ has quit [Client Quit]
<hannes> ehirdoy: I don't understand your goal, could you elaborate why you want "unit" instead of "unit Lwt.t"?
<hannes> h01ger: great, 4.08.0 beta incoming soon ;)
<h01ger> i ment opam 2.0.3 (not ocaml)
<h01ger> ocaml is at 4.0.5
<h01ger> debian runs on more than amd64 :)
mort___ has joined #mirage
mort___ has quit [Client Quit]
<ehirdoy> @hannes, the purpose is that, I got a function to implement, its type is, var mysleep () : unit -> unit, but OS.Time.sleep_ns reutrns unit Lwt.t. How can I implement mysleep ()?
<hannes> ehirdoy: I don't understand your goal. since MirageOS uses the asynchronous task library lwt, blocking operations are done inside Lwt.t.
mort___ has joined #mirage
<hannes> ehirdoy: in OCaml, there's Unix.sleep (blocking, not as part of lwt). Such a thing is not available in MirageOS.
<ehirdoy> @hannes, the original code uses Unix.sleep. but its preventing hvt.
<ehirdoy> I'm getting rid of some Unix dependencies for MirageOS'rization now.
<hannes> ehirdoy: in MirageOS, there's no other sleep.
<ehirdoy> Currently I'm working around with busyloop but.....
mort___ has quit [Client Quit]
<hannes> so, if you want to sleep you'll need to be in the Lwt.t monad.
<ehirdoy> how can this give up CPU for a few sec to let other tasks being done?
<hannes> hmm?
<hannes> OS.Time.sleep_ns : int64 -> unit Lwt.t does indeed yield until the amount of nanoseconds is slept. during this time, other Lwt tasks are executed
<ehirdoy> yes, but it returns unit Lwt.t instead of "unit"
<ehirdoy> well, I can say, I may want Lwt.val_of_lwt (Lwt.return 42) == 42
<hannes> yes, since lwt is used. I don't think I understand what you want to achieve..
<ehirdoy> am I wrong from the starting point??? I seem to want this kind of function, Lwt.val_of_lwt_t (), though....
<hannes> I'm not sure I understand
<Drup> ehirdoy: You are taking this from the wrong direction, yes
<Drup> Do you know what Lwt is for, and how to use it ?
<Drup> If not, I suggest you read Lwt's tutorial
<hannes> in "pure" OCaml, there's blocking semantics -- Unix.sleep waits for the delay. This is fine on e.g. Unix with multiple (posix)threads to build "concurrent" programs.
<ehirdoy> I have kind of understanding, but the issue is that, there's a function prototype which returns "unit"
<Drup> What's the context ?
<ehirdoy> If I use Lwt in a func, it cannot return "unit" anymore
<hannes> on MirageOS, we settled to use lwt (we don't have any posix threads around) to allow multiple tasks. We have a single core, which means if we block in one task, we'd like other tasks to be able to do some computations.
<Drup> You will not get a lwt-compatible sleeping function that returns unit. It's not happening and you are having a strong case of XY problem :)
Haudegen has quit [Remote host closed the connection]
<Drup> So, tell us the actual problem instead of your intended solution.
<hannes> ehirdoy: maybe https://mirage.io/wiki/tutorial-lwt helps. and yes, the "does not return unit" is intentional
<ehirdoy> https://github.com/ehirdoy/light_actor/blob/master/test/actor_param_test_0.ml#L40 to MirageOS'rize "push" function, which uses Unix.sleep right now.
<Drup> Go read the lwt tutorial, and learn about >>=
<hannes> ehirdoy: you'll need to adapt the signature and move this into the Lwt.t monad if you want to use it on MirageOS.
<Drup> You will have to change your function to `(key * value) array -> (key * value) array Lwt.t`, or get rid of the sleeping (which ... probably shouldn't be there)
<ehirdoy> @Drup, if so all can make sense, then
<ehirdoy> So you means, once you use Lwt, all IO is Lwt.t
<Drup> yes
<hannes> ehirdoy: yes
<ehirdoy> Good!! Then, I'll try to modify the protope to afford Lwt.t, then. Thank you for your patience ;)
mort___ has joined #mirage
Haudegen has joined #mirage
twopoint718 has joined #mirage
mort___ has quit [Quit: Leaving.]
mort___ has joined #mirage
twopoint718 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jnavila has joined #mirage
twopoint718 has joined #mirage
mort___ has quit [Quit: Leaving.]
twopoint718 has quit [Read error: Connection reset by peer]
mort___ has joined #mirage
Haudegen has quit [Remote host closed the connection]
mort___ has left #mirage [#mirage]
jnavila has quit [Ping timeout: 246 seconds]
Haudegen has joined #mirage
iovec has quit [Ping timeout: 252 seconds]
iovec has joined #mirage