adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml 4.09 release notes: https://caml.inria.fr/pub/distrib/ocaml-4.09/notes/Changes | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
ollehar has quit [Ping timeout: 265 seconds]
ollehar has joined #ocaml
dhil has quit [Ping timeout: 260 seconds]
spew has quit [Quit: Connection closed for inactivity]
mangoicedtea has quit [Quit: Leaving]
mfp has quit [Ping timeout: 256 seconds]
osa1 has joined #ocaml
mbuf has joined #ocaml
mbuf has quit [Ping timeout: 240 seconds]
waleee-cl has quit [Quit: Connection closed for inactivity]
unai_ has joined #ocaml
unai_ has quit [Client Quit]
unihernandez22 has joined #ocaml
unihernandez22 has quit [Client Quit]
dborisog has joined #ocaml
reynir has quit [Ping timeout: 265 seconds]
reynir has joined #ocaml
malc_ has joined #ocaml
osa1 has quit [Ping timeout: 256 seconds]
vicfred has quit [Quit: Leaving]
mbuf has joined #ocaml
_whitelogger has joined #ocaml
Haudegen has joined #ocaml
dborisog has quit [Ping timeout: 256 seconds]
nkly has joined #ocaml
osa1 has joined #ocaml
madroach has joined #ocaml
osa1 has quit [Remote host closed the connection]
mbuf has quit [Quit: Leaving]
dckc has quit [Ping timeout: 260 seconds]
osa1 has joined #ocaml
dckc has joined #ocaml
jbrown has joined #ocaml
nkly has quit [Ping timeout: 260 seconds]
mbuf has joined #ocaml
labor[m] has quit [Quit: killed]
BitPuffin has quit [Quit: killed]
aspiwack[m] has quit [Quit: killed]
smondet[m] has quit [Quit: killed]
defolos has quit [Quit: killed]
peddie has quit [Quit: killed]
dash has quit [Quit: killed]
gaussian[m] has quit [Quit: killed]
camlriot42 has quit [Quit: killed]
khady[m] has quit [Quit: killed]
swapnilraj[m] has quit [Quit: killed]
lnxw37d4 has quit [Quit: killed]
jimt[m] has quit [Quit: killed]
flux1 has quit [Quit: killed]
aecepoglu[m] has quit [Quit: killed]
Manis[m] has quit [Quit: killed]
flux1 has joined #ocaml
lnxw37d4 has joined #ocaml
khady[m] has joined #ocaml
labor[m] has joined #ocaml
dash has joined #ocaml
camlriot42 has joined #ocaml
aspiwack[m] has joined #ocaml
jimt[m] has joined #ocaml
BitPuffin has joined #ocaml
peddie has joined #ocaml
smondet[m] has joined #ocaml
defolos has joined #ocaml
aecepoglu[m] has joined #ocaml
swapnilraj[m] has joined #ocaml
Manis[m] has joined #ocaml
gaussian[m] has joined #ocaml
malc_ has quit [Remote host closed the connection]
mfp has joined #ocaml
tobiasBora2 has quit [Quit: WeeChat 1.6]
nkly has joined #ocaml
nullcone has quit [Quit: Connection closed for inactivity]
<mbuf> How can I invoke "contents" and retrieve the value of caml_symbols from a let () construct? https://pastebin.com/z25g6HgF
osa1 has quit [Quit: osa1]
osa1 has joined #ocaml
<d_bot> <Et7f3> pattern match
<d_bot> <Et7f3> ```OCaml
<d_bot> <Et7f3> match contents () with
<d_bot> <Et7f3> | Core_kernel__.Result.Ok {caml_symbols} -> (* use caml_symbols *)
<d_bot> <Et7f3> | _ -> failwith "something fail"
<d_bot> <Et7f3> ```
<mbuf> d_bot, https://pastebin.com/ZLhEvtRY, pattern match error, what is wrong?
<flux1> it seems there is a Deferred in the type which to me sounds like something to do with async. I haven't used Core, though.
artart78 has quit [Ping timeout: 272 seconds]
dhil has joined #ocaml
<d_bot> <Et7f3> :GWcmeisterPeepoShrug: for me Or_error is https://ocaml.janestreet.com/ocaml-core/latest/doc/core_kernel/Core_kernel/Or_error/index.html so Result but it doesn't seem. maybe other user can help you
<mbuf> Let me re-phrase. What is the equivalent of using contents () as seen from utop() in a .ml file?
reynir has quit [Quit: rebooting]
<Fardale> mbuf: where does contents come from ?
<mbuf> Fardale, it invokes "run" as in contents = run ~binary:"c.exe" ~working_dir:"/tmp/default"
<Fardale> sorry where run come from
<mbuf> or, that is how it is defined
<mbuf> Fardale, in the same source file
<mbuf> Fardale, d_bot flux1 Let me paste the entire code - https://pastebin.com/sZBNscVT
<Fardale> It seems to be async some Async stuff, so you have te run the promise somehow. I don't really know Async, but if it work like Lwt, then you will need to bind it
<mbuf> Fardale, yes, I need to run the promise to get the result
<Fardale> If you know that, what is your question ? How to run a promise ?
malc_ has joined #ocaml
<mbuf> Fardale, yes, the latter; I am able to run contents() in utop, just need to know how to do it in a let () construct
<mbuf> I haven't used Lwt or Async yet
<Fardale> you need to transforme your whole program as a promise. So in pratice that means you will do something like: let main = (* your program *) and you will do Command.run main
<d_bot> <kanishka> I am still learning this also, but their is a note about starting a scheduler in RWO async chapter
<Fardale> In your program you will need to use bind, in Async you have the infix operator >>= if your function return a promise or >>| if not
<Fardale> you can look at the small exemple in the first page of the documentation of Async https://opensource.janestreet.com/async/
<mbuf> Fardale, thanks! I shall take a look
malc_ has left #ocaml ["ERC (IRC client for Emacs 28.0.50)"]
reynir has joined #ocaml
reynir has quit [Remote host closed the connection]
reynir has joined #ocaml
jbrown has quit [Ping timeout: 272 seconds]
<Leonidas> is the material of any of the ocaml MOOCs publically available?
jbrown has joined #ocaml
<Leonidas> mbuf: actually I think it is more customary to use ppx_let instead of noisy binds everywhere
<Leonidas> `(>>=*)` is essentially (>>=) when using Deferred.Or_error.Let_syntax.
<Leonidas> let%bind I mean
<Leonidas> Then you also avoid the long names and just use `return`
<Fardale> In Lwt code, I more often see >>= that let%lwt
<Fardale> I don't for async
<theblatte> why use let%bind instead of let*? no ppx needed for the latter
<Leonidas> In Async it is more convenient because there is Deferred.Result.t and Deferred.Or_error.t etc.
<theblatte> ok thanks
<Leonidas> theblatte: there is no match*, which makes this a no-go for me
<Leonidas> half of my code would be changed into let* don'tcare = … in match don'tcare with …
<mbuf> Leonidas, I see
<Leonidas> Also I believe ppx_let allows sth like let%bind.Deferred.Result which is to me somewhat more readable than a let*=>< or however one would name a bind on a Deferred.Result.t
<Leonidas> but yes, I greatly appreciate that finally some do syntax is being mainlined
<Leonidas> give me match%bind and deriving and I'm all set :D
bartholin has quit [Quit: Leaving]
<theblatte> makes sense ^^
<mbuf> Leonidas, could you pastebin on how run () looks after the above change, and its invocation with an example?
<mbuf> Leonidas, I am new to Async and Core
<theblatte> maybe they should be more characters allowed after * too, eg let*deferred_result
andreas303 has quit [Remote host closed the connection]
andreas303 has joined #ocaml
<Leonidas> mbuf: yeah, will take a while since I need to create a new local switch
<mbuf> Leonidas, thanks!
Jesin has quit [Ping timeout: 240 seconds]
dckc has quit [Ping timeout: 265 seconds]
dckc has joined #ocaml
dhil has quit [Ping timeout: 264 seconds]
spew has joined #ocaml
FreeBirdLjj has joined #ocaml
nkly has quit [Ping timeout: 260 seconds]
ggole has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
<mbuf> Leonidas, any specific libraries to be included when building as a dune project? I get "Error: dune__exe__C-orig corresponds to an invalid module name"
<mbuf> Sorry, that was the wrong file
<mbuf> Now, I get Error: Uninterpreted extension 'bind'.
<mbuf> . Probably, need to include some ppx_let
<mbuf> Never mind, added (preprocess (pps ppx_let)) to the dune file.
<mbuf> Leonidas, It builds fine. Where do I print caml_symbols? Thanks!
<Leonidas> mbuf: you can print it wherever it is in scope
<Leonidas> mbuf: I don't quite understand your question tbh
<Leonidas> (fwiw you might want to use Async.Writer.stdout for writing to avoid issues with ordering)
vicfred has joined #ocaml
<mbuf> Leonidas, I was referring to return { caml_symbols }. I need to get the output of the same
<Leonidas> mbuf: I'd do that in `main`
<defolos> noob question: how can I tell dune to link `Str` into my application/library?
<Leonidas> that's also cool since you need to convert from an 'a Or_error.Deferred.t to an unit Or_error.Deferred.t
<defolos> …
<defolos> I'm an idiot: `(libraries str)` does the trick
<defolos> far too obvious
<mbuf> Leonidas, Sorry, where? let%bind _ = Async.Writer.stdout run ~binary ~working_dir () in gives "Error: This expression has type Async.Writer.t lazy_t. This is not a function. It cannot be applied."
<Leonidas> mbuf: Async.Writer.stdout is not a function, Async.Writer.write is
<Leonidas> val write : ?⁠pos:int ‑> ?⁠len:int ‑> t ‑> string ‑> unit
<Leonidas> `let%bind r = run ~binary ~working_dir () in Async.Writer.write (force Async.Writer.stdout) r; return ()` or so
craigfe has joined #ocaml
nkly has joined #ocaml
<mbuf> Leonidas, I see. I get "Error: This expression has type t but an expression was expected of type string", and it points at 'r' in "r; return()"
<Leonidas> mbuf: ah, you need to convert your `t` to a string to print it.
<mbuf> Leonidas, you mean 'r'?
<mbuf> Leonidas, ohh! you meant the type t, which is a float
<Leonidas> mbuf: type t is not a float, it is a record that contains a float
<Leonidas> type t is of type t to be exact :D
<mbuf> I tried (Printf.sprintf "%.2f" r), and it throws a syntax error: String literal not terminated
<flux1> it's not probably that line that is causing the issue..
<Leonidas> mbuf: also `r` is of type `t`, it can't be printed using %f, since that requires floats.
<mbuf> Leonidas, I see
<Leonidas> Why are you wrapping caml_symbols in a record even?
<mbuf> Leonidas, not my code :)
FreeBirdLjj has quit [Ping timeout: 240 seconds]
<mbuf> Leonidas, works; great! can I give attribution to your changes to this code?
osa1 has quit [Ping timeout: 240 seconds]
<Leonidas> if you want to…
<Leonidas> I'd do a whole lot of other changes though :p
<mbuf> Leonidas, will do; sure, I will ping you after I read a bit more on OCaml and need to do code reviews :)
<mbuf> Leonidas, thanks again for your time and patience; appreciate it!
<Leonidas> haha
FreeBirdLjj has joined #ocaml
<dash> i see the reasonml people have decided to confuse everyone again
<companion_cube> it's the bucklescripts people it seems
mbuf has quit [Quit: Leaving]
artart78 has joined #ocaml
<flux1> I guess it's not all bad to provide a coherent site with consistent naming, if you want to compete with TypeScript..
<flux1> haven't looked at the new syntax, though :)
FreeBirdLjj has quit [Remote host closed the connection]
Haudegen has quit [Ping timeout: 240 seconds]
chripell has quit [Quit: ZNC 1.8.1+deb1 - https://znc.in]
reynir has quit [Ping timeout: 260 seconds]
reynir has joined #ocaml
chripell has joined #ocaml
waleee-cl has joined #ocaml
vicfred has quit [Quit: Leaving]
tane has joined #ocaml
ggole has quit [Quit: Leaving]
gahr_ has joined #ocaml
cqc_ has joined #ocaml
vicfred has joined #ocaml
farn__ has joined #ocaml
khady[m] has quit [*.net *.split]
camlriot42 has quit [*.net *.split]
labor[m] has quit [*.net *.split]
leah2 has quit [*.net *.split]
gahr has quit [*.net *.split]
cqc has quit [*.net *.split]
farn_ has quit [*.net *.split]
cqc_ is now known as cqc
Manis[m] has quit [Remote host closed the connection]
BitPuffin has quit [Read error: Connection reset by peer]
flux1 has quit [Read error: Connection reset by peer]
dash has quit [Read error: Connection reset by peer]
smondet[m] has quit [Remote host closed the connection]
lnxw37d4 has quit [Remote host closed the connection]
aecepoglu[m] has quit [Read error: Connection reset by peer]
aspiwack[m] has quit [Remote host closed the connection]
swapnilraj[m] has quit [Remote host closed the connection]
defolos has quit [Read error: Connection reset by peer]
peddie has quit [Read error: Connection reset by peer]
gaussian[m] has quit [Remote host closed the connection]
jimt[m] has quit [Write error: Connection reset by peer]
rpcope has quit [Ping timeout: 246 seconds]
leah2 has joined #ocaml
smondet[m] has joined #ocaml
reynir has quit [Quit: WeeChat 2.3]
bartholin has joined #ocaml
rpcope has joined #ocaml
reynir has joined #ocaml
khady[m] has joined #ocaml
BitPuffin has joined #ocaml
peddie has joined #ocaml
labor[m] has joined #ocaml
jimt[m] has joined #ocaml
lnxw37d4 has joined #ocaml
dash has joined #ocaml
flux1 has joined #ocaml
camlriot42 has joined #ocaml
aspiwack[m] has joined #ocaml
defolos has joined #ocaml
aecepoglu[m] has joined #ocaml
gaussian[m] has joined #ocaml
Manis[m] has joined #ocaml
swapnilraj[m] has joined #ocaml
osa1 has joined #ocaml
dhil has joined #ocaml
eureton has joined #ocaml
nkly has quit [Ping timeout: 265 seconds]
Jesin has joined #ocaml
eureton has quit [Read error: Connection reset by peer]
eureton has joined #ocaml
eureton has quit [Ping timeout: 260 seconds]
osa1 has quit [Ping timeout: 246 seconds]
nullcone has joined #ocaml
vicfred has quit [Quit: Leaving]
<Leonidas> companion_cube: but is it?
<Leonidas> I am thoroughly confused how reasonml is related with bucklescript. it seems: not at all anymore.
<companion_cube> I don't know if the news was done in concertation, but it does seem to me it's all done by bucklescripts people who decided they also wanted their own, even more JS-y, syntax
<companion_cube> (so people from bloomberg, not FB)
<d_bot> <Anurag> the bucklescript devs work at facebook now i believe
<companion_cube> oh interesting.
<companion_cube> TIL.
jmorris_ has joined #ocaml
jmorris_ has quit [Remote host closed the connection]
etm_ has joined #ocaml
tane has quit [Quit: Leaving]
jbrown has quit [Ping timeout: 272 seconds]
mangoicedtea has joined #ocaml
inkbottle has joined #ocaml
zebrag has quit [Ping timeout: 260 seconds]
dhil has quit [Ping timeout: 244 seconds]