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
<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
<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 ^^'
<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)
<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
<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]