companion_cube changed the topic of #ocaml to: Discussion about the OCaml programming language | http://www.ocaml.org | OCaml 5.0 released(!!1!): https://ocaml.org/releases/5.0.0.html | Try OCaml in your browser: https://try.ocamlpro.com | Public channel logs at https://libera.irclog.whitequark.org/ocaml/
olle has quit [Ping timeout: 246 seconds]
Tuplanolla has quit [Quit: Leaving.]
szkl has joined #ocaml
grobe0ba has quit [Quit: ZNC 1.8.2 - https://znc.in]
grobe0ba has joined #ocaml
grobe0ba has quit [Ping timeout: 264 seconds]
grobe0ba has joined #ocaml
John_Ivan has quit [Remote host closed the connection]
rf has quit [Quit: Leaving]
John_Ivan has joined #ocaml
riverdc has quit [Quit: quitting]
riverdc has joined #ocaml
waleee has quit [Ping timeout: 264 seconds]
Everything has joined #ocaml
gwizon has quit [Quit: Lost terminal]
chrisz has quit [Ping timeout: 268 seconds]
chrisz has joined #ocaml
m5zs7k has quit [Ping timeout: 268 seconds]
m5zs7k has joined #ocaml
m5zs7k has quit [Ping timeout: 260 seconds]
mbuf has joined #ocaml
m5zs7k has joined #ocaml
m5zs7k has quit [Ping timeout: 256 seconds]
m5zs7k has joined #ocaml
trev has joined #ocaml
azimut has quit [Ping timeout: 255 seconds]
Haudegen has joined #ocaml
bartholin has joined #ocaml
bgs has quit [Remote host closed the connection]
cedric has joined #ocaml
Serpent7776 has joined #ocaml
bartholin has quit [Quit: Leaving]
xgqt has quit [Read error: Connection reset by peer]
xgqt has joined #ocaml
cedric has quit [Quit: Konversation terminated!]
kakadu has quit [Remote host closed the connection]
olle has joined #ocaml
wagle has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
wagle has joined #ocaml
spip has joined #ocaml
kakadu has joined #ocaml
kakadu has quit [Remote host closed the connection]
kakadu has joined #ocaml
wingsorc has quit [Ping timeout: 246 seconds]
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
<discocaml_> <darrenldl> wew antron is back!
chrisz has quit [Ping timeout: 268 seconds]
chrisz has joined #ocaml
theblatte has quit [Ping timeout: 268 seconds]
theblatte has joined #ocaml
gahr has quit [Read error: Connection reset by peer]
gahr has joined #ocaml
kakadu has quit [Ping timeout: 260 seconds]
kakadu_ has joined #ocaml
ansiwen_ has joined #ocaml
<companion_cube> Woooot
wagle has quit [*.net *.split]
hannes has quit [*.net *.split]
sim642 has quit [*.net *.split]
energizer has quit [*.net *.split]
daimrod has quit [*.net *.split]
jsoo_ has quit [*.net *.split]
dinosaure2 has quit [*.net *.split]
ks_ has quit [*.net *.split]
discocaml_ has quit [*.net *.split]
haesbaert has quit [*.net *.split]
lobo has quit [*.net *.split]
oisota has quit [*.net *.split]
ebb has quit [*.net *.split]
ralu1 has quit [*.net *.split]
ansiwen has quit [*.net *.split]
nore has quit [*.net *.split]
hexology has quit [*.net *.split]
hexology has joined #ocaml
energizer has joined #ocaml
lobo has joined #ocaml
wagle has joined #ocaml
sim642 has joined #ocaml
haesbaert has joined #ocaml
daimrod has joined #ocaml
oisota has joined #ocaml
hannes has joined #ocaml
jsoo_ has joined #ocaml
dinosaure2 has joined #ocaml
discocaml_ has joined #ocaml
ks_ has joined #ocaml
ralu1 has joined #ocaml
nore has joined #ocaml
ebb has joined #ocaml
discocaml_ has quit [Excess Flood]
discocaml has joined #ocaml
hackinghorn has joined #ocaml
hackinghorn has quit [Remote host closed the connection]
hackinghorn has joined #ocaml
hackinghorn has quit [Remote host closed the connection]
hackinghorn has joined #ocaml
hackinghorn has quit [Remote host closed the connection]
hackinghorn has joined #ocaml
hackinghorn has quit [Remote host closed the connection]
hackinghorn has joined #ocaml
hackinghorn has quit [Remote host closed the connection]
Haudegen has quit [Quit: Bin weg.]
hackinghorn has joined #ocaml
<discocaml> <undu> time to dance! It's so good to know he's back
rak_ is now known as rak
Haudegen has joined #ocaml
waleee has joined #ocaml
trillion_exabyte has quit [Ping timeout: 252 seconds]
trillion_exabyte has joined #ocaml
azimut has joined #ocaml
rf has joined #ocaml
waleee has quit [Ping timeout: 248 seconds]
Everything has quit [Quit: leaving]
gentauro has quit [Read error: Connection reset by peer]
gentauro has joined #ocaml
kakadu_ has quit [Remote host closed the connection]
<technomancy> so it seems like `let () = foo bar in` and semicolons are roughly interchangeable; is there a tl;dr about when each should be preferred? like it seems semicolons don't work in certain circumstances (inside an `if`?) but is there a more general rule of thumb?
<discocaml> <psychokitty> they can work inside `if`s, it's just you need to wrap with parens (or begin ... end, which is sugar for parens)
<technomancy> it does seem like half my problems with ocaml come down to "rub some more parens on it"
<technomancy> I guess the problem is that the precedence of ; is not as strong as expected?
<technomancy> unfortunately I have a lot of things in my brain and there is not enough room in it for silly things like a table of operator precedence rules, so parens it is
<companion_cube> yeah there's a wee bit of a strange interplay between `;` and if
<companion_cube> I use () as if they were {} braces
<companion_cube> and then I let ocamlformat solve it, these days
<technomancy> the type system does make the problem of operator precedence at least tolerable, unlike some other languages
<technomancy> but you can't go wrong with "just add more parens until the compiler stops complaining"
<technomancy> bulletproof strategy; never let me down yet
<companion_cube> yeah
<octachron> My heuristic is that I use `;` for sequences of many side-effectful operations and `let () = ... in` to have one side-effect in the middle of many definitions.
<companion_cube> I honestly never use `let() = …`
<technomancy> octachron: right; I do that with let+_ in lisps, but you can't apply that rule consistently as it doesn't work inside `if`
<companion_cube> it's ugly and only useful in monadic context
<companion_cube> (because we didn't get `;+` and `;*` 😢)
<discocaml> <psychokitty> I have a situational awareness for most parsing oddities but I recommend relying on the formatter, as per ccube's suggestion. In emacs, if you just tab on lines to auto-indent, it becomes clear there's a syntax error (or, not an error but not what you intend)
Haudegen has quit [Quit: Bin weg.]
hackinghorn has quit [Remote host closed the connection]
hackinghorn has joined #ocaml
<technomancy> ohhh did the |> thing ever get promoted from janest stuff into the language itself?
<discocaml> <leviroth> Which bit? I believe the type checker now treats it as normal function application where it can, but I’m not sure it prevents the allocation of a closure if you care about that.
mbuf has quit [Quit: Leaving]
<companion_cube> technomancy: it was promoted a long time ago! :)
<companion_cube> from F#, I think?
<discocaml> <leviroth> Oh jk, it *does* eliminate allocation.
<technomancy> what's it called, so I can look it up?
<octachron> It is really a normal function application nowadays (at least whenever `|>` is bound to a compiler primitive with the right type)
<companion_cube> we also have @@ for right-associative application
<companion_cube> f @@ g @@ h x
olle has quit [Ping timeout: 256 seconds]
<octachron> Reverse application operator/pipe operator, and it is here since 4.01 according to https://v2.ocaml.org/api/Stdlib.html#VAL(|%3E)
<technomancy> octachron: sweet; thanks
<companion_cube> 4.01… woah
<companion_cube> and it became builtin in 4.02? 4.03? I don't remember
<discocaml> <cemerick> heh, hi technomancy 👋
<technomancy> wait |> and @@ are the exact same thing with opposite associativity?
<technomancy> whyyyyyy
<technomancy> cemerick: ohai, long time no see
<discocaml> <NULL> No, the argument order is reversed between those
<discocaml> <NULL> `x |> f` is `f @@ x` is `f x`
<technomancy> ok but they're like ... opposites of each other, but they are named such that they look completely unrelated
<companion_cube> ah well, it's related to the parser's limitations
<companion_cube> left-assoc/right-assoc is determined based on the first char
<technomancy> lmao
<technomancy> I guess not every language gets to be a lisp
<companion_cube> 🤷
<companion_cube> there aren't any widespread typed lisps yet, I'm still not sure what that'd look like
<discocaml> <cemerick> @@ is haskell's $, if that helps contextualize things
<companion_cube> (with a ML like semantics I mean)
<technomancy> companion_cube: I'd settle for a widespread lisp of any kind first =)
<technomancy> cemerick: https://hey.hagelb.org/@technomancy/statuses/01GT5ZX56WX13V04DVWTYVDS8A if you're wondering what I'm doing in this channel =)
<discocaml> <cemerick> Seems fun!
<discocaml> <cemerick> in my vanity, I thought perhaps you were touring around instigated by my "clojurists are converging on OCaml" trolling from last week 😈
<technomancy> hehe
<technomancy> cemerick: did you ever use grenchman?
<discocaml> <cemerick> I did not; I was always just in whatever resident REPL I had humming
<discocaml> <cemerick> I never got invested in the start-clojure-fast party, starting with e.g. nailgun IIRC
<technomancy> yeah, I had fun writing it but I didn't actually end up using it much
<technomancy> but that was my prior ocaml experience; 2013 and based on the Real World OCaml book
<technomancy> I found out they were using it at circleCI for "behind the firewall" customers to help debugging server issues years after I stopped working on it
<discocaml> <cemerick> ah, I don't think it registered with me that grenchman was written in OCaml
Tuplanolla has joined #ocaml
<technomancy> when I was doing clojure exclusively, it felt like such a perfect complement; good at everything clojure is bad at and bad at everything clojure's good at =)
<technomancy> cemerick: are you using ocaml for pdf indexing stuff?
olle has joined #ocaml
<discocaml> <cemerick> technomancy: pdf stuff, yes, but "indexing" doesn't really capture it. I used it to implement pdfQL, useful for extracting structured data from documents https://www.pdfdata.com
<discocaml> <cemerick> (In private "production" since autumn; theoretically I'll have it opened up with proper documentation of the language and such in the next month or so.)
<discocaml> <cemerick> But yeah, implementing that, and then all of the service bits around it
<discocaml> <cemerick> almost full stack OCaml, as it were
<discocaml> <cemerick> (Can't wait to nuke that landing page / marketing site from orbit. 🤢 )
<technomancy> awesome; must feel good to replace all that decades-old stuff
<technomancy> or wait, no this is different from the old java product, not a replacement?
Haudegen has joined #ocaml
dnh has joined #ocaml
<discocaml> <cemerick> technomancy: yeah, completely different; the java/.net library business is separate
<discocaml> <cemerick> selling actual software these days is the pits lolsob
<technomancy> that's the price of not having to play the tech startup VC dance I guess
<technomancy> or at least that's one way to escape that hellscape
azimut_ has joined #ocaml
azimut has quit [Ping timeout: 255 seconds]
waleee has joined #ocaml
azimut_ has quit [Ping timeout: 255 seconds]
azimut has joined #ocaml
dnh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dnh has joined #ocaml
mal`` has quit [Quit: Leaving]
dnh has quit [Ping timeout: 264 seconds]
<discocaml> <cemerick> you mean selling software?
<discocaml> <cemerick> that's definitely *not* the best way to avoid that scene, believe me 😅
mal`` has joined #ocaml
rak has left #ocaml [#ocaml]
<technomancy> well, you get some ability to call your own shots but yeah, obviously still limited
<technomancy> like you could just ... choose to not use jira
<technomancy> which seems like an unattainable dream to me
trillion_exabyte has quit [Ping timeout: 268 seconds]
trillion_exabyte has joined #ocaml
trev has quit [Remote host closed the connection]
trev has joined #ocaml
dhil has joined #ocaml
hackinghorn has quit [Remote host closed the connection]
hackinghorn has joined #ocaml
hackinghorn has quit [Remote host closed the connection]
hackinghorn has joined #ocaml
hackinghorn has quit [Remote host closed the connection]
hackinghorn has joined #ocaml
hackinghorn has quit [Remote host closed the connection]
hackinghorn has joined #ocaml
hackinghorn has quit [Remote host closed the connection]
<discocaml> <cemerick> How'd jira get involved?
hackinghorn has joined #ocaml
<technomancy> oh, just an example of some of the worst things I'm stuck using because I work at a startup that I would never use willingly
hackinghorn has quit [Remote host closed the connection]
hackinghorn has joined #ocaml
bartholin has joined #ocaml
<discocaml> <cemerick> heh, just imagine what you could be forced to use at an insurance company or whatever
<discocaml> <lagarto> I've been writing some code with "threaded state" through all the calls (I don't know if this is the right term---basically it's manually doing a State monad). I'm wondering if anyone knows of some well-written example ocaml code that does this idiomatically, so I can make sure I'm not doing anything too unusual. (I looked at the ocaml compiler to try to find some examples but it looked like it is almost all done with mutable state, and the
<companion_cube> I'd just pass a mutable record along, yeah
<discocaml> <cemerick> sounds like using a real state monad would make most things clearer
<discocaml> <lagarto> oh, does that exist in ocaml?
<companion_cube> for me, if the state is vanilla, a state monad is just burdensome
<companion_cube> (if you need backtracking or other weird state effects, ok, why not)
hackinghorn has quit [Ping timeout: 268 seconds]
<discocaml> <lagarto> yeah honestly this seems better than times I've tried doing it with e.g. the State monad in haskell
dhil has quit [Ping timeout: 255 seconds]
<discocaml> <lagarto> I just have a lot of code (it is a backtracking parser btw) like:
<discocaml> <lagarto> ```
<discocaml> <lagarto> let state = do_the_foos state in
<discocaml> <lagarto> let state, something = multi_return_case state in
<discocaml> <lagarto> let state = finish_up state in
<discocaml> <lagarto> state
<discocaml> <lagarto> ```
<discocaml> <lagarto> (I might try to come up with a shorter name than "state" but this seems pretty reasonable?)
<discocaml> <lagarto> (for arbitrary backtracking it's nice that I can just keep a previous state pointer at any point in the code ...)
<discocaml> <cemerick> sure, there are a bunch of monadic libraries
<discocaml> <cemerick> there are of course basic ones about like Option and Result
<discocaml> <lagarto> I guess honestly the backtracking is constrained enough that maybe I should just keep N tokens in a record with some mutables (Like I'd do in C) .. Hm. Maybe it'd be faster due to allocating less too
<discocaml> <cemerick> I like using the `monads` package for more sophisticated stuff, http://binaryanalysisplatform.github.io/bap/api/master/monads/Monads/Std/index.html
<discocaml> <lagarto> cool thanks @cemerick; I will look at that (I am inclined to avoid library dependencies in my project but it'll also be nice to see how people are doing monads in ocaml)
<companion_cube> yeah parser combinators are a place where monads (and applicatives) are def worth it
<discocaml> <lagarto> I'd still like to see any good example real world code in that pure style if someone knows of some though, btw. (Thanks both of y'all for the help either way, though)
<companion_cube> https://github.com/c-cube/ocaml-containers/blob/master/src/core/CCParse.ml#L172-L175 my own little parser combinators with a pure state passed through continuations
<discocaml> <lagarto> Nice; thanks cube
Stumpfenstiel has joined #ocaml
oriba has joined #ocaml
dhil has joined #ocaml
dhil has quit [Ping timeout: 260 seconds]
trev has quit [Remote host closed the connection]
omegatron has joined #ocaml
olle has quit [Ping timeout: 264 seconds]
kurfen has quit [Ping timeout: 252 seconds]
Haudegen has quit [Quit: No Ping reply in 180 seconds.]
Haudegen has joined #ocaml
azimut has quit [Quit: ZNC - https://znc.in]
azimut has joined #ocaml
bartholin has quit [Quit: Leaving]
gwizon has joined #ocaml
Stumpfenstiel has quit [Ping timeout: 256 seconds]
ski has quit [Quit: Lost terminal]
wingsorc has joined #ocaml
Serpent7776 has quit [Ping timeout: 255 seconds]
Haudegen has quit [Ping timeout: 255 seconds]