adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | Current MOOC: https://huit.re/ocamlmooc | OCaml 4.04.0 release notes: http://ocaml.org/releases/4.04.html | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
chindy has quit [Remote host closed the connection]
AlfredENeuman has joined #ocaml
chindy has joined #ocaml
chindy has quit [Remote host closed the connection]
chindy has joined #ocaml
morfeen has quit [Remote host closed the connection]
ryanartecona has quit [Quit: ryanartecona]
noddy has quit [Ping timeout: 256 seconds]
nilof_ has quit [Quit: Going offline, see ya! (www.adiirc.com)]
al-damiri has quit [Quit: Connection closed for inactivity]
eimpec has quit [Quit: WeeChat 1.4]
noddy has joined #ocaml
Siegfried has joined #ocaml
sh0t has quit [Remote host closed the connection]
octachron has quit [Quit: Leaving]
yomimono has quit [Ping timeout: 252 seconds]
Siegfried has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Siegfried has joined #ocaml
jbrown has quit [Ping timeout: 255 seconds]
fraggle_ has quit [Ping timeout: 255 seconds]
silver has quit [Read error: Connection reset by peer]
nomicflux has joined #ocaml
jbrown has joined #ocaml
fraggle_ has joined #ocaml
infinity0 has quit [Ping timeout: 240 seconds]
infinity0 has joined #ocaml
infinity0 has joined #ocaml
mfp has quit [Ping timeout: 252 seconds]
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
FreeBirdLjj has joined #ocaml
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
infinity0 has quit [Remote host closed the connection]
FreeBirdLjj has quit [Ping timeout: 245 seconds]
infinity0 has joined #ocaml
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
infinity0 has quit [Remote host closed the connection]
Siegfried has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Siegfried has joined #ocaml
FreeBirdLjj has joined #ocaml
peddie has quit [Disconnected by services]
peddie_ has joined #ocaml
bungoman has quit [Ping timeout: 255 seconds]
Soni has quit [Ping timeout: 264 seconds]
Soni has joined #ocaml
jbrown has quit [Ping timeout: 255 seconds]
mengu has quit [Read error: Connection reset by peer]
johnelse_ has joined #ocaml
pwzoii has quit [Ping timeout: 252 seconds]
_zim_ has quit [Ping timeout: 252 seconds]
tizoc has quit [Ping timeout: 252 seconds]
_zim_ has joined #ocaml
tizoc has joined #ocaml
johnelse has quit [Ping timeout: 252 seconds]
jerith has quit [Ping timeout: 252 seconds]
jbrown has joined #ocaml
pwzoii has joined #ocaml
jerith has joined #ocaml
mengu has joined #ocaml
ygrek has quit [Ping timeout: 255 seconds]
copy` has quit [Quit: Connection closed for inactivity]
govg has quit [Ping timeout: 260 seconds]
shinnya has joined #ocaml
lopex has quit [Quit: Connection closed for inactivity]
FreeBirdLjj has quit [Remote host closed the connection]
jbrown has quit [Ping timeout: 255 seconds]
jao has quit [Ping timeout: 240 seconds]
govg has joined #ocaml
jbrown has joined #ocaml
noddy has quit [Ping timeout: 240 seconds]
nomicflux has quit [Quit: nomicflux]
larhat has joined #ocaml
FreeBirdLjj has joined #ocaml
larhat has quit [Quit: Leaving.]
larhat has joined #ocaml
larhat has quit [Client Quit]
noddy has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
MercurialAlchemi has joined #ocaml
wolfcore has quit [Ping timeout: 276 seconds]
wolfcore has joined #ocaml
Siegfried has left #ocaml ["Textual IRC Client: www.textualapp.com"]
jbrown has quit [Ping timeout: 255 seconds]
mengu has quit [Remote host closed the connection]
avsej has quit [Ping timeout: 240 seconds]
avsej has joined #ocaml
avsej has joined #ocaml
avsej has quit [Changing host]
infinity0 has joined #ocaml
jbrown has joined #ocaml
Guest82 has joined #ocaml
philtor has quit [Ping timeout: 276 seconds]
Guest82 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
avsej has quit [Ping timeout: 240 seconds]
lucybun has quit [Ping timeout: 256 seconds]
avsej has joined #ocaml
avsej has joined #ocaml
avsej has quit [Changing host]
lucybun has joined #ocaml
ryanartecona has joined #ocaml
vinoski_ has joined #ocaml
vinoski has quit [Ping timeout: 240 seconds]
freechips has quit [Ping timeout: 240 seconds]
averell has quit [Ping timeout: 240 seconds]
vinoski_ is now known as vinoski
freechips has joined #ocaml
john51 has quit [Read error: Connection reset by peer]
john51 has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
moei has quit [Ping timeout: 240 seconds]
moei has joined #ocaml
ygrek has joined #ocaml
FreeBirdLjj has joined #ocaml
Mercuria1Alchemi has joined #ocaml
noddy has quit [Ping timeout: 258 seconds]
lucybun has quit [Ping timeout: 240 seconds]
lucybun has joined #ocaml
vramana1 has joined #ocaml
vramana has quit [Ping timeout: 245 seconds]
vramana1 is now known as vramana
\h is now known as dhcmrlchtdj
peddie_ is now known as peddie
dhcmrlchtdj is now known as \h
jbrown has quit [Ping timeout: 255 seconds]
morfeen has joined #ocaml
jbrown has joined #ocaml
ocalm has quit [Quit: Leaving]
alfredo has joined #ocaml
shinnya has quit [Ping timeout: 264 seconds]
alfredo has quit [Ping timeout: 240 seconds]
freehck has joined #ocaml
ryanartecona has quit [Quit: ryanartecona]
morfeen has quit [Ping timeout: 240 seconds]
Simn has joined #ocaml
manizzle has joined #ocaml
calculemus has quit [Ping timeout: 260 seconds]
morfeen has joined #ocaml
jnavila has joined #ocaml
zpe has joined #ocaml
kakadu has joined #ocaml
silver has joined #ocaml
AltGr has joined #ocaml
morfeen has quit [Ping timeout: 255 seconds]
larhat has joined #ocaml
calculemus has joined #ocaml
morfeen has joined #ocaml
jbrown has quit [Ping timeout: 255 seconds]
ygrek has quit [Ping timeout: 252 seconds]
jbrown has joined #ocaml
soupault has joined #ocaml
pigeonv has joined #ocaml
pigeonv has quit [Ping timeout: 255 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
ygrek has joined #ocaml
ocalm has joined #ocaml
morfeen has quit []
larhat has quit [Quit: Leaving.]
chattered has quit [Remote host closed the connection]
xvw_ has joined #ocaml
peddie has quit [Disconnected by services]
peddie_ has joined #ocaml
jnavila has quit [Quit: It was time]
mengu has joined #ocaml
AlfredENeuman has quit [Ping timeout: 276 seconds]
AlfredENeuman has joined #ocaml
mfp has joined #ocaml
larhat has joined #ocaml
jbrown has quit [Ping timeout: 255 seconds]
jbrown has joined #ocaml
<def`> kakadu: is putting 'FLG -ppx bla' in .merlin enough to solve your problem?
snowcrshd has joined #ocaml
jnavila has joined #ocaml
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
mengu has quit [Remote host closed the connection]
_andre has joined #ocaml
larhat has quit [Quit: Leaving.]
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
xvw_ has quit [Quit: xvw_]
<kakadu> def`: Thanks
larhat has joined #ocaml
larhat has quit [Client Quit]
<def`> I get that it works :)
FreeBirdLjj has quit [Remote host closed the connection]
orbifx-m has joined #ocaml
sz0 has joined #ocaml
<orbifx-m> can BatStrings be mixed with Std.Strings?
FreeBirdLjj has joined #ocaml
<companion_cube> look if there's a type alias…
<companion_cube> Std.String is core, isn't it?
mengu has joined #ocaml
jbrown has quit [Ping timeout: 255 seconds]
mengu has quit [Ping timeout: 256 seconds]
jbrown has joined #ocaml
eimpec has joined #ocaml
johnelse_ is now known as johnelse
nilof_ has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
larhat has joined #ocaml
fre has quit [Ping timeout: 276 seconds]
mengu has joined #ocaml
fre has joined #ocaml
al-damiri has joined #ocaml
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
nomicflux has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 240 seconds]
govg has quit [Ping timeout: 245 seconds]
soupault has quit [Remote host closed the connection]
jao has joined #ocaml
lopex has joined #ocaml
frefity has quit [Quit: Ex-Chat]
frefity has joined #ocaml
mengu has quit [Remote host closed the connection]
nomicflux has quit [Quit: nomicflux]
fre has quit [Read error: Connection reset by peer]
mengu has joined #ocaml
fre has joined #ocaml
mengu has quit [Client Quit]
seangrove has joined #ocaml
<seangrove> Hey everyone, OCaml newb here, trying to figure out why this isn't allowed (section 7.3 of the manual isn't terribly helpful for a layman like myself): https://github.com/andreas/ocaml-graphql-server/issues/27
<seangrove> Specifically, "Error: This kind of expression is not allowed as right-hand side of 'let rec'"
ansiwen_ is now known as ansiwen
octachron has joined #ocaml
pigeonv has joined #ocaml
<flux> seangrove, your data isn't recursive, so why do you need a recursive value?
<flux> seangrove, but I think the key is that this needs to be prevented statically: let rec x = foo x - the value of x cannot be determined
<flux> the way around it: make user a function, ie. let rec user () = ..
<flux> this may or may not be what you want :)
<zozozo> seangrove: this might interest you : https://github.com/ocaml/ocaml/pull/556
sepp2k has joined #ocaml
fre has quit [Ping timeout: 252 seconds]
sz0 has quit [Quit: Connection closed for inactivity]
<Drup> oh, gadt diff lists
* Drup beams with delight.
<Drup> it's a bit overkill for what it is doing
<Drup> seangrove: 1) the reason is that you are not building a value. You can only build values on the right hand side of a let rec, but you are calling a function
<Drup> 2) Given how the library is made, the short answer is that you can't. The library need to allow to break the recursivity (by declaring unfinished objects) or providing the fixpoint combinator (which is usually quite annoying to use)
<Drup> (yallop's new check will not help for what you are doing)
sh0t has joined #ocaml
<seangrove> Drup: Got it, that makes sense
<seangrove> flux: Thank you for that explanation!
snowcrshd has quit [Ping timeout: 258 seconds]
zpe has quit [Remote host closed the connection]
shinnya has joined #ocaml
frefity has quit [Ping timeout: 240 seconds]
seangrove has quit [Ping timeout: 255 seconds]
P4Titan has joined #ocaml
<P4Titan> Hi all. Is there a way to declare a function at the top of a file, use it in the middle, but actually define it at the bottom, much like in C?
frefity has joined #ocaml
<reynir> It's possible to write one giant let rec ... and ..., but I wouldn't recommend it
<P4Titan> In particular, I have cyclical dependece between two modules
<theblatte> ocaml likes to make sure there are no circular dependencies, so this would be sort of going against that
<P4Titan> tho that sounds suboptimal
<theblatte> that you cannot do unless you make them mutually recursive
<theblatte> usually it's best to break the dependency by isolating the common part into a third module
Mercuria1Alchemi has quit [Ping timeout: 240 seconds]
averell has joined #ocaml
<P4Titan> theblatte: ya
<P4Titan> that's what I figured
<P4Titan> How about if I define variables at the bottom of a file, but would want to use them higher up
<P4Titan> Would it be good practice to define them to some defaut, empty values at the top
<P4Titan> but populate them at the bottom
<zozozo> P4Titan: why do you want to define them at the end ? I find it more readable if things in a file depends on what you already read above
<P4Titan> yes, but I want these variables (a BatMap and other related stuffs) to be initially populated with types defined in a module in the same file
<P4Titan> so I put the variables after that module
<orbifx-m> companion_cube: what about std.string being core? you mean built in type?
<P4Titan> but it happens that I want to also use these variables in said module. I could fix this by grouping the functionality in this function into another modules
<companion_cube> I mean that `Std.String` is not a standard module, must belong to core
frefity has quit [Ping timeout: 252 seconds]
noddy has joined #ocaml
yomimono has joined #ocaml
snowcrshd has joined #ocaml
frefity has joined #ocaml
yomimono has quit [Ping timeout: 255 seconds]
shinnya has quit [Ping timeout: 245 seconds]
fre has joined #ocaml
snowcrshd has quit [Ping timeout: 276 seconds]
ryanartecona has joined #ocaml
pigeonv has quit [Ping timeout: 260 seconds]
coddinkn has quit [Ping timeout: 255 seconds]
coddinkn has joined #ocaml
lobo has quit [Ping timeout: 276 seconds]
lobo has joined #ocaml
malc_ has joined #ocaml
Flerex has joined #ocaml
philtor has joined #ocaml
jao has quit [Ping timeout: 245 seconds]
<orbifx-m> companion_cube: I meant to say standard strings. the ones that come with ocaml
jnavila has quit [Quit: It was time]
<companion_cube> ah!
<orbifx-m> so is string and batstring compatible?
tristero has joined #ocaml
cthuluh has quit [Ping timeout: 252 seconds]
copy` has joined #ocaml
<companion_cube> type t = string
<companion_cube> so, yes
Flerex has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
AltGr has left #ocaml [#ocaml]
snowcrshd has joined #ocaml
ryanartecona has quit [Quit: ryanartecona]
govg has joined #ocaml
<twold> hello. I'm stumped by the following error:
<twold> ocaml-version >= "4.01.0" & ocaml-version < "4.03.0" & compiler !=
<twold> "4.02.1+BER".
<twold> [ERROR] lwt.2.7.0 is not available because your system doesn't comply with
<twold> > opam install lwt=2.7.0
Flerex has joined #ocaml
<twold> I use 4.04.0 system switch and have no idea where those weird ocaml-version bounds are coming from
cthuluh has joined #ocaml
<twold> I'm not sure whether this exact error is known (I wasn't able to google anything) but I'd appreciate any ideas on how to investigate opam-related errors, so that I can continue debugging on my own.
<companion_cube> well apparently lwt.2.7.0 has some weird version constraint on the compiler version, b ut I agree it's strange
Sim_n has joined #ocaml
Simn has quit [Ping timeout: 276 seconds]
<twold> I wonder whether this contains more information? Or is it the same stuff as in the error message?
<Drup> twold: result of "opam config var ocaml-version" ?
<twold> 4.04.0
<Drup> twold: version of opam ?
<twold> 1.2.2
<Drup> huum, this is surprising
<Drup> It could be yet-another-system-switch-issue
<Drup> (you have updated before, right ?)
<twold> would it be preferred if I switched to 4.04.0 (I don't really have a problem with that)?
<twold> yep
<Drup> you can try
yomimono has joined #ocaml
<twold> same error there (and it's a completely clean switch)
ryanartecona has joined #ocaml
<twold> What I'd like to know is
<twold> b) whether ~/.opam/packages is just a cache that got somehow dirty and deleting it would fix my problem?
<twold> a) why are the lwt.opam files in my ~/.opam/packages different from the ones in GH (perhaps this is normal?); and
<reynir> companion_cube: I ported my first plugin to calculon \o/ was pretty smooth (stateless plugin)
MercurialAlchemi has quit [Ping timeout: 256 seconds]
MercurialAlchemi has joined #ocaml
vramana1 has joined #ocaml
vramana has quit [Ping timeout: 256 seconds]
vramana1 is now known as vramana
ygrek has quit [Ping timeout: 240 seconds]
eimpec has quit [Quit: WeeChat 1.4]
P4Titan has quit [Remote host closed the connection]
<Drup> twold: the .opam/packages cache should not get dirty
<Drup> you don't have any pin, right ?
kakadu has quit [Quit: Konversation terminated!]
orbifx-m has quit [Remote host closed the connection]
<freechips> hey guys im basically using my program with the interpreter #use "main.ml";;
jnavila has joined #ocaml
<freechips> im trying to split it into different files, but i can't use open Helper
jao has joined #ocaml
<freechips> because i guess i need to compile first? so the only alternative to run directly is to put #use "helper.ml" inside the program instead of open?
manizzle has quit [Ping timeout: 258 seconds]
zpe has joined #ocaml
<adrien> freechips: when you compile "foo.ml", everything automatically gets put into a module named "Foo"
<adrien> when you #use, this doesn't occur
<adrien> you can #mod_use instead to get the same effect
ygrek has joined #ocaml
<freechips> you mean with mod_use i get automatic compilation?
<freechips> im not really interested. im fine with putting #use inside my file
justicef_ has joined #ocaml
ryanartecona has quit [Quit: ryanartecona]
jnavila has quit [Ping timeout: 252 seconds]
wolfcore has quit [Ping timeout: 245 seconds]
dx has quit [Changing host]
dx has joined #ocaml
pigeonv has joined #ocaml
wolfcore has joined #ocaml
Denommus has joined #ocaml
<twold> Drup: I had one pin which I now removed but that didn't help. Anyway, I can install lwt=2.7.0 with opam2, so that's good enough for me.
<Drup> it's still weird
<Drup> but honestly, I've been using opam 2.0 for so long now, that I may be missing something ^^'
Flerex has quit [Quit: Textual IRC Client: www.textualapp.com]
<twold> I agree and I'd love to understand it better but I'm not going to spend hours on tracking it down.. If I'm going to invest into understanding the internals of something, it's going to be opam 2.0 instead :)
<Drup> the story in opam 2.0 about constraint on ocaml is much much cleaner anyway
<twold> good to hear that
<Drup> (compiler packages \o/)
<twold> oh, that's indeed very nice
<flux> when might opam 2.0 be released for the greater public?-)
<twold> seems it's close. have you seen the beta announcement today?
<Drup> flux: it's perfectly usable
<Drup> well, a bit rough around the corners, but that's okay
<flux> ..solver-related roughness?
ryanartecona has joined #ocaml
<Drup> solver problems are rather perf related
<Drup> (disclaimer: I'm constantly on the dev version of opam, so I might be used to a bit more instability :p)
jnavila has joined #ocaml
_andre has quit [Quit: leaving]
kakadu has joined #ocaml
mengu has joined #ocaml
orbifx-m has joined #ocaml
freusque has joined #ocaml
orbifx-m has quit [Client Quit]
TheLemonMan has joined #ocaml
<mengu> anyone looking for a job?
<mengu> saw this on twitter
Algebr has joined #ocaml
malc_ has quit [Remote host closed the connection]
ryanartecona has quit [Quit: ryanartecona]
octachron has quit [Quit: Leaving]
Onemorenickname has joined #ocaml
<Onemorenickname> Hello people
<Onemorenickname> I don't understand an ocaml error
<Onemorenickname> I get that a "kind of expression" is not allowed on the right hand side of a letrec
<Onemorenickname> ( https://ghostbin.com/paste/acefe )
<Onemorenickname> (t and nt are just wrappers for complicated polymorphic variants)
andreas__ has joined #ocaml
<twold> Can you please show the definition of the wrappers and also paste the error you get.
<jnavila> Onemorenickname: I think that you can not use let rec with expressions, but only with functions
<twold> doing the following works, so I suspect your error (whatever is) is elsewhere
<twold> let rec t = [T t];; let rec t = [T t];;
<twold> oops, bad paste. here: type t = T of t list;; let rec t = [T t];;
<twold> jnavila: you can use it for anything. there are just restrictions to avoid cycles
Denommus has quit [Ping timeout: 255 seconds]
<yomimono> is `assert false` catchable in a try/with block?
<yomimono> nm, that's trivially answerable in utop
<Drup> twold: no, you can't use it on anything, you can only use expression on the right hand side
<Drup> err
<Drup> can only use values*
<twold> Drup: that's false
MercurialAlchemi has quit [Ping timeout: 240 seconds]
<twold> that's also false. just read the link I posted...
<twold> you can use functions, constructors and lazy values
<Drup> so, yeah, values.
<Drup> all the thing that don't need further evaluation
<twold> let's agree at that. I'd have to read the compiler source to argue further :)
<zozozo> yomimono: assert false is catchable (like any assertion failure), though I'd say that something is wrong if you try and catch one
<Drup> twold: I did :D
<Drup> twold: for further reading: https://github.com/ocaml/ocaml/pull/556
<twold> thanks!
<Drup> (this is both a reimplementation and an extension of the current check)
<Onemorenickname> jnavila, i thought this was not the problem, as the first error was found later in the code
<Onemorenickname> even though i had done so previously
<Onemorenickname> but, i removed it, and the next error (before in the code) was found, etc.
zpe has quit [Remote host closed the connection]
<Onemorenickname> I don't know why it was in reverse order, but thanks :)
<Onemorenickname> I replaced the function with the polymorphic construction
snowcrshd has quit [Remote host closed the connection]
Sim_n has quit [Read error: Connection reset by peer]
nicoo has quit [Remote host closed the connection]
nicoo has joined #ocaml
Onemorenickname has quit [Read error: No route to host]
Onemorenickname has joined #ocaml
kakadu has quit [Remote host closed the connection]
kolko_ has joined #ocaml
kolko has quit [Ping timeout: 240 seconds]
freechips has quit [Ping timeout: 240 seconds]
manizzle has joined #ocaml
jnavila has quit [Ping timeout: 240 seconds]
Onemorenickname has quit [Read error: Connection reset by peer]
Algebr has quit [Remote host closed the connection]
manizzle has quit [Ping timeout: 240 seconds]
larhat has quit [Quit: Leaving.]
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
<companion_cube> reynir: neat! what does the plugin do?
etc has joined #ocaml
<etc> I think it's related to the -pack option passed to ocamlc? Anyone know how to debug this?
<etc> I'm getting a segfault when compiling some minimal ocaml: https://github.com/Charlesetc/ocaml-segfault
<companion_cube> huuuuuu…
P4Titan has joined #ocaml
<companion_cube> that is most fascinating
<companion_cube> and might deserve a bug report
octachron has joined #ocaml
<P4Titan> Hi all. I'm using Lwt.join, running two threads that loop forever. `join` is spec'd to fail if one of the threads throws an exception. However, that doesn't seem to work for me
<companion_cube> (I mean, you're certainly not using -pack as it should, I think, but still)
<P4Titan> Does anyone have any ideas?
<companion_cube> P4Titan: it's not "throw an exception", it's "use Lwt.fail" (or be cancelled)
<P4Titan> companion_cube: Aii, I call a function inside of Lwt.wrap. So the execption I throw gets translated to a Lwt.fail. So that's not the issue. The exception is passed up whenever the other thread doesn't loop forever tho
<P4Titan> I'm not sure
<P4Titan> I just added a dummy Lwt.fail_with in one of the threads, but the exception isn't tossed up
<mfp> P4Titan: IIRC Lwt.join will actually wait for all the promises (new terminology! :) to complete or fail, then, if any failed, fail with the same exception as the 1st one to fail
<mfp> if you use Lwt.pick OTOH, it will fail as soon as the first one fails, and cancel the others
<P4Titan> mfp: that's exactly the behavior that's happening!
etc has quit [Read error: Connection reset by peer]
<mfp> P4Titan: you can get something in between with Lwt.pick + Lwt.protected or no_cancel: fail as soon as the first one fails, leave the others alone (will complete asynchronously)
etc has joined #ocaml
<P4Titan> You would do that if you wanted a sort of cancel-able join?
<mfp> which behavior do you want exactly? sounds like you actually want Lwt.pick
<mfp> Lwt.pick cancels the other promises
<mfp> and fails right away
<P4Titan> `Lwt.pick` is what I need, but I'm curious as to how to implement a `Lwt.join`
<P4Titan> for future reference
<etc> companion_cube: hmm so what's the right way of using -pack? I tried adding -for-pack without effect. but yeah it's very interesting!
<companion_cube> tbh I don't really know, I always use pack through oasis :p
<mfp> well Lwt.join is there and AFAICS works as documented :) What I described above was something like Lwt.pick @@ List.map Lwt.protected ths
<mfp> that would 1) complete/fail as soon as any completes/fails 2) leave the others running in the background
<mfp> that's an unusual behavior, usually you'll just use Lwt.pick :)
<P4Titan> why would I protect the threads tho. I would want them to be cancelable
<etc> ah that's cool - I'll try submitting a bug report. thanks!
<mfp> then you want Lwt.pick :)
<P4Titan> I just tried using Lwt.pick, but the behavior is the same
<P4Titan> Running: Lwt_main.run (Lwt.pick [P2PServer.start !p2p_port; forever_young ()])
<P4Titan> where forever_young is a dummy thread looping forever
<P4Titan> that doesn't fail when P2PServer.start fails
<mfp> it doesn't get canceled?
<P4Titan> nope
<mfp> how is it looping, does it have context switch points?
<P4Titan> let rec forever_young () = forever_young ()
<mfp> OK, that's the problem
<P4Titan> ya, I just realized
<octachron> etc, first you need to add -for-pack Parent_module when building the submodule
<octachron> etc, second you need to build object and not library archive
<octachron> i.e "ocamlc -c grape.ml" which produces a .cmo file and not a .cma file
<P4Titan> mfp: Does this have a context switch point: let rec forever_young () = return_unit >>= forever_young. It still doesn't work?
<companion_cube> no sure it does ahve a context switch
<companion_cube> return_unit is already done, so >>= might go on
<mfp> nope, it's a tight loop
<P4Titan> I thought anything returning a Lwt.t was a context switch point?
sfri has quit [Ping timeout: 240 seconds]
<mfp> just use Lwt.catch (fun () -> fst @@ Lwt.task ()) (function Lwt.Canceled -> Lwt.return @@ print_endline "I was canceled" | e -> Lwt.fail e) to get a dummy sleeping thread
<mfp> Lwt evaluates promises eagerly, if you have a "resolved" promise, it will pass the result right away to the right-hand side of the bind
<P4Titan> oh boy
<mfp> (IIRC async OTOH would switch at that point)
fedruantine has joined #ocaml
rom1504 has quit [Ping timeout: 240 seconds]
<P4Titan> dang, it works...
sfri has joined #ocaml
ryanartecona has joined #ocaml
dxtr has quit [Ping timeout: 256 seconds]
rom1504 has joined #ocaml
<P4Titan> Are all threads cancelable by default
dxtr has joined #ocaml
<etc> octatron: nice! Yeah the '-c' instead of '-a' is what I was missing. Thanks! It's probably not worth reporting a segfaut when people use .cma instead of .cmo's?
<mfp> P4Titan: those created with Lwt.task, the Lwt_unix.* family, and recursively all those waiting on them
<octachron> etc, honestly, I don't even know what -pack was trying to do with cma files. Not failing at this point *is* a bug.
<P4Titan> what do you mean by "recursively all those waiting on them"? Meaning the ones in series with them
<mfp> if you have let t, u = Lwt.task (), then let t2 = t >>= fun _ -> .... t2 is cancelable too, since it's waiting on t (which is cancelable)
<P4Titan> ic understood
<P4Titan> many thanks for the help and attention!
<mfp> np
fluter has quit [Ping timeout: 256 seconds]
etc has quit [Remote host closed the connection]
fluter has joined #ocaml
octachron has quit [Quit: Leaving]
al-damiri has quit [Quit: Connection closed for inactivity]