<d_bot>
<psteckler> ("Raised at Postgresql.connection.signal_error in file \"src/postgresql.ml\", line 838, characters 6-66"
<d_bot>
<psteckler> "Called from Postgresql.protectx in file \"src/postgresql.ml\", line 762, characters 8-11"
<d_bot>
<psteckler> "Re-raised at Postgresql.protectx in file \"src/postgresql.ml\", line 765, characters 6-15"
<d_bot>
<psteckler> "Called from Caqti_driver_postgresql.Connect_functor.Pg_io.get_next_result.retry in file \"lib-driver/caqti_driver_postgresql.ml\", line 465, characters 8-24"
<d_bot>
<psteckler> ```
<d_bot>
<Et7f3> It was merged inside the repo because revery was the sole consumer. So we switched to monorepo to reduce maintenance burden. Original repo -some patch https://github.com/revery-ui/reason-sdl2 also we use a patched sdl2, some bits were implemented also in upstream so they might differ in behaviour on wayland scrolling for instance.
Tuplanolla has quit [Quit: Leaving.]
rgrinberg has joined #ocaml
<d_bot>
<antron> im currently considering "quickly" creating a binding that vendors sdl like luv does, and making that available in opam
<d_bot>
<antron> for the most painless sdl2 experience. and ill be making sure it works on windows since im on windows
<d_bot>
<Et7f3> Nice 😊
Haudegen has quit [Ping timeout: 268 seconds]
Colt has joined #ocaml
horninghack has quit [Read error: Connection reset by peer]
horninghack has joined #ocaml
favonia has joined #ocaml
<d_bot>
<Swerve> In JS, there's a function `Uint8Array()` which can take as input a bytestring and return an array of 8-bit unsigned ints. I couldn't find anything directly corresponding to this in OCaml, but it seems like `Bytes.to_array <bytestring>` would do basically the same thing. Is this correct?
<companion_cube>
bytes is already a kind of array though
<qwr>
is there such function? but you can convert into Seq and then map with Char.code, if you need int array
<companion_cube>
I'm not sure, but you can do `Array.init (Bytes.length b) (Bytes.get b)`
<qwr>
good point :)
<companion_cube>
but generally if you keep chars, `byte` is better than an array
waleee has quit [Quit: WeeChat 3.3]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
average has quit [Quit: Connection closed for inactivity]
sleeping_papaya has joined #ocaml
sleeping_papaya has quit [Ping timeout: 240 seconds]
rgrinberg has joined #ocaml
favonia has quit [Ping timeout: 268 seconds]
remexre has joined #ocaml
<remexre>
does anyone have an example of packaging an ocamlbuild-using project with Nix?
<Corbin>
Where does the hype come from? dash has a great line about this: "great ideas and bad code build communities"
<Corbin>
If we take a step back, languages like V or Roc don't really have compelling design advantages. So why would anybody think that they're great? Because most mainstream languages are very bad. And they're bad because they're mainstream because only the bad code gets communities.
<Franciman>
Corbin: tbh V has design advantages that are compelling
<Franciman>
like automatic memory management without garbage collector or refcount
<Franciman>
but I think this is impossible? :D
<rgrinberg>
Franciman i think that's been binned already. ved and the rest are using boehm ;)
<Armael>
lol
<Armael>
that answers one the questions I had about V indeed
<rgrinberg>
Like you i didn't expect V to achieve the impossible, but hey it got something working
<Corbin>
V looks alright compared to Go, and Go looks alright compared to the rest of the 1980s. It's a good example of how we care more about tradition of languages than about innovation, for sure.
<companion_cube>
rgrinberg: have you heard of Drew Devault btw?
<Armael>
but I mean, it's like max crank level to promise impossible stuff, isn't it?
<Franciman>
he's writing a new language right?
<companion_cube>
he's working on his own language… which… is like C
kakadu has quit [Read error: Connection reset by peer]
<companion_cube>
and has no generics because that's bloat
<rgrinberg>
I quite like that V compiles to C though
kakadu has joined #ocaml
<rgrinberg>
Makes it really easy to publish your stuff
<d_bot>
<darrenldl> so...V is legit and good(?
<Franciman>
companion_cube: so go but by devalut
<rgrinberg>
if you can tolerate more than a few rough edges, it's a cool hack imo
<companion_cube>
Franciman: without GC
<companion_cube>
Go is gettig generics at least
<Franciman>
manual memory management?
<companion_cube>
yeah
<Franciman>
oh so it's C
<companion_cube>
🤷
<rgrinberg>
companion_cube sounds completely pointless to me
<companion_cube>
it's like C but less bad
<companion_cube>
but there's 0 point compared to Zig
<Franciman>
well zig has generics
<d_bot>
<darrenldl> rgrinberg: right okay, i was gonna say if it's production ready (tm), there are a lot of promises on its website to fulfill
<Corbin>
But that's his brand. Like, I remember when Devault published a Minecraft server in C++ and didn't understand why the one I wrote in Python was using less CPU. I spent less time on memory management and more time on algorithms.
<companion_cube>
Franciman: exactly
<Franciman>
Corbin: LOL
<d_bot>
<darrenldl> Corbin: sounds like an amazing story : D
<rgrinberg>
tbh he messed up somewhere if he couldn't out perform python with C++ :)
<companion_cube>
clearly
<Corbin>
Well, it wasn't a fair fight. I got to use a nice networking library (Twisted) and so it wasn't hard to handle thousands of connections. I had a JIT (PyPy) for numerical stuff like terrain generation. And Python's stdlib has a really nice WeakDictionary implementation which simplified the chunk-management algorithm, where stuff has to be read from disk constantly.
<rgrinberg>
companion_cube have you heard of virgil? an exotic language that isn't a joke like devault's remake of C
<rgrinberg>
Corbin C++ has good libraries for networking and data structures
<companion_cube>
vaguely rings a bell, but is it actively developed?
<companion_cube>
C++ has coroutines now, it could simplify networking it seems
<rgrinberg>
companion_cube not as actively as V, but is making regular progress
<companion_cube>
but I'd use rust if I had to do this
<companion_cube>
rgrinberg: also, carp!!
<Corbin>
rgrinberg: Virgil's very interesting. The IIRC second version was very nifty, with static memory layouts for entire applications. I haven't kept up though, and the authors have changed it radically since.
<rgrinberg>
companion_cube C++ always had coroutines in practice
<companion_cube>
you mean… setjump? :s
<rgrinberg>
companion_cube Boost.Coroutine
<rgrinberg>
Corbin that static memory layout is still there. but now it's self hosting and has a lot of backends
<companion_cube>
oh, boost.
<Franciman>
C++ is becoming a bane
<rgrinberg>
even C has coroutines with libcoro :)
favonia has joined #ocaml
<Corbin>
Coroutines actually are a performance problem for connection-handling at that scale. I'm sure that there are some libraries which can do it fine for C++ with some trickery.
<companion_cube>
it's like saying C++ had lambdas using Boost
<companion_cube>
Corbin: how so?
<Corbin>
But e.g. Twisted has three ways to do callbacks on Python, and it's well-known that callbacks are fastest, followed by "inline callbacks" with native Python coroutines, and finally the slowest option is "corotwine" where coroutines directly are managed by the event loop.
<rgrinberg>
companion_cube nah, that's totally different. coroutines don't need a special syntax
<Corbin>
By "coroutine" I'm assuming that we're pausing and saving the stack somehow. That's the part that makes it slow on Python and Go.
<companion_cube>
since coroutines are now builtin in C++, they should be pretty fast
<rgrinberg>
Corbin i don't think that's the reason why python's coroutines are slow
<rgrinberg>
companion_cube they were always plenty fast
<companion_cube>
iirc they require one allocation, but well
<rgrinberg>
companion_cube in C++, one usually doesn't need to wait for the stroke of a pen of a standard's body to start using a feature that is already widely available :)
<companion_cube>
heh
<companion_cube>
I wish there were decent sumtypes though
<companion_cube>
I'm betting on Zig also because it has these
<Franciman>
wait wut, you don't like std::variant?
<d_bot>
<andreypopp> I wonder is anyone has tried terra (C metaprogrammed with Lua)
terrorjack has joined #ocaml
<rgrinberg>
it's abandoned by now I think
<d_bot>
<andreypopp> I wonder why this approach is not popular with OCaml — generate fast computation kernels
<d_bot>
<andreypopp> I think MetaOCaml can do that right?)
<rgrinberg>
yes, and that approach is indeed very popular
<rgrinberg>
it's just hard to make it type safe
<d_bot>
<andreypopp> and memory safe...
<Corbin>
It's *very* hard to make type-safe, or at least that's the impression from Oleg's papers. From experience, I know that codegen is very easy in untyped languages like Python or Monte. But lowering untyped code to type-safe code is also very hard.
<companion_cube>
I'm already thinking of doing some code generation in some cases, instead of functorizing
<companion_cube>
for a handful of sensitive types
<rgrinberg>
Probably coq is a better language than OCaml for this kind of stuff
<rgrinberg>
at least in theory
<companion_cube>
I'm thinking of imperative stuff :p
<companion_cube>
like vectors backed by bigarray. Being monomorphic is super useful because ocamlopt produces much better code.
<d_bot>
<Drup> @rgrinberg in Coq, you will not really do it the metaprog way, rather the EDSL way with an embedded compiler. You can do that in OCaml just fine as well.
<d_bot>
<Drup> Less support for notations, but ppx will do it just fine, and you gain the fact that you don't have to program in Galina
<d_bot>
<Drup> Many people do it in Coq currently because they can also prove the embedded compiler *and* the embedded programs
<rgrinberg>
Drup yeah that's true, but I really like notations make dsl's a lot more palatable. and in coq there's more interesting ways to handle binders
<d_bot>
<andreypopp> by the way, there's ATS as well
<d_bot>
<Drup> ATS is unsafe/unsound
<d_bot>
<andreypopp> oh...
<d_bot>
<Drup> Idris is a better low level language than ATS :3
<rgrinberg>
Drup ppx will not "do it just fine" it will double the work for most projects xD
mro has quit [Remote host closed the connection]
<d_bot>
<Drup> Not in this case no. It's pretty much the same as defining your syntax
<d_bot>
<Drup> we are talking about embedded highly optimizing compilers, the syntax is going to be 2% of the work.
<companion_cube>
is Idris really low level?! uh
<d_bot>
<Drup> Coq notations would only build you the AST, same for a PPX
<rgrinberg>
companion_cube you're just generating code, who cares if it's high level
<d_bot>
<Drup> @companion_cube Idris 2 is pretty ok at doing low level work actually
<d_bot>
<Drup> it has linear types, unboxed types, etc
<d_bot>
<Drup> (iirc)
<Corbin>
companion_cube: Idris 2 targets Chez Scheme as its backend. They're definitely designing for performance, with a new type system that can prove that it erases proofs.
<rgrinberg>
ats is having its python3 moment right now, so it seems best to wait
<Corbin>
ATS might be better for talking about safety of hardware I/O or pointer arithmetic, though.
<d_bot>
<Drup> ATS is memory unsafe by default, that's a no-no, sorry :p
<companion_cube>
Corbin: targeting scheme is not "low level"
<rgrinberg>
Drup yeah maybe for some huge compiler project it's small, but there's lots of really small code gen tasks where ppx is heavy
<Corbin>
(Maybe "low-level language", like "functional language" before it, is a meaningless tribal phrase.)
<d_bot>
<Drup> @rgrinberg oh yeah sure, but that's really not the same kind of things where you would build a EDSL with notations either 😉
<companion_cube>
at this point I'm ready to accept that "low level" means manual memory management 😇
<d_bot>
<Drup> @companion_cube manual memory management doesn't mean memory unsafe, thanks to linear/affine types/borrows/...
<Corbin>
companion_cube: I would actually agree with you on your entire point, but I wonder: If I write Python, that's high-level. If I write RPython, that's low-level; I have fine-grained control as if I were talking directly to gcc. So maybe "compiles to C with fine-grained control" -> "low-level".
<olle>
(escape semantics...)
<Corbin>
If we write Scheme, that's high-level; if we write Chez Scheme, that's low-level. Most of the standard libraries (the SRFIs) aren't available, and FFI requires lots of work.
<companion_cube>
@Drup not the same thing
<companion_cube>
oh, Chez Scheme provides control over memory?
<companion_cube>
@Drup I didn't say "low level <-> unsafe"
<d_bot>
<Drup> In any case, the way metaocaml does things is indeed quite hard for a variety of reasons, one being that writing any kind of optimization using metaprogramming is hugely painful
<rgrinberg>
companion_cube weren't you interested in code generation of "impteraive stuff"?
<companion_cube>
yes indeed
<companion_cube>
I'm trying quite hard to turn OCaml into C++ :D
<d_bot>
<Drup> ugly and unusable ?
<rgrinberg>
so what difference does it make if idris runs on chez or ruby, or V?
<companion_cube>
@Drup fast
<companion_cube>
it's a bit of a losing battle, but well
<rgrinberg>
Just define an ADT for your target DSL and then generate it
<companion_cube>
yeah, it's just quite annoying when you need the DSL to be expressive
<d_bot>
<Drup> If you want your optimization to be realiable, that will always be the case
<rgrinberg>
that's where the fancy types come in :)
<rgrinberg>
but does idris have type classes?
<companion_cube>
I think so
<d_bot>
<Drup> of course it does
<d_bot>
<Drup> come on, it's Idris, the better question is: which type feature it *doesn't* have ?
<rgrinberg>
are they more like coq's or more like haskell's
<d_bot>
<Drup> I think the answer is "Yes"
<d_bot>
<Drup> (The Coq one, but with more metaprog, iirc)
motherfsck has quit [Read error: Connection reset by peer]
motherfsck has joined #ocaml
mro has joined #ocaml
olle has joined #ocaml
chrisz has quit [Quit: leaving]
<d_bot>
<Pokegali> I don't have the same cat xD `cat - concatenate files and print on the standard output`
ymherklotz has joined #ocaml
Colt has joined #ocaml
<d_bot>
<Yugami> your cat is outdated !
<d_bot>
<Swerve> I have a small piece of code which which spawns the error `Warning 11: this match case is unused', how can I fix this? https://pastebin.com/YSGkS4Q2
<d_bot>
<NULL> Your first match is a variable name so it matches any input and just binds it to this name. Consequently, any further case becomes useless
favonia has quit [Ping timeout: 256 seconds]
<d_bot>
<Swerve> I see. Is there a way to alias the int on line 2 so that I can do proper pattern matching?
<d_bot>
<NULL> You can't (unless there's a feature I don't know about)
<d_bot>
<Swerve> Bummer. Thanks for the help anyway
<d_bot>
<NULL> You can add it as a guard in the pattern matching, but at this point it's easier to do an if
<d_bot>
<Swerve> Right
<d_bot>
<Et7f3> as
<d_bot>
<Et7f3> ```diff
<d_bot>
<Et7f3> - | mov_r1_r2 ->
<d_bot>
<Et7f3> + | (0x01 as mov_r1_r2) ->```
<d_bot>
<NULL> That's not the problem
<d_bot>
<Et7f3> > Is there a way to give the int on line 2 a name
<d_bot>
<Et7f3> 🤦
<d_bot>
<Et7f3> @Swerve what about regular variant ?
<d_bot>
<Swerve> I need to be able to insert these into byte strings, and it's not obvious how to do that with variants.
<sim642>
You could use a regular variant type with [@@deriving enum] and [@value ...] for the corresponding integers
<sim642>
Of course if they're sequential and you're careful not to reorder them, you even don't need all the [@value ...] annotations
<d_bot>
<Swerve> Fantastic! This might be just what I'm looking for
mro has quit [Remote host closed the connection]
cedric has joined #ocaml
<d_bot>
<infrandomness> Huh
chrisz has joined #ocaml
Tuplanolla has joined #ocaml
mro has joined #ocaml
bobo_ has quit [Read error: Connection reset by peer]