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/
<dh`> in general parser combinators are terrible
<dmbaturin> Yeah, I'm not a fan.
<dh`> the problem with parser generators and error messages is that yacc is 40-year-old tech by now, ocamlyacc is a slavish clone, and menhir is only slightly more advanced
<dh`> but it's also really hard to get traction with anything different
<dmbaturin> dh`: What approach offers better error reporting?
<dh`> the parser generator knows the state you were in and the unexpected token it saw
<dh`> it is perfectly capable of producing a reasonably coherent error message, it just doesn't because it's not entirely trivial in the generator code and nobody wants to work on it
<dh`> like I said, it's really hard to get traction with anything different
<dmbaturin> Well, .messages is a pretty big step forward.
<dh`> yeah
<dh`> is it documented somewhere?
Soni has quit [Ping timeout: 240 seconds]
<dmbaturin> Menhir's docs could be better... that post I linked above is an attempt to make up for it.
<dmbaturin> Well, they aren't bad, but I'd like to see more examples there.
<dh`> given that it only has to compete with ocamlyacc, whose docs are last I recall pretty much nonexistent... well
<dh`> anyway I'll take a look at that
<dh`> quick scan suggests it's all rather exposed cogs and pulleys
<dh`> :-|
<dmbaturin> dh`: Here's an example of how it's very not perfect with highly ambiguous grammars: https://github.com/dmbaturin/otoml/blob/main/src/lib/toml_parser.messages :)
<dmbaturin> The parser indeed knows the state, but translating it to a coherent message isn't always trivial even for a human.
<dh`> I've had in mind for years a scheme for doing best-fit approximate parses to generate actually good syntax errors
<dh`> but haven't had time to build it uot
<dmbaturin> I'd be very curious to try it out.
<dh`> right, part of the problem is that parser generators are slaves to their automata models and it doesn't occur to the people writing them to break out of that model when it would be useful
<companion_cube> What would that mean?
<dh`> one fairly obvious possibility: inspecting extra lookahead tokens after reaching an error state
<dh`> or disambiguating what rule you're actually in by looking at the stack
<companion_cube> Hmm the second one seems unclear to me, unless you mean the user could do that
<dh`> the generated code could
Haudegen has quit [Ping timeout: 240 seconds]
<companion_cube> By definition if it's ambiguous, it means the stack doesn't help :D
<dh`> well, if the grammar itself is ambiguous it should be rejected :-)
spip has joined #ocaml
<companion_cube> Ah, yes, conflating two issues.
<dh`> the issue I think we were talking about is when you have a token sequence that can mean X or Y and you accidentally write something that causes the parser to proceed on Y even though you meant an X
bobo_ has quit [Ping timeout: 256 seconds]
<companion_cube> I think the main menhir authors have been working towards better error recovery, but it's just hard
<dh`> and so you get an error like "missing semicolon after Y" when you don't even have a Y
<dh`> oh, it's definitely hard
Soni has joined #ocaml
<dh`> ...at least compared to deterministically grinding rulesets into automata
<dh`> why does the menhir incremental interface expose its internal state?
Tuplanolla has quit [Quit: Leaving.]
<dh`> surely it should just be f: parserstate -> token -> result where result = Done of value | Error of error-info | Ok of parserstate
<dh`> that is, you shouldn't need to do anything other than feed it tokens until it either finishes or complains
Everything has quit [Quit: leaving]
<b0o> dmbaturin: is there an efficient way to do it without mutability?
szkl has joined #ocaml
<d_bot> <crab> Does ocaml have native data science and ml libraries?
oriba has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
<hackinghorn> there is ml in Ocaml, its the last 2 letters
<d_bot> <NULL> I imagine it's not the L user expected
zebrag has joined #ocaml
spip has quit [Ping timeout: 240 seconds]
spip has joined #ocaml
pieguy128 has quit [Ping timeout: 256 seconds]
<d_bot> <hcarty> @creativcoder There are some building blocks in place. Not to the extent you have in Python for example. Owl is probably the most complete
<d_bot> <hcarty> https://ocaml.xyz/ is the project's main site if you want to check it out
pieguy128 has joined #ocaml
<d_bot> <Fermion> I don't know if it's blastphemy to say such things but f# might satisfy your ML needs and I think the .net ecosystem has a pretty serious collection of machine learning/data science libraries
jochensp has quit [Ping timeout: 250 seconds]
jochensp has joined #ocaml
pieguy128 has quit [Ping timeout: 240 seconds]
pieguy128 has joined #ocaml
waleee has quit [Ping timeout: 256 seconds]
<d_bot> <crab> I would honestly use f# instead for data science and ml, but I was wondering if ocaml had some support
<d_bot> <crab> Honestly, for me I would use ocaml for lang dev
chrisz has quit [Ping timeout: 240 seconds]
chrisz has joined #ocaml
<d_bot> <rawburt> in what sense?
rgrinberg has joined #ocaml
perrierjouet has quit [Quit: WeeChat 3.4]
tizoc has quit [Quit: Coyote finally caught me]
tizoc has joined #ocaml
mbuf has joined #ocaml
nefarious has joined #ocaml
<nefarious> How do I learn all about the OCaml type system? I want to start working on some of the OCaml type system development work.
<companion_cube> there's papers and PhD theses, mostly
<nefarious> Ahh... no softer introduction?
<nefarious> Not a fan of sifting through dense mathematics
<companion_cube> honestly, I'm afraid that digging into the type system requires some mathematics
<nefarious> I agree, but not the mathematics they put in PhD theses :)
hackinghorn has quit [Quit: Leaving]
<companion_cube> true, true.
<companion_cube> skme more recent aspects like GADTs are probably quite hairy though.
<nefarious> Ok, anyways, well what are those papers and theses then... if I must
<companion_cube> I do wonder why there isn't a nice "bibliography" page on the website (cc octachron? :3)
<nefarious> Ahh I just want to work on type systems
<nefarious> I asked some Haskell folk and it was even worse over there
<companion_cube> https://caml.inria.fr/pub/papers/ ah !!!!
<companion_cube> !biblio = https://caml.inria.fr/pub/papers/
<ocabot> Success
<nefarious> Oh boy
<companion_cube> the last one seems cool, hadn't opened it in a while
<nefarious> We should get a reading group going
<companion_cube> the Zinc machine
<companion_cube> (that's Caml/OCaml in the late 90s I think)
<nefarious> Amazing
<companion_cube> oops, 02/1990
<companion_cube> early nineties :D
<companion_cube> so for example https://caml.inria.fr/pub/papers/garrigue_remy-poly-ic99.pdf might be important for "modern" OCaml
<companion_cube> explains how to mix classic ML polymorphism, with explicit type annotations that are often required with, say, GADTs
nefarious has quit [Quit: Client closed]
<d_bot> <monk> nice
bobo_ has joined #ocaml
spip has quit [Ping timeout: 256 seconds]
Haudegen has joined #ocaml
zebrag has quit [Quit: Konversation terminated!]
<d_bot> <PureFunctor> Does anyone know of any https://www.haskell.org/arrows/ -like libraries for OCaml?
gravicappa has joined #ocaml
gravicappa has quit [Ping timeout: 256 seconds]
<d_bot> <darrenldl> @rawburt (i dont think irc users see which message you're replying to)
<d_bot> <darrenldl>
<d_bot> <darrenldl> but im guessing some if what dh meant was some things are more difficult without a lexing stage
<d_bot> <darrenldl> and you dont get static analysis (as a compilation step) on whether your parser has conflicts etc
<d_bot> <darrenldl> parsing things like comments will require you to essentially do a text replace pass before feeding into a constructed parser in combinator world
jochensp has left #ocaml [WeeChat 3.4]
rgrinberg has quit [Ping timeout: 250 seconds]
Serpent7776 has quit [Read error: Connection reset by peer]
Serpent7776 has joined #ocaml
rgrinberg has joined #ocaml
azimut_ has joined #ocaml
azimut has quit [Ping timeout: 276 seconds]
biog has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<LACampbell> where is everyone here chatting if not IRC?
mro has joined #ocaml
<zozozo> LACampbell: the IRC channel is bridged with a discord channel (through d_bot on the irc side)
jlrnick has joined #ocaml
bobo_ has quit [Ping timeout: 240 seconds]
bobo_ has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
spip has joined #ocaml
bobo_ has quit [Ping timeout: 256 seconds]
<d_bot> <Inst> why are all the bot relays cats?
<d_bot> <NULL> Why not I guess, it's a way to have different images for every user
bobo_ has joined #ocaml
spip has quit [Ping timeout: 256 seconds]
mro has quit [Remote host closed the connection]
mro has joined #ocaml
olle has joined #ocaml
<d_bot> <Alistair> Bonsai uses ppx let to implement something like Yallops arrow calculus, which is similar
biog has quit [Ping timeout: 240 seconds]
bartholin has joined #ocaml
salkin has joined #ocaml
salkin has quit [Ping timeout: 256 seconds]
kakadu has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
mro has quit [Remote host closed the connection]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
gravicappa has joined #ocaml
mro has joined #ocaml
mro has quit [Remote host closed the connection]
spip has joined #ocaml
bobo_ has quit [Ping timeout: 256 seconds]
perrierjouet has joined #ocaml
romildo has joined #ocaml
<romildo> When building irmin on NixOS I am getting some type errors:
<romildo> File "src/irmin/commit.ml", line 493, characters 19-37:
<romildo> 493 | let n, v = decode_bin buf off in
<romildo> ^^^^^^^^^^^^^^^^^^
<romildo> Error: This expression has type string but an expression was expected of type
<romildo> 'a * 'b
<romildo> I have tried the 3 latest versions of irmin.
<romildo> I have also tried with ocaml 4.8, 4.9, 4.10, 4.11, 4.12 e 4.13.
<romildo> Any clues?
Haudegen has joined #ocaml
salkin has joined #ocaml
hackinghorn has joined #ocaml
xenu_ has joined #ocaml
xenu has quit [Read error: Connection reset by peer]
romildo has quit [Quit: Leaving]
hackinghorn has quit [Remote host closed the connection]
hackinghorn has joined #ocaml
xenu_ is now known as xenu
mro has joined #ocaml
<kakadu> you should check in which library function decode_bin is declared.
spip has quit [Quit: Konversation terminated!]
spip has joined #ocaml
xiongxin has joined #ocaml
perrierjouet has quit [Quit: WeeChat 3.4]
perrierjouet has joined #ocaml
xenu has quit [Read error: Connection reset by peer]
xenu has joined #ocaml
perrierjouet has quit [Quit: WeeChat 3.4]
wyrd has quit [Ping timeout: 276 seconds]
xiongxin has quit [Ping timeout: 250 seconds]
xiongxin1 has joined #ocaml
mro has quit [Remote host closed the connection]
salkin has quit [Ping timeout: 240 seconds]
perrierjouet has joined #ocaml
xiongxin1 is now known as xiongxin
wyrd has joined #ocaml
mro has joined #ocaml
mro has quit [Ping timeout: 240 seconds]
<dmbaturin> You should also use a paste service like bpaste.net :)
biog has joined #ocaml
<hackinghorn> hi, what are these [@@ ] and [@@@ ] I'm seeing?
<zozozo> hackinghorn: these are attributes, see https://ocaml.org/manual/attributes.html
<hackinghorn> ahh thankss
mro has joined #ocaml
mro has quit [Remote host closed the connection]
<d_bot> <rawburt> ah didn't realize this was synced with IRC. thanks for your reply 🙂 that makes sense
xiongxin has quit [Remote host closed the connection]
salkin has joined #ocaml
mro has joined #ocaml
salkin 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
rgrinberg has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
Haudegen has quit [Quit: Bin weg.]
perrierjouet has quit [Quit: WeeChat 3.4]
perrierjouet has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
perrierjouet has quit [Quit: WeeChat 3.4]
perrierjouet has joined #ocaml
bartholin has quit [Quit: Leaving]
megeve has joined #ocaml
dalek-caan has joined #ocaml
kaph has joined #ocaml
<hannes> earlier (4.05) OCaml systems worked with a brief patch to configure on FreeBSD/armv7 devices (32 bit) (patch: https://github.com/freebsd/freebsd-ports/blob/main/lang/ocaml/files/patch-configure -- relevant part is line 43), newer ocaml compilers (4.12.1) now fail to compile on armv7 and FreeBSD -- https://bz-attachments.freebsd.org/attachment.cgi?id=231087 (with the patch at
<hannes> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=231075) -- any clues how to deal with that (nowadays, it looks like TARGET_armv7 and MODEL_armv7 is used, but that leads to no definition of Saved_return_address and Callback_link in runtime/stack.h)
<hannes> so, how would one push a TARGET_arm through the autoconf layer? how does this work on e.g. a GNU/Linux system?
<hannes> (in runtime/Makefile I see OC_NTAIVE_CPPFLAGS= -DNATIVE_CODE -DTARGET_$(ARCH) -- and ARCH should be arm -- but somehow it is armv7!? (unfortunately I don't have a armv7 FreeBSD system to conduct testing)
olle has quit [Ping timeout: 250 seconds]
Tuplanolla has joined #ocaml
rgrinberg has joined #ocaml
Anarchos has joined #ocaml
<Anarchos> i have a Unix.read on a socket which is blocked, but netstat show that the sender (netcat) has a Send-Q at 32768. I don't know how to investigate why the read call doesn't eat the 32768 bytes ?
<d_bot> <NULL> I can't find a way to add a `[@warning "-8"]` in a monadic `let*` binding. Am I missing something ?
Haudegen has joined #ocaml
zebrag has joined #ocaml
mbuf has quit [Quit: Leaving]
Anarchos has quit [Quit: Vision[]: i've been blurred!]
salkin has joined #ocaml
perrierjouet has quit [Quit: WeeChat 3.4]
perrierjouet has joined #ocaml
kaph has quit [Ping timeout: 256 seconds]
jlrnick has quit [Ping timeout: 240 seconds]
gwizon has joined #ocaml
kaph has joined #ocaml
dalek-caan has quit [Quit: dalek-caan]
gwizon has quit [Remote host closed the connection]
mro has joined #ocaml
waleee has joined #ocaml
gravicappa has quit [Ping timeout: 250 seconds]
azimut_ has quit [Remote host closed the connection]
azimut has joined #ocaml
zebrag has quit [Ping timeout: 250 seconds]
salkin has quit [Ping timeout: 256 seconds]
zebrag has joined #ocaml
rustyne has left #ocaml [#ocaml]
perrierjouet has quit [Quit: WeeChat 3.4]
perrierjouet has joined #ocaml
mro has quit [Quit: Leaving...]
cedric has joined #ocaml
pippijn has quit [Ping timeout: 245 seconds]
waleee has quit [Ping timeout: 250 seconds]
perrierjouet has quit [Quit: WeeChat 3.4]
perrierjouet has joined #ocaml
nfc_ has quit [Ping timeout: 240 seconds]
pippijn has joined #ocaml
pippijn has quit [Client Quit]
pippijn has joined #ocaml
Everything has joined #ocaml
perrierjouet has quit [Quit: WeeChat 3.4]
perrierjouet has joined #ocaml
nfc_ has joined #ocaml
cedric has quit [Quit: Konversation terminated!]
wyrd has quit [Remote host closed the connection]
wyrd has joined #ocaml
kakadu has quit [Remote host closed the connection]
kakadu has joined #ocaml
Tuplanolla has quit [Quit: Leaving.]
Haudegen has quit [Ping timeout: 250 seconds]
waleee has joined #ocaml