<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>
<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> 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 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]