Leonidas changed the topic of #ocaml to: Discussion about the OCaml programming language | http://www.ocaml.org | OCaml 4.13.0 released: https://ocaml.org/releases/4.13.0.html | Try OCaml in your browser: https://try.ocamlpro.com | Public channel logs at https://libera.irclog.whitequark.org/ocaml/
Soni has quit [Ping timeout: 250 seconds]
perrierjouet has quit [Quit: WeeChat 3.4]
Soni has joined #ocaml
<d_bot> <hcarty> Since the OCaml language server is using merlin code internally the real differences come down to editor integration
<d_bot> <hcarty> And it's kind of nice that more editors can benefit from the language server than those with explicit community support. Even if the support isn't 100% what you get with a custom emacs config
Nahra has quit [Remote host closed the connection]
<companion_cube> that's exactly the point: people don't all use emacs :p
<rgrinberg> companion_cube you're still managing to use lsp with neovim?
<companion_cube> yeah of course
<companion_cube> it works super well
<companion_cube> hmmm. although very recently it has sometimes crashes on me I guess. now that I think of it?
<rgrinberg> version 1.10.1?
<companion_cube> 1.10.0
<companion_cube> are you thinking of a specific bug?
<rgrinberg> Yes, but it's only related to ppx which you don't use :/
<rgrinberg> 1.10.0 is the first version that uses a proper scheduler under the hood, so it might have other bugs
<rgrinberg> it's best if you paste the stderr if you notice it crashing
<companion_cube> I use ppx a bit at work :)
<rgrinberg> companion_cube how is cargo's watch mode?
<companion_cube> there's only a 3rd party plugin I think
<companion_cube> otoh rust-analyzer does the whole build itself
<rgrinberg> using cargo tho?
<companion_cube> I'm not sure
<companion_cube> it might use cargo's library to build dependencies
<companion_cube> but otherwise, building rust is a lot more predictable :)
<d_bot> <hcarty> companion_cube Exactly! I don't use emacs and appreciate how easy lsp is to setup and use
<rgrinberg> curious to see how they'll make it "just work" with the editor and watch mode
<companion_cube> I suspect rust-analyzer does its own watching
zebrag has quit [Quit: Konversation terminated!]
<rgrinberg> we could eventually move to something like that in lsp as well
<rgrinberg> have the server run dune in the background for you
<rgrinberg> the problem with this approach is that sometimes users run their build and their editor in slightly different environments
<rgrinberg> and if those little differences matter, it can create some hard to debug bugs
perrierjouet has joined #ocaml
gentauro has quit [Read error: Connection reset by peer]
gentauro has joined #ocaml
wingsorc has quit [Remote host closed the connection]
wingsorc has joined #ocaml
mbuf has joined #ocaml
<companion_cube> indeed
<companion_cube> like, I run some of my builds -w with `--profile=release` :p
zebrag has joined #ocaml
bobo has joined #ocaml
spip has quit [Ping timeout: 272 seconds]
<d_bot> <Dennis> I’ve been sitting on this idea of reimplementing liveview in ocaml. Beside having a dev to spearhead the design, liveview works well on Erlang/elixir because the Erlang VM can balance processes so well. See the bit where Chris found elixir. https://fly.io/blog/how-we-got-to-liveview/.
<d_bot> <Dennis>
<d_bot> <Dennis> We can try to take the same websocket route, or do the html over the wire route like with basecamp’s hotwire or laravel’s livewire.
<d_bot> <Dennis>
<d_bot> <Dennis> If ocaml 5’s fibers are anything like goroutines or Erlang processes, then it might be possible to have to have the whole websocket idea.
waleee has quit [Ping timeout: 250 seconds]
Haudegen has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
greenbagels has quit [Remote host closed the connection]
greenbagels has joined #ocaml
Boarders_ has quit [*.net *.split]
JSharp has quit [*.net *.split]
Fardale has quit [*.net *.split]
cbarrett has quit [*.net *.split]
hyphen has quit [*.net *.split]
perrierjouet has quit [*.net *.split]
cross has quit [*.net *.split]
Serpent7776 has quit [*.net *.split]
kurfen_ has quit [*.net *.split]
afrosenpai has quit [*.net *.split]
Fardale has joined #ocaml
Boarders_ has joined #ocaml
cbarrett has joined #ocaml
cross has joined #ocaml
hyphen has joined #ocaml
perrierjouet has joined #ocaml
afrosenpai has joined #ocaml
Serpent7776 has joined #ocaml
kurfen_ has joined #ocaml
JSharp has joined #ocaml
ccx has quit [*.net *.split]
ccx has joined #ocaml
adanwan has quit [*.net *.split]
azimut has quit [*.net *.split]
wyrd has quit [*.net *.split]
adanwan has joined #ocaml
azimut has joined #ocaml
wyrd has joined #ocaml
mro has joined #ocaml
mro has quit [Ping timeout: 272 seconds]
zebrag has quit [Quit: Konversation terminated!]
gravicappa has joined #ocaml
Nahra has joined #ocaml
<d_bot> <orbitz> Is there documentation on how to set up LSP in emacs?
Dimonax has joined #ocaml
mro has joined #ocaml
random-jellyfish has joined #ocaml
<random-jellyfish> how do I include the Plot module from Owl?
<random-jellyfish> open Owl.Plot;; didn't work
<random-jellyfish> open Plot didn't work
<d_bot> <bnguyenv> You need owl-plplot.
<d_bot> <bnguyenv> Then `Owl_plplot.Plot`. I think.
<random-jellyfish> $ opam install own-plplot
<random-jellyfish> [ERROR] No package named own-plplot found.
<random-jellyfish> there's no place in the owl documentation where they specify how to link this package
<d_bot> <NULL> With an l maybe ?
<random-jellyfish> just code snippets that assume it's already included
<random-jellyfish> ok I'll try
<random-jellyfish> you mean an I instead of a lower case L?
<d_bot> <NULL> I mean you tried to install `own-plplot` instead of `owl-plplot`
<random-jellyfish> oh yes, my bad
<random-jellyfish> ok it got installed
<random-jellyfish> open Owl_plplot.Plot;; works
<random-jellyfish> but for Plot.create - Error: Unbound module Plot
<random-jellyfish> I see I have to use the prefix Owl_plplot. everywhere
<random-jellyfish> can I do something like a qualified import in haskell?
<d_bot> <actionshrimp> if you install the `lsp-mode` package it knows about ocaml-lsp already (and associates it with tuareg mode). if you're interested in perf you'll probably want to turn off a lot of the UI features via various config vars - I've got a fairly streamlined config now and it does feel a bit snappier than merlin used to
<d_bot> <bnguyenv> You can do `open Owl_plplot` for this kind of thing, or `module Plot = Owl_plplot.Plot`.
<d_bot> <orbitz> I got it going (turned out my dash version was too old for latest lsp-mode). Although what I'm running into now is it cannot find any of my symbols
<d_bot> <glennsl> `eglot` also knows about `ocaml-lsp`, and is generally snappier with zero configuration needed. I haven't actually tried it with `ocaml-lsp` myself though, but it does make `rust-analyzer` usable. Barely.
<d_bot> <actionshrimp> ah good to know, thanks
<d_bot> <glennsl> it was also very easy to set `eglot` up for `rescript`s lsp, just a single line of config.
<random-jellyfish> yes Module Plot = ... works
Dimonax has quit [Quit: Leaving]
jlrnick has joined #ocaml
random-jellyfish has quit [Ping timeout: 256 seconds]
mro has quit [Remote host closed the connection]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
kakadu has joined #ocaml
<d_bot> <antron> summarized my concerns about eio (the proposed multicore effects i/o library) being too influenced by the needs of mirage, in (afaict) agreement with others from the thread, namely leo, dbuenzli, @companion_cube: https://discuss.ocaml.org/t/eio-0-1-effects-based-direct-style-io-for-ocaml-5/9298/29?u=antron
<d_bot> <antron> i hope interested people take a look
mro has quit [Remote host closed the connection]
mro has joined #ocaml
olle has joined #ocaml
<SquidDev> Capabilities aside, I will say the fibre and structured concurrency model of eio is really nice to work with.
<d_bot> <antron> yes, and most people i think agree. but the capabilities thing really sticks out and is imo completely unnecessary yet quite burdensome, so that's what we objected to (though i think dbuenzli additionally objected to fibers etc as well, but his objection as i understood it covers capabilities)
einar has joined #ocaml
<einar> Instead of `dune utop .` followed by `#use "myproject.ml` how can I do both in a single shell command? I would like my bindings to be available for experimentation inside utop.
<SquidDev> Yeah, the ergonomics of capabilities definitely leave something to be desired. It's a shame, as conceptually I do like the idea (though realise I'm in the minority here!)
<d_bot> <antron> i also like the idea conceptually, being from a PL background especially. however i have chosen the path of engineering deliberately in my life 😛 and capabilities in ocaml, with how leaky the ocaml context is, have no real use except as a fun exercise. unless you are coding in an environment like mirage, where you need them anyway. and for mirage, capability objects are an upgrade over the current extremely heavyweight things t
<d_bot> <antron> whereas for general-purpose ocaml programming, capability objects are a downgrade
<d_bot> <antron> and ocaml is a pragmatic language and e.g. in dream i want the api to "show" how fluent such a language can be, if the api is not loaded with excessive concepts
<d_bot> <antron> concepts that may be interesting but that nonetheless don't offer any actual pragmatic benefit in the reality of ocaml
<d_bot> <antron> as i said in one of the posts, i think it would be extremely disappointing if ocaml went the other way in its I/O library, and *introduced* such interesting but not practical concepts, in a part of the ecosystem where they weren't even there to begin with
<d_bot> <KW78> dune requires `myproject.ml` being part of a library to in `dune utop` One workflow would be
<d_bot> <KW78> - minimal main.ml declared with a dune file as as executable and calling `start ()`
<d_bot> <KW78> - a start.ml with the start entry point `let start () =...` plus ...others.ml in one or more librairies (each with associated dune file)
bartholin has joined #ocaml
<d_bot> <mefyl> digging this up from last friday @Et7f3 : what do you mean by "try to switch" please, switch what ? I have the latest dune and merlin, I supposed they where able to interact however they want to get such path informations
azimut has quit [Remote host closed the connection]
azimut has joined #ocaml
<gahr> I'm learing dune and trying to switch --profile between a debug build and a release build
<gahr> unsuccessfully, until now
<gahr> here it says (flags (:standard -O3))), which I think should be (flags (:standard -ccopt -O3))) ?
<d_bot> <Butanium (@me on answer)> flag O3 doesn't work for me too
<gahr> also, --profile=dev and --profile=release produce identical .exe files :/
<d_bot> <Butanium (@me on answer)> `/root/.opam/myswitch/bin/ocamlc.opt: unknown option '-O3'.`
<d_bot> <Kakadu> you could add --verbose and compare exact compilation switches
<d_bot> <NULL> O3 is only accepted by ocamlopt IIRC
<gahr> I do see profile = Dyn and profile = release in _build/log
<d_bot> <Butanium (@me on answer)> Am I doing something wrong ?
<d_bot> <NULL> ocamlc.opt <> ocamlopt
<d_bot> <Butanium (@me on answer)> ah
<d_bot> <NULL> I'm yet to learn what .opt stands for: both ocamlopt and ocamlopt.opt exist
<d_bot> <Butanium (@me on answer)> but what do I miss if it's the doc it says that you can use -O3 flag ?
<d_bot> <Butanium (@me on answer)> is it a problem of my switch ?
<d_bot> <NULL> Where ?
<d_bot> <NULL> The release profile uses ocamlopt, which the build one doesn't
<d_bot> <Butanium (@me on answer)> hmm
<d_bot> <Butanium (@me on answer)> so how do you use the -O3 flag ?
<d_bot> <Butanium (@me on answer)> if you can't build with it
<d_bot> <NULL> `--profile=release`
<d_bot> <Butanium (@me on answer)> `dune exec ./tests/Single_test.exe --profile=release`
<d_bot> <Butanium (@me on answer)> is the command which causes the error above
<d_bot> <Butanium (@me on answer)> oh
<gahr> so depending on the profile a different compiler is used?
<d_bot> <Butanium (@me on answer)> `dune build --profile=release` give me the same error
mro has quit [Remote host closed the connection]
<gahr> also interestingly, if I don't specify profiles in my dune file and I just dune build --profile=dev vs. dune build --profile=release, the exes from the release build are 10x slower than the dev ones
<d_bot> <NULL> I don't know then
<d_bot> <Butanium (@me on answer)> I have a lambda switch
<d_bot> <Butanium (@me on answer)> that's maybe why
<d_bot> <NULL> It's not that unexpected that simply using ocamlopt should be slower
<gahr> but isn't it unexpected that --profile release is slower than --profile dev?
Haudegen has quit [Quit: Bin weg.]
<d_bot> <glennsl> why do you assume `release` would optimize for speed rather than, say, portability?
<d_bot> <NULL> I misread and thought that compilation was slower. Weird indeed
Chouhartem has quit [Quit: WeeChat 3.1]
<gahr> glennsl: because that's what I've been seeing in all other contexts where dev vs. release is mentioned so far :)
<gahr> also, because the example on the dune docs add a -O3 in release mode
<gahr> are you saying I got this wrong and dev vs. release aren't about debuggability vs. speed?
Chouhartem has joined #ocaml
<d_bot> <glennsl> I don't know, I find it hard to find much of anything on what these profiles actually do, but I don't think it's obvious that speed is the holy grail that should always be the optimization target.
<d_bot> <glennsl> I think it mostly is so because it's the standard for dick measurement contests across languages, but for most programs it would seem to make more sense to optimize for portability.
<d_bot> <glennsl> That's just my hunch for why it may be so though.
<d_bot> <mseri> @gahr I think you should open an issue on the dune repository or mention in the discuss forum. I think dune release is meant to be faster tbh
<d_bot> <Bluddy> any idea what's making it run slower? release should definitely be faster
mro has joined #ocaml
<d_bot> <Et7f3> Try to stop using merlin and use the new extension
mro has quit [Remote host closed the connection]
bartholin has quit [Ping timeout: 252 seconds]
<d_bot> <mefyl> the new extension ? I don't use VSCode if that's what you're referring to
<d_bot> <mefyl> But I'll open a merlin issue since it seems there is no simple answer to my problem
bartholin has joined #ocaml
jlrnick has quit [Ping timeout: 240 seconds]
Haudegen has joined #ocaml
bartholin has quit [Ping timeout: 252 seconds]
mro has joined #ocaml
bartholin has joined #ocaml
bartholin has quit [Ping timeout: 240 seconds]
olle has quit [Remote host closed the connection]
cedric has joined #ocaml
waleee has joined #ocaml
bartholin has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
olle has joined #ocaml
olle has quit [Read error: Connection reset by peer]
mro has quit [Remote host closed the connection]
mro has joined #ocaml
xgqt has quit [Remote host closed the connection]
xgqt has joined #ocaml
rgrinberg has joined #ocaml
rgrinberg has quit [Client Quit]
rgrinberg has joined #ocaml
<sadiq> gahr, 10x is pretty weird
spip has joined #ocaml
bobo has quit [Ping timeout: 272 seconds]
rgrinberg has quit [Client Quit]
olle has joined #ocaml
azimut has quit [Remote host closed the connection]
azimut has joined #ocaml
cedric has quit [Quit: Konversation terminated!]
<gahr> sadiq: I am not sure I know what I'm doing
<sadiq> gahr, how big are the executables for each?
<sadiq> iirc the biggest win from release is cross module inlining? Maybe something has gone horribly wrong.
waleee has quit [Ping timeout: 272 seconds]
<gahr> this test was just Array.init with some large number and some semi-complex float operations
<gahr> it was a single module with a single let _ : () =
<sadiq> did you use a robust way of measuring the performance?
<sadiq> (e.g runtime on a laptop can be all over the place if it's a short run)
<gahr> 0.06 vs 0.6 seconds
<gahr> shouldn't be noise
<gahr> now I can't reproduce it anymore
<gahr> :( nevermind
<gahr> now they seem comparable.. I expected to see a difference like the one i see in C or C++ between O0 and O3
<companion_cube> for a tiny bit of code, it probably won't change anything
<companion_cube> --profile=release allows cross module inlining, notably, so that makes a difference on bigger programs.
<gahr> and that doesn't neeed any particular settings in the dune file, as per https://github.com/ocaml/dune/blob/main/doc/quick-start.rst#setting-the-ocaml-compilation-flags-globally ?
<gahr> I think it works out of the box
<gahr> I can see different ocamlc.opt and ocamlopt.opt invocations in _build/log
<companion_cube> it should work out of the box yes
<companion_cube> and note that `dune build -p foo` (as used in opam files) automatically uses profile=release internally
<gahr> I se
<gahr> e
mro has quit [Remote host closed the connection]
zebrag has joined #ocaml
rgrinberg has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
mro has joined #ocaml
mbuf has quit [Quit: Leaving]
<olle> Does anyone here have experience with free monad in OCaml?
<companion_cube> no, and it's probably a bad idea
<rgrinberg> I have experience and I concur :)
mro has quit [Remote host closed the connection]
<olle> Why bad?
<olle> You hate DSL? :O
<rgrinberg> nope. as far as I can tell, you can accomplish everything with tagless final without the 10x performance penalty and needless monad juggling
<olle> rgrinberg: Oh
<olle> OK then
<olle> Anyone here have experience with tagless-final in OCaml...?
<rgrinberg> smondet[m]
<companion_cube> read the BAP blog
<olle> It's gonna be Oleg, isn't it?
<rgrinberg> who else :D
<olle> ^^
<olle> Who is that guy anyway?
<olle> Some wizard?
<companion_cube> yes
<olle> From the ancient times
bartholin has quit [Quit: Leaving]
rgrinberg has quit [Read error: Connection reset by peer]
<d_bot> <orbitz> some say he's a time traveling super smart compiler
<olle> :D
rgrinberg has joined #ocaml
<smondet[m]> yes I did some tagless-final extensible EDSLs a few years ago (bioinformatics stuff)
<smondet[m]> I did a talk at one of the ocaml workshops
<smondet[m]> there was this also: https://bitbucket.org/knih/quel/src/master/
<olle> smondet[m]: Nice, thanks
Haudegen has joined #ocaml
<Corbin> olle: Note that free-monad approaches are like "tagless initial" encodings; there are many different valid encodings for an API, and the free monad and tagless-final approaches are at opposite ends.
<olle> I will not note that, because I have no idea what that means, hahaha
<olle> Don't bother, I have to read more first
<Corbin> Relevant to OCaml, a free monad tends to build up lots of intermediate work, and the bookkeeping for that work can dominate everything else. I've written OCaml programs that should run fine, but overflow the stack.
<Corbin> The tagless-final approach removes all of that. Or most of it, at least.
<olle> Alright :)
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rgrinberg has joined #ocaml
olle has quit [Remote host closed the connection]
Johann has quit [Ping timeout: 268 seconds]
Haudegen has quit [Quit: Bin weg.]
Haudegen has joined #ocaml
mro has joined #ocaml
mro has quit [Remote host closed the connection]
azimut has quit [Remote host closed the connection]
azimut has joined #ocaml
<d_bot> <Quentin Fortier> How do you use List.sort to sort floats? I struggle for a simple compare function.
<companion_cube> `compare` works on floats
<rgrinberg> Yes, but avoid compare in general. Use Float.compare
<d_bot> <Quentin Fortier> Thanks.
<companion_cube> oh that's right, there's a Float module now
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mro has joined #ocaml
mro has quit [Ping timeout: 272 seconds]
<d_bot> <Quentin Fortier> How can I flush automatically with Format.printf ?
<companion_cube> add @. in your format string
<companion_cube> adds a \n and flushes.
<companion_cube> (otherwise, just @? but it's less good imho)
<d_bot> <Quentin Fortier> The docs says %! but I may misunderstand
<d_bot> <Quentin Fortier> https://ocaml.org/api/Printf.html
<companion_cube> that's for Printf itself
<d_bot> <Quentin Fortier> Didn't notice that there are Format.printf and Printf.printf
<companion_cube> they share the same format strings, but in Format most things are @-prefixed
<companion_cube> @[hello@ world@]@.
mro has joined #ocaml
perrierjouet has quit [Quit: WeeChat 3.4]
gravicappa has quit [Ping timeout: 256 seconds]
<d_bot> <orbitz> @rgrinberg What would I need to do for you to be comfortable with some sort of non-dune-based way to feed ocaml-lsp merlin data?
rgrinberg has joined #ocaml
<d_bot> <rgrinberg> dune has a subcommand called `ocaml-merlin` that is used by lsp to feed it whatever information it needs.
<d_bot> <rgrinberg> so all you need to do is provide an alternative to this command that understand your build layout
jlrnick has joined #ocaml
<d_bot> <orbitz> Cool, I found where I think that is run in the code (merlin_config.ml). Would you be comfortable accepting commits to ocaml-lsp that allow specifying the command to run in some other way (command line option, maybe?)
<d_bot> <rgrinberg> I wouldn't mind
rgrinberg has quit [Client Quit]
<d_bot> <orbitz> Cool, thank you. I'll look to creating some PRs. Thank you for you your help today
perrierjouet has joined #ocaml
jlrnick has quit [Ping timeout: 252 seconds]
<d_bot> <hegz> I'm really loving ocaml as my first functional lang, been trying 99Problems as practice but I'm yet to wrap my head about recursion and TCO properly.
waleee has joined #ocaml
Johann has joined #ocaml
rgrinberg has joined #ocaml
perrierjouet has quit [Quit: WeeChat 3.4]
jonasbits_ has quit [Ping timeout: 240 seconds]
jonasbits has joined #ocaml
dh` has quit [Ping timeout: 240 seconds]
perrierjouet has joined #ocaml
mro has quit [Quit: Leaving...]
random-jellyfish has joined #ocaml
random-jellyfish has quit [Ping timeout: 256 seconds]
perrierjouet has quit [Quit: WeeChat 3.4]
Haudegen has quit [Ping timeout: 240 seconds]