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/
h0rror has quit [Read error: Connection reset by peer]
h0rror has joined #ocaml
h0rror has quit [Read error: Connection reset by peer]
<discocaml> <leviroth> There’s also ppx_log to increase the lazy-ness of the allocation if you’re using the async log module
h0rror has joined #ocaml
h0rror has quit [Read error: Connection reset by peer]
h0rror has joined #ocaml
h0rror has quit [Read error: Connection reset by peer]
h0rror has joined #ocaml
<companion_cube> if you're writing a library that logs stuff, _please_ use `Logs` :3
h0rror has quit [Read error: Connection reset by peer]
h0rror has joined #ocaml
spip has quit [Quit: Konversation terminated!]
<discocaml> <mbacarella> nice
<discocaml> <mbacarella> i just write to stderr in that case
<companion_cube> well, if you happen to do more serious logging… ;)
<companion_cube> (also, the cool thing is to use https://erratique.ch/software/logs/doc/Logs/index.html#val-src_log )
<companion_cube> `module Log = (val Logs.src_log your_lib_src)`
<companion_cube> a smart enough reporter can filter on sources, etc.
h0rror has quit [Read error: Connection reset by peer]
h0rror has joined #ocaml
chrisz has quit [Ping timeout: 268 seconds]
h0rror has quit [Read error: Connection reset by peer]
chrisz has joined #ocaml
h0rror has joined #ocaml
leah2 has quit [Ping timeout: 252 seconds]
czy has quit [Remote host closed the connection]
h0rror has quit [Read error: Connection reset by peer]
h0rror has joined #ocaml
h0rror has quit [Read error: Connection reset by peer]
leah2 has joined #ocaml
h0rror has joined #ocaml
h0rror has quit [Read error: Connection reset by peer]
chrisz has quit [Ping timeout: 268 seconds]
h0rror has joined #ocaml
chrisz has joined #ocaml
h0rror has quit [Read error: Connection reset by peer]
pieguy128_ has joined #ocaml
pieguy128 has quit [Ping timeout: 260 seconds]
h0rror has joined #ocaml
h0rror has quit [Read error: Connection reset by peer]
h0rror has joined #ocaml
wingsorc has quit [Remote host closed the connection]
wingsorc has joined #ocaml
h0rror has quit [Read error: Connection reset by peer]
h0rror has joined #ocaml
czy has joined #ocaml
h0rror has quit [Read error: Connection reset by peer]
h0rror has joined #ocaml
Haudegen has joined #ocaml
mbuf has joined #ocaml
famubu has joined #ocaml
<famubu> Hi. I was trying to get started with ocaml in a minimal way. Without extra packages and stuff with emacs as the editor. I don't need an LSP kind of thing. I was kind of used the sml-mode of emacs and would've been happy with something similar for ocaml. Is there such a thing? Does anyone know?
bgs has joined #ocaml
<discocaml> <geoff> tuareg-mode
waleee has quit [Ping timeout: 260 seconds]
<famubu> discocaml: <geoff>: Thanks I installed it.
<famubu> But am having trouble figuring out key bindings.
<famubu> I got this cheatsheet https://www.google.com/url?q=https://ocamlpro.github.io/ocaml-cheat-sheets/tuareg-mode.pdf&sa=U&ved=2ahUKEwjKurvqkKH-AhWfTGwGHZvaAn8QFnoECAEQAg&usg=AOvVaw3BPFYY2mhUIFEkhyHyol_W
<famubu> Dang it..
<famubu> So I had been trying C-c C-s to feed buffer contents to utop.
<famubu> But this key combination only seem to start utop. Updates to the buffer doesn't show up in the utop shell.
<famubu> Any idea what I'm doing wrong?
<famubu> Oh C-x C-e seems to do it.
<famubu> Now I'm trying to figure out how to have history. As in get the last line in utop to show up. Tried M-up M-down. Neither worked..
bgs has quit [Remote host closed the connection]
<jmiven> famubu: have you tried M-p and M-n?
<famubu> Do you know which command it runs? M-p and M-n are mapped to something else in my OS.
<jmiven> utop-history-goto-prev
<famubu> jmiven: That works! Thanks!
<famubu> Tuareg starts complaining about non-exhaustive pattern matching before I finish writing the patterns. It changes the color of the match expression to an annoying color. Is there a way to make tuareg complain only when we explicitly ask it to check the code?
bartholin has joined #ocaml
<famubu> it seem to check for errors whenever we write the buffer to file.
<famubu> I defined a new type in ocaml and a function to compare values of that type was already there. Is this `compare` function automatically generated for all user defined types?
neiluj has joined #ocaml
<neiluj> Hi!
<neiluj> how do you print a string in hexadecimal? like \000\000...
<neiluj> oh, %S worked!
gahr has quit [Quit: leaving]
bartholin has quit [Quit: Leaving]
gahr has joined #ocaml
rwmjones|HOL is now known as rwmjones
<discocaml> <willardthor> Hi all (noob here), I have a package definition file (ending in .opam), and I wish to install it. Which commands do I run? (details: I am trying to install VST (Verified Software Toolchain) via. opam w/o installing the Coq Platform; however, the coq-vst package is no longer available in opam it seems; but the package definition is there, and it points to the VST source)
<discocaml> <willardthor> Hi all (noob here), I have a package definition file (ending in .opam), and I wish to install the package it defines. Which commands do I run? (details: I am trying to install VST (Verified Software Toolchain) via. opam w/o installing the Coq Platform; however, the coq-vst package is no longer available in opam it seems; but the package definition is in the VST Git repository, and it points to the VST source in said repository)
<adrien> I have code like the following: MyInt.(1 + 2) and I get a warning "Warning 44 [open-shadow-identifier]: this open statement shadows ..."; I'm trying to locally disable the warning but I can't find how; is that doable?
spip has joined #ocaml
<octachron> MyInt.( 1 + 2 )[@warning "-44"] or `let[@warning "-44"] ... = ...` work. What did you try?
<adrien> I was trying to put the block somewhere close to ".(" (before, after, in the middle)
<adrien> thanks!
Haudegen has quit [Quit: Bin weg.]
<discocaml> <willardthor> I resolved my problem; I was missing a "opam repo add" command, as outlined here: https://www.cs.princeton.edu/courses/archive/spring21/cos510/sf/vc/Preface.html
wingsorc has quit [Ping timeout: 248 seconds]
Haudegen has joined #ocaml
anpad has quit [Quit: ZNC 1.8.2 - https://znc.in]
anpad has joined #ocaml
<neiluj> hmm
<neiluj> when I display a string the first ascii character seems to be dropped
<neiluj> basically have a function to convert between ascii string and its representation as an hex string: https://bpa.st/J33I4
<neiluj> from my tests if c = (to_hex_string s), then to_hex_string (from_hex_string c) = c
<neiluj> but from_hex_string (to_hex_string s) is equal to s except for the first ascii character
<neiluj> shortened a bit the code https://bpa.st/7ZUCY
<discocaml> <masterbuilder> neiluj: what's the deal with the backslash?
<neiluj> the backslash is for the hex notation
<discocaml> <masterbuilder> I'm wondering if it's causing an escape sequence to be expanded by some function in `from_hex_string`
<discocaml> <masterbuilder> oh okay that makes sense
<neiluj> oh
<neiluj> hmm but the from_hex_functions removes the backslash though
<discocaml> <masterbuilder> Not if it'a expanded before it gets to the filter, then it won't find a backslash
<discocaml> <masterbuilder> s/it'a/it's/
<neiluj> :w
<neiluj> okay my bad the string was missing a starting backslash
<neiluj> thanks for pointing out the issue!
<neiluj> would you use String.equal or polymorphic equality?
<neiluj> if you have custom data structures with instances that are equal while not being structurally equal then exposing and using the equal function is safer I guess
szkl has quit [Quit: Connection closed for inactivity]
<discocaml> <NULL> `String.equal` and `( (=) : string -> string -> bool)` should behave the exact same
<neiluj> thanks
<neiluj> was thinking of custom data structures in C where two values can be equal despite having different representations in memory because the memory representations are not put in some canonical form
<discocaml> <NULL> That can happen with sets and maps at least, but strings are safe
<companion_cube> it gets messy if you want unicode normalization, etc.
<discocaml> <Armael> yes (=) can be the wrong notion of equality even without custom data structures in C, for example with sets and maps you can have trees balanced differently that represent the same set/map
<discocaml> <NULL> companion_cube: Neither `String.equal` nor polymorphic equality do that (I'm pretty sure), but it's good to remember that they in fact do not do that
<companion_cube> for sure
<companion_cube> I was just pointing out that strings can be tricky too :)
Haudegen has quit [Quit: Bin weg.]
waleee has joined #ocaml
<neiluj> thanks for the interesting info!
neiluj has quit [Quit: WeeChat 3.7.1]
bartholin has joined #ocaml
Haudegen has joined #ocaml
mbuf has quit [Quit: Leaving]
tane has joined #ocaml
<olle> Say you have 5 reads and 1 write in a function. Is there anything to gain from lifting out the write so that you only have reads?
<olle> Read/write from file, db etc
<olle> I was thinking that writes complicates the contract of a function more than a read.
Stumpfenstiel has joined #ocaml
troydm has quit [Quit: What is Hope? That all of your wishes and all of your dreams come true? To turn back time because things were not supposed to happen like that (C) Rau Le Creuset]
troydm has joined #ocaml
tane has quit [Quit: Leaving]
bartholin has quit [Quit: Leaving]
wingsorc has joined #ocaml
oriba has joined #ocaml
Tuplanolla has joined #ocaml
Stumpfenstiel has quit [Ping timeout: 255 seconds]
oriba has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
Tuplanolla has quit [Quit: Leaving.]
Haudegen has quit [Ping timeout: 255 seconds]