companion_cube changed the topic of #ocaml to: Discussion about the OCaml programming language | http://www.ocaml.org | OCaml 5.2.0 released: https://ocaml.org/releases/5.2.0 | Try OCaml in your browser: https://try.ocamlpro.com | Public channel logs at https://libera.irclog.whitequark.org/ocaml/
chiselfuse has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
omniscient has joined #ocaml
omniscient has quit [Ping timeout: 252 seconds]
terrorjack has quit [Quit: The Lounge - https://thelounge.chat]
terrorjack has joined #ocaml
omniscient has joined #ocaml
omniscient has quit [Ping timeout: 276 seconds]
omniscient has joined #ocaml
omniscient has quit [Ping timeout: 265 seconds]
omniscient has joined #ocaml
omniscient has quit [Remote host closed the connection]
m5zs7k has quit [Ping timeout: 244 seconds]
wbooze has quit [Quit: Leaving]
m5zs7k has joined #ocaml
bartholin has joined #ocaml
Serpent7776 has joined #ocaml
olle has joined #ocaml
wbooze has joined #ocaml
Haudegen has joined #ocaml
bartholin has quit [Quit: Leaving]
wbooze has quit [Quit: Leaving]
hannes_ is now known as hannes
wbooze has joined #ocaml
wbooze has quit [Max SendQ exceeded]
wbooze has joined #ocaml
wbooze has quit [Max SendQ exceeded]
wbooze has joined #ocaml
sailorCat has quit [Ping timeout: 244 seconds]
dhil has joined #ocaml
wbooze has quit [Quit: Leaving]
sailorCat has joined #ocaml
wbooze has joined #ocaml
sailorCa- has joined #ocaml
sailorCat has quit [Ping timeout: 252 seconds]
bcksl has quit [Ping timeout: 260 seconds]
end has quit [Ping timeout: 260 seconds]
<discocaml> <julin9340> I was looking at a tutorial on the usage of the cmdliner package.
<discocaml> <julin9340>
<discocaml> <julin9340> It mentions something called `let+` which looks like a form of `let`.
<discocaml> <julin9340> How is it different from the normal `let`?
<discocaml> <julin9340> Is this something specific to cmdliner or usable in all OCaml?
<discocaml> <julin9340> Maybe something that is taken care of by a ppx?
<discocaml> <julin9340> It says cmdliner uses a 'special syntax'
<discocaml> <julin9340> for writing its terms in a less error prone manner
<discocaml> <aghilas_> it's something redefinable, see https://ocaml.org/manual/5.2/bindingops.html
<discocaml> <._null._> Do you know about custom binding operators and the monadic `let*` ?
<discocaml> <._null._> See https://ocaml.org/manual/bindingops.html
<discocaml> <julin9340> It's new to me. Thanks, let me read that.
bcksl has joined #ocaml
olle has quit [Ping timeout: 252 seconds]
end has joined #ocaml
Absalom has joined #ocaml
<discocaml> <froyo> the short of it is `let+ x = xs in f x` is expected to correspond to `map (fun x -> f x) xs`
<discocaml> <julin9340> For cmdliner 1.3, the example mention a function `Cmd.make`.
<discocaml> <julin9340>
<discocaml> <julin9340> But it's not there in docs?
<discocaml> <julin9340>
<discocaml> <julin9340> I couldn't use it.
<discocaml> <julin9340>
<discocaml> <julin9340> Am I missing something?
<discocaml> <aghilas_> it's weird because it's in these docs https://erratique.ch/software/cmdliner/doc/Cmdliner/Cmd/index.html
<discocaml> <aghilas_> it's weird because it's in these docs https://erratique.ch/software/cmdliner/doc/Cmdliner/Cmd/index.html#val-make
<discocaml> <aghilas_> it appears that the cmdliner.mli file in https://erratique.ch/software/cmdliner/releases/cmdliner-1.3.0.tbz (which is the source used by opam) doesn't contain the make function, the last release being nearly a year ago, it's just an issue with the opam version being outdated
<discocaml> <dubious245> Does anyone know of a good or simple implementation of Hindley Milner type inference in action? Particularly the Unification Part, how are its inputs being encoded and how does it encode its substitutions.
<discocaml> <julin9340> Oh..
<discocaml> <julin9340> I guess they missed updating.
<discocaml> <julin9340> Maybe I can open github issue.
<discocaml> <aghilas_> this describes how it's done in ocaml https://okmij.org/ftp/ML/generalization.html
euphores has quit [Ping timeout: 252 seconds]
<discocaml> <julin9340> Got a response on the github issue saying that the docs were for the yet-to-be released dev version and that we can use `Cmd.v` instead of `Cmd.make`.
euphores has joined #ocaml
wickedshell has quit [Ping timeout: 276 seconds]
Haudegen has quit [Quit: Bin weg.]
gentauro has joined #ocaml
gentauro has quit [Ping timeout: 252 seconds]
tomku has quit [Ping timeout: 244 seconds]
tomku has joined #ocaml
<discocaml> <contificate> Usually, the unification's substitutions are done eagerly and destructively: the type representation encodes a union-find forest - the linked resource by Oleg is simple to understand (`sound_eager.ml`) but you can find the same explained in a few books (Le Langage Caml, The Functional Approach to Programming, Compilers: Principles, Techniques, and Tools) - but it's also provided as part of sample code for the paper "Modular Modules" etc.
Haudegen has joined #ocaml
<discocaml> <contificate> Milner's original paper is very readable, but leaves the destructive unify part unspecified - in practice, it's union-find
<discocaml> <dubious245> I get the basic theory of how it operates (and there are usually an abundance of resources talking about that) but I like to see implementations with the the actual types of their inputs and output. It helps me grasp how to actually do it, one of the reasons I like statically typed systems. If I know the shape of the inputs and outputs I can generally implement the algorithm from the theory, maybe not the most efficient implementation but a
<discocaml> <contificate> then just read `sound_eager.ml`
<discocaml> <contificate> learning HM first is usually a bad start, I find
<discocaml> <contificate> as it conflates like learning 3 things
<discocaml> <contificate> whereas, if you just implement STLC with destructive substitutions, adding let-generalisation isn't very complicated - then, sound generalisation with levels is easily motivated from the naive approach (scanning the type environment)
<discocaml> <dubious245> Do you know of a implementation of STLC(I am assuming this is simply typed lambda calculus) with destructive substitutions then?
<discocaml> <contificate> can extract it out from sound_eager.ml
<discocaml> <contificate> the main difference is that you'd have no generalisation at all, as famously you don't generalise lambda binders
<discocaml> <contificate> so it comes down to handling the only interesting rule
<discocaml> <contificate> which is the rule for application
<discocaml> <contificate> which amounts to like: `App(f, x) -> f_ty = infer env f; x_ty = infer env x; r_ty = fresh_tvar (); unify f_ty (Arrow (x_ty, r_ty)); return r_ty`
<discocaml> <contificate> if you can read typing rules, you can see how this ensures the important properties
<discocaml> <contificate> mainly that `f x` must infer `f` to be an arrow type and, `x`'s type must be compatible with the domain of `f`, and the return type can just be unified out (the codomain of `f`)
wickedshell has joined #ocaml
<theblatte> once again, linking issues are causing despair. I'm trying to convince dune's inline_tests to link with -noautolink but this doesn't actually run the tests ("You are doing something unexpected with the tests. No tests have been run.")
<theblatte> I'm using the same form (inline_tests (executable (link_flags -linkall -noautolink <tons of link flags>))) as the manual: https://dune.readthedocs.io/en/latest/tests.html#changing-the-flags-of-the-linking-step-of-the-test-runner
<theblatte> I guess there's a secret library I need to include in my link flags but I don't know what it is. Or maybe something else. Is there a way to see what libraries get pulled in by autolink?
<discocaml> <otini_> make sure that -linkall is passed because otherwise only the modules actually used are linked, which often means none
<discocaml> <otini_> "autolink" doesn’t pull anything, -noautolink just means that flags hardcoded in the .cm[x]a files are ignored. You can run `dune --verbose` to see the invoked command line. With `-linkall` all the object files and libraries passed to the compiler should be linked in.
<theblatte> thanks, -linkall is passed to the ocamlopt command that builds the exe. with -noautolink, no tests are run, but without -noautolink the tests run normally (I think: no error message). The ocamlopt command in _build/log is the same besides -noautolink
<theblatte> is there a way to see these link flags in the .cmxa?
<discocaml> <otini_> try running ocamlobjinfo on it?
<theblatte> right, nice!
<discocaml> <otini_> you can also pass `-verbose` to the linking step `(link_flags (:standard -verbose))` to see the actual linker invocations and find out the difference
<theblatte> perfect!
<theblatte> ish
<discocaml> <otini_> 😄
<theblatte> -linkall -noautolink working woud be perfect without "ish" ;)
<theblatte> found the fucker: -cclib -lppx_inline_test_runner_lib_stubs :')
<discocaml> <otini_> makes sense
<discocaml> <otini_> strange that it silently failed to run the tests
<theblatte> the dune docs could do a better job of providing a stanza that works
<theblatte> thanks, otini_!
<theblatte> my hatred of linkers is renewed afresh
<discocaml> <otini_> haha
<discocaml> <otini_> maybe this is worth an issue in the dune docs
<theblatte> otini_: it didn't silently fail! fortunately there's this message that prints when the tests don't run at all that tells you "You are doing something unexpected with the tests. No tests have been run. ..."
<theblatte> to let you know when you messed up your link flags
<discocaml> <otini_> hm, ok. Not very explicit, though
dhil has quit [Ping timeout: 276 seconds]
Haudegen has quit [Quit: Bin weg.]
gentauro has joined #ocaml
Haudegen has joined #ocaml
infinity0 has quit [Quit: WeeChat 4.4.3]
infinity0 has joined #ocaml
infinity0 has quit [Remote host closed the connection]
bartholin has joined #ocaml
dhil has joined #ocaml
zor has quit [Read error: Connection reset by peer]
hannes has quit [Remote host closed the connection]
Tuplanolla has joined #ocaml
bibi_ has quit [Ping timeout: 245 seconds]
Serpent7776 has quit [Ping timeout: 245 seconds]
bibi_ has joined #ocaml
dhil has quit [Ping timeout: 265 seconds]
Tuplanolla has quit [Quit: Leaving.]
Haudegen has quit [Quit: Bin weg.]