<companion_cube>
that'd also work with ppx_deriving.show I guess
<d_bot>
<RegularSpatula> I use them a lot together with expect tests with ppx_expect
Corbin has joined #ocaml
rgrinberg has joined #ocaml
x88x88x has quit [Read error: Connection reset by peer]
<d_bot>
<VPhantom> I ended up using deriving_sexp for a configuration file recently. Much nicer and more permissive than JSON (comments, less quoting).
<d_bot>
<darrenldl> its slightly amusing that security specification people use m4 of all things
<d_bot>
<darrenldl> so difficult to read :dead:
jonasbits has quit [Remote host closed the connection]
jonasbits has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gravicappa has joined #ocaml
rgrinberg has joined #ocaml
wyrd has quit [Ping timeout: 276 seconds]
hackinghorn has joined #ocaml
wyrd has joined #ocaml
jlrnick has joined #ocaml
humasect has joined #ocaml
azimut_ has quit [Ping timeout: 276 seconds]
humasect has quit [Remote host closed the connection]
humasect has joined #ocaml
mbuf has joined #ocaml
Haudegen has joined #ocaml
mro has joined #ocaml
oriba has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gentauro has quit [Quit: leaving]
gentauro has joined #ocaml
humasect has quit [Remote host closed the connection]
humasect has joined #ocaml
humasect has quit [Client Quit]
<ns12>
Hi, does OCaml have functions for creating pseudoterminals on Unix-like systems? There is no mention of pseudoterminals in the Sys and Unix libraries.
humasect has joined #ocaml
kakadu has joined #ocaml
olle has joined #ocaml
<d_bot>
<antron> ns12: not the standard library. there are some bindings to pty floating around. i also have an unpublished cross-platform binding from a hobby project
<ns12>
Noted.
<ns12>
Second question: Is there a way to make Opam list the packages I have installed using "opam install ..."? I don't want Opam to list all dependencies.
<d_bot>
<antron> opam list
<ns12>
"opam list" displays *all* packages. That's not what I am looking for. In package manager terminology, I only want to see the manual packages, not the automatic ones.
<ns12>
s/*all*/all installed/
ouestbillie has quit [Ping timeout: 250 seconds]
<ns12>
Oh, I've found it. It's "opam list --roots".
ouestbillie has joined #ocaml
hackinghorn has quit [Read error: Connection reset by peer]
hackinghorn has joined #ocaml
wyrd has quit [Ping timeout: 276 seconds]
wyrd has joined #ocaml
arg__ has quit [Remote host closed the connection]
mro has quit [Remote host closed the connection]
mro has joined #ocaml
bartholin has joined #ocaml
mro has quit [Ping timeout: 268 seconds]
<d_bot>
<VPhantom> @darrenldl I wrote and maintained our `sendmail.cf` in the early 2000s", how's _that_ for cryptic? 😛 That was before I found out that we could use M4 to compile a much cleaner `sendmail.mc` into `sendmail.cf`. Not saying that we should use M4 more, but it was a revelation when I found out about it.
<dmbaturin>
What is the correct way to create a switch with +musl+static variant now?
<d_bot>
<VPhantom> You need musl, but not static.
<dmbaturin>
Oh, I mean I can't remember the `opam switch` syntax for adding a variant.
<d_bot>
<VPhantom> Hold on, I did this just a few weeks ago…
<d_bot>
<VPhantom> The syntax changed around OCaml 4.12-4.13 ish.
<d_bot>
<VPhantom> No wait, it changed with opam 2.1 I mean.
<dmbaturin>
Both, I think. :)
<d_bot>
<VPhantom> @dmbaturin: Do you already have the full musl GCC installed?
ouestbillie has quit [Ping timeout: 240 seconds]
<d_bot>
<VPhantom> For the switch per se, I used `opam switch create 4.13.1+muslnative+flambda ocaml-variants.4.13.1+options ocaml-option-musl ocaml-option-flambda`
<d_bot>
<VPhantom> Since the available `gcc` in that environment was Musl's, that created a Musl-using compiler. From there of course, one needs to use `(ocamlopt_flags (:standard -ccopt -static))` in dune files, but only for `executable` targets.
ouestbillie has joined #ocaml
<dmbaturin>
VPhantom: Yes.
<d_bot>
<VPhantom> (In my case, Musl's suite from <http://musl.cc/> is not my system's, so I do a few more things before to set up the environment.)
<dmbaturin>
Fedora has it in the repos, so I have it easy.
<d_bot>
<VPhantom> Yes and no.
<d_bot>
<VPhantom> When I used Debian's musl-tools & co I could not get OCaml to compile some packages successfully.
<d_bot>
<VPhantom> That's why I resorted to remove those packages and installed the full-featured Musl GCC/G++ suite instead. Now not only does OCaml work well for me but it can also compile any C or C++ that comes its way. (A lot of packages on OPAM use some.)
<d_bot>
<VPhantom> Basically I installed the Musl suite in `/usr/local/x86_64-linux-musl-native/` and then in the shell where I'm using OCaml I prepend that `bin/` to my `$PATH` and I prepend its `lib/` to `$LD_LIBRARY_PATH`.
<d_bot>
<VPhantom> Since the final executables compiled by OCaml are truly static, this is only required for installing OPAM packages or compiling with Dune.
<d_bot>
<VPhantom> (Actually there's a few extra steps. If you intend to install the full Musl suite let me know and I'll clean up my install script and throw it on a Gist or Pastebin.)
<dmbaturin>
VPhantom: Thanks, your procedure worked!
<dmbaturin>
I also had problems with musl on Debian, but Fedora's package is working fine for me.
<d_bot>
<VPhantom> Interesting.
<companion_cube>
@VPhantom does it work with zarith?
<d_bot>
<VPhantom> I haven't tried it; I have an int-based equivalent of `Zarith.Q` for my limited needs (financial).
<d_bot>
<VPhantom> I haven't had any problems with C and C++ using dependencies so far though.
jlrnick has quit [Ping timeout: 268 seconds]
dalek-caan has joined #ocaml
hsw has quit [Quit: Leaving]
mro has joined #ocaml
hsw has joined #ocaml
mro has quit [Remote host closed the connection]
pieguy128 has quit [Ping timeout: 256 seconds]
pieguy128 has joined #ocaml
mro has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
mro has quit [Ping timeout: 240 seconds]
jlrnick has joined #ocaml
pieguy128 has quit [Ping timeout: 240 seconds]
jlrnick has quit [Ping timeout: 268 seconds]
pieguy128 has joined #ocaml
wyrd has quit [Ping timeout: 276 seconds]
wyrd has joined #ocaml
hsw has quit [Remote host closed the connection]
mro has joined #ocaml
azimut has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
Haudegen has joined #ocaml
waleee has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
hsw has joined #ocaml
mro 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]
mro has quit [Remote host closed the connection]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
<d_bot>
<d4hines> Are there conventions around the meaning of different `let` bindings? I'm migrating a codebase from Reason syntax to OCaml, and we had different bindings like `let.some = Option.bind`, `let.await = Lwt.bind`, `let.ok = Result.bind`. If there are conventions I could follow when picking a new binding for each of these, that would be great.
<d_bot>
<monk> @d4hines there are ppx extensions for monadic let that are fairly common and i think the same does exist for options though maybe less common
<d_bot>
<monk> np, if you look at the blogpost you'll see i haven't written a lot of code that used monads because i mispoke re: needing ppx extensions per se.
<d_bot>
<monk>
<d_bot>
<monk> You just have to open the bindings and define them to operators if you want them for things like Options etc and can go a further step and define the common infix operators you want like `>>=`.
<d_bot>
<monk>
<d_bot>
<monk> There are ppx extensions (eg `ppx_let`) that add more syntactic sugar for doing things like matching if you want that, too.
<d_bot>
<monk> here's a recent blogpost by a Lwt developer that shows how to use Lwt's provided operators in ocaml
<d_bot>
<VPhantom> From what I could tell in my limited experience, `let*` tends to be for the typical monadic bind (`Lwt.bind`, `Result.bind`) and `let&` for resource allocation with implicit freeing at the end of the scope.
jlrnick has joined #ocaml
dalek-caan has quit [Quit: dalek-caan]
mbuf has quit [Quit: Leaving]
<humasect>
wbu let%
humasect has quit [Remote host closed the connection]
Haudegen has quit [Quit: Bin weg.]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
zebrag has joined #ocaml
mro has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mro has quit [Remote host closed the connection]
humasect has joined #ocaml
<reynir>
Ah interesting, you can't define ( let% ) :)
humasect has quit [Ping timeout: 256 seconds]
humasect has joined #ocaml
<olle>
whaaa
<olle>
You have let& in OCaml?
<olle>
How would that be safe without affine types or ownership or alias control?
<d_bot>
<orbitz> It isn't any less safe than the `with_yadda` pattern
<olle>
So you can't wrap it in an escaping closure?
<pippijn>
most with_yadda functions allow you to escape
<olle>
What does that mean? It's safe or not safe?
<Fardale>
It is not safe
<pippijn>
the resource allocation has a deterministic deallocation point
<Fardale>
Just let& is not less safe than what is already in the language
<olle>
Ah
<pippijn>
once deallocated, nothing prevents you from still using it
<Fardale>
But I never saw let& before, which libraries are defining it?
vicfred has joined #ocaml
<olle>
Google showed some forum result
zebrag has quit [Quit: Konversation terminated!]
kakadu has quit [Quit: Konversation terminated!]
rgrinberg has joined #ocaml
zebrag has joined #ocaml
<reynir>
Where is it you find what the warning numbers are/mean?
<octachron>
`ocamlc -warn-help` or with OCaml >= 4.12 warnings are named
<reynir>
Cheers!
wyrd has quit [Ping timeout: 276 seconds]
Haudegen has joined #ocaml
<d_bot>
<VPhantom> To clarify, my use of `let&` traps exceptions and uses `Fun.protect ~finally` to try to guarantee ressource deallocation after the closure.
<d_bot>
<VPhantom> (Not sure if IRC shows Discord edits: `s/closure/continuation/`)
<reynir>
it does not
<reynir>
I have been in another irc channel where they do, and it can quickly turn into a spam fest when someone makes many (small) edits :D
<d_bot>
<cemerick> Is there a date-time package that includes human-friendly printing, e.g. "two days ago", "last month", etc?
octachron has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ouestbillie has quit [Ping timeout: 250 seconds]
rgrinberg has joined #ocaml
<d_bot>
<glennsl> it's pretty easy to write yourself, and usually requires integration with whatever translation system you're using anyway, so there's really not much gain in making it a library.
ouestbillie has joined #ocaml
gravicappa has quit [Ping timeout: 240 seconds]
jlrnick has quit [Ping timeout: 268 seconds]
mro has joined #ocaml
<d_bot>
<VPhantom> Yeah that's why we're rolling our own too: localizing those is the main challenge, plus we tend to want to choose how granular it is based on context. i.e. "earlier this week" vs "two days ago".
<d_bot>
<cemerick> indeed, and so I was hoping someone had done the localization work already, which would naturally be best distributed…as a library
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gwizon has joined #ocaml
azimut has quit [Ping timeout: 276 seconds]
gwizon has quit [Quit: leaving]
gwizon has joined #ocaml
gwizon has quit [Client Quit]
waleee has quit [Ping timeout: 240 seconds]
waleee has joined #ocaml
Tuplanolla has quit [Quit: Leaving.]
<d_bot>
<let Butanium = raise Not_found;;> not to myself : never forget `close_out oc` or you'll spend 1 hours debugging why your program write file output 1 time on 10
<companion_cube>
or use a safe wrapper
<companion_cube>
`with_out "the file" (fun oc -> …)`
<companion_cube>
live is too short to manage resources manually