companion_cube changed the topic of #ocaml to: Discussion about the OCaml programming language | http://www.ocaml.org | OCaml 4.12 released: https://ocaml.org/releases/4.12.0.html | Try OCaml in your browser: https://try.ocamlpro.com | Public channel logs at https://libera.irclog.whitequark.org/ocaml/
Stumpfenstiel has quit [Ping timeout: 265 seconds]
berberman has joined #ocaml
adanwan has quit [Remote host closed the connection]
adanwan has joined #ocaml
Tuplanolla has quit [Quit: Leaving.]
Haudegen has quit [Ping timeout: 245 seconds]
<eltonpinto> https://github.com/ocaml/ocaml/pull/10195 found this PR to be interesting
Guest4585 has quit [Remote host closed the connection]
Guest4585 has joined #ocaml
paravida has quit [Remote host closed the connection]
waleee has quit [Ping timeout: 255 seconds]
vicfred has joined #ocaml
osa1 has quit [Ping timeout: 255 seconds]
zebrag has quit [Quit: Konversation terminated!]
mbuf has joined #ocaml
gravicappa has joined #ocaml
Melantha has quit [Ping timeout: 256 seconds]
gravicappa has quit [Read error: Connection reset by peer]
dhil has joined #ocaml
gravicappa has joined #ocaml
gravicappa has quit [Ping timeout: 265 seconds]
bartholin has joined #ocaml
cedric has joined #ocaml
<d_bot> <ostera> is there any reason whatsoever that a match over polymorphic variants should behave different than one over regular variants?
<d_bot> <ostera>
<d_bot> <ostera> eg, are these two semantically equivalent?
<d_bot> <ostera>
<d_bot> <ostera> ```ocaml
<d_bot> <ostera> type a = A | B
<d_bot> <ostera> match (x : a) with
<d_bot> <ostera> | A -> ()
<d_bot> <ostera> | B -> ()
<d_bot> <ostera>
<d_bot> <ostera> type b = [ | `A | `B ]
<d_bot> <ostera> match (y : b) with
<d_bot> <ostera> | `A -> ()
<d_bot> <ostera> | `B -> ()
<d_bot> <ostera> ```
<d_bot> <ostera> i'm asking because i found out that in ReScript polymorphic variants on an exhaustive switch compile to a cascade of if-else's that has a default case
glassofethanol has joined #ocaml
olle has joined #ocaml
<d_bot> <darrenldl> any long term data storage enthusiast or lossy network link user here? i recently released ocaml-lt-code (forward error correction thingy), and have been exploring ways to apply it concretely
<d_bot> <octachron> @ostera : it depends on what you mean by semantics: the memory representation of polymorphic variants is not the same as the one for regular variants (typically the equivalent of tags is much more sparse on the polymorphic variants side). This has some consequences on the compilation of pattern matchings. If you are asking if your second match should be considered exhaustive, the answer is yes.
<d_bot> <ostera> excellent, that's what i thought
<d_bot> <ostera> thanks @octachron
gravicappa has joined #ocaml
<d_bot> <octachron> Note that you can check the behavior of the pattern matching compiler with `-dlambda` . In your example, the `match` is seen as constant and there is no conditionals, and tweaking it to make the branches non-constant, there is still only one `if`.
Melantha has joined #ocaml
Tuplanolla has joined #ocaml
Haudegen has joined #ocaml
reynir has quit [Ping timeout: 265 seconds]
reynir has joined #ocaml
<d_bot> <Kakadu> Do you know if https://download.ocamlcore.org/ocaml-metrics/ has been resurrected in opam? I foun donly mirage's metrics but it look like some runtime metrics and not code quality metrics...
Haudegen has quit [Quit: Bin weg.]
berberman has quit [Ping timeout: 245 seconds]
berberman_ has joined #ocaml
<d_bot> <Competitive Complications> hi
<d_bot> <Competitive Complications> where can i find about the typing rules for recursive modules?
<d_bot> <Competitive Complications> I haven't found them on https://caml.inria.fr/pub/docs/u3-ocaml/ocaml.pdf nor https://ocaml.org/manual/manual024.html
Guest60 has joined #ocaml
neiluj has joined #ocaml
<d_bot> <octachron> Do you have a more precise question? Otherwise, you would have to dive in research articles.
<d_bot> <Competitive Complications> @octachron
<d_bot> <Competitive Complications> On page 36 of http://gallium.inria.fr/~remy/mpri/2013/cours.pdf, I have the typing rule for recursive functions
<d_bot> <Competitive Complications> I'm interested in typing rules for more generic things. Be it recursive values (which should just be `(a -> a) -> a`, recursive modules (???) or recursive dependent values
<d_bot> <octachron> Then you have to refer to research articles, the question is not yet settled. The implementation in OCaml is essentially a pragmatic prototype.
<d_bot> <octachron> https://caml.inria.fr/pub/papers/xleroy-recursive_modules-03.pdf describes the OCaml implementation.
<d_bot> <Competitive Complications> That's ok with me. If you have good papers in mind, especially recent ones, I'd be glad. In the meanwhile, I'm reading https://people.mpi-sws.org/~dreyer/papers/recmod/main-short.pdf
<d_bot> <Competitive Complications> If you know of one that tries to tackle recursive dependent values directly, that would be even better
<d_bot> <octachron> Sorry, I am not familiar with the literature and I don't know the good entry points.
<d_bot> <Competitive Complications> No problem 🙂
<d_bot> <Competitive Complications> It'd be nice to have a #brainstorm channel to just share thoughts about this kind of things without spamming everyone
<d_bot> <Drup> for recursion × dependent values, there are many approaches, but it's generally due to termination consideration rather than just the dependency, which doesn't impose all that many issues
<d_bot> <Drup> recursive modules are a mess though, but it's a bit more complicated than just because of dependent types, because it adds abstraction in the mix
<d_bot> <Drup> Are you interested by a specific use or just "all the recursive things" ?
mbuf has quit [Quit: Leaving]
<d_bot> <Competitive Complications> I want to explore what currently exists and form my opinion. Ideally, I just want to have a "dependently typed system" (quotes, because I don't want a Curry-Howard implementation, am ok with Type:Type, don't need type checking to be decidable and am thus ok with unbounded recursion) and row polymorphism. and I'm thinking that if I had a nice understanding of recursion for dependent types, I would not need any sp
<d_bot> <Competitive Complications> i also don't mind if there is no memory representation for the entire lang or if the entire lang of typed terms is not compilable as long as there is a semantically meaningful pass that can be applied after typing and yields nice enough errors
<d_bot> <Competitive Complications> isn't abstraction subsumed by existential types in recursive types?
<d_bot> <Drup> it's "encodable in", not "subsumed"
<d_bot> <Competitive Complications> i see
<d_bot> <Drup> (and it's not terribly nice to use, imho)
<d_bot> <Drup> The sugar is important 🙂
<d_bot> <Competitive Complications> (do you feel it's that way because of a lack of sugar/tool/support or because of inherent limitations of the encoding?)
<d_bot> <Competitive Complications> agreed, but not the layer i'm working right now
<d_bot> <Drup> sure
<d_bot> <Competitive Complications> but yeah, given this, i should be ok with any approach to recursion x dependent values that you have in mind
<d_bot> <Drup> in any case, I'm not sure I have a specific reference. Imho, if you only want a calculus and you don't care about being impredicative, you can go wild with recursion, nothing matters 🙂
<d_bot> <Competitive Complications> agreed, but even then, i haven't seen anything there
<d_bot> <Competitive Complications> if you have examples of systems "going wild", I'm all for it
<d_bot> <Competitive Complications> like, OCaml goes wild, but hasn't gone dependent types
<d_bot> <Drup> OCaml doesn't goes wild at all, there are lot's of constraints wrt recursive things
<d_bot> <Drup> by "go wild" i mean "just do the basic unrestricted thing"
<d_bot> <Drup> as I said, if you care neither about compilation nor decidability, it doesn't matter, you don't need to do anything special, that's why noone talks about it.
<d_bot> <Competitive Complications> I am looking for what this is
<d_bot> <Competitive Complications> the basic fixpoint constructor has type `(a -> a) -> a`, I'm not sure how you translate that type into dependent types. `(x : A(??) -> A(x)) -> A(??)`
<d_bot> <Drup> Ah, from that. You probably need some indexed stuff, I'm not familiar with those calculus
<d_bot> <Competitive Complications> you can still interpret, typecheck, and compile a sub-part. but i don't really want to make a case for it. if you have examples of restrictions where recursion x dependent values are studied, I'm still very interested. I'd expect to understand more
<d_bot> <Drup> you can look at size types for the decidability aspect
<d_bot> <Drup> (just an exemple, there is a rich literature)
<d_bot> <Drup> what you are looking for is probably on the more theoretical side, but you can look at the references starting from there
<d_bot> <Competitive Complications> if you have a bunch of examples, so that if one doesn't look good, i can move to another one, that would be great
<d_bot> <Competitive Complications> else, I will just check at the references from your link
<d_bot> <Drup> for modules, the most recent work is probably https://dl.acm.org/doi/10.1145/2076021.2048141, but it's very different from what you want, I think
<d_bot> <Alistair> How does typing for optional arguments w/ defaults work? Since I expect `fun ?l:(pat = e) -> ...` gets desugared too: ```ocaml
<d_bot> <Alistair> fun ?l:x -> let pat = match x with
<d_bot> <Alistair> | Some x -> x
<d_bot> <Alistair> | None -> e
<d_bot> <Alistair> in ...```
<d_bot> <Competitive Complications> thanks 🙂
waleee has joined #ocaml
waleee has quit [Ping timeout: 276 seconds]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
cedric has quit [Quit: Konversation terminated!]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
<Corbin> Is there a good recipe for translating Rust to OCaml? I'm trying to decide how to structure the struct-like types for a library, and I'm not sure if I should translate a traits-heavy approach to functors or just inline a bunch of stuff.
<Corbin> The library's https://github.com/egraphs-good/egg FWIW. I've implemented this data structure before, but I used struct-of-arrays techniques to break up the structs, and I was able to cheat a bunch because it was an untyped environment.
<Corbin> TBH I'm inching closer and closer to just writing some Rust, wrapping the library, and giving it a friendly little JSON face. I don't like Rust but I like confusing hashtable logic even less.
olle has quit [Ping timeout: 256 seconds]
neiluj has quit [Remote host closed the connection]
mro has quit [Quit: Leaving...]
neiluj has joined #ocaml
ocabot has quit [Ping timeout: 240 seconds]
companion_cube has quit [Ping timeout: 240 seconds]
copy has quit [Ping timeout: 240 seconds]
ks_ has quit [Ping timeout: 276 seconds]
oisota has quit [Ping timeout: 258 seconds]
energizer has quit [Ping timeout: 252 seconds]
copy has joined #ocaml
ocabot has joined #ocaml
energizer has joined #ocaml
companion_cube has joined #ocaml
ks_ has joined #ocaml
oisota has joined #ocaml
glassofethanol has quit [Quit: leaving]
Anarchos has joined #ocaml
Anarchos has quit [Client Quit]
Anarchos has joined #ocaml
<companion_cube> Corbin: struct of arrays in ocaml works, but it's very tedious
<companion_cube> Corbin: im actually interested in Egg, I have a congruence closure in OCaml if you're willing to look, and the extensibility aspect is on my todolist
<Corbin> companion_cube: I'm certainly interested in what others have built, but we both know that you know OCaml way better than me.
<companion_cube> What does that change? :)
<companion_cube> What do you want to use Egg for?
<Corbin> Well, I don't want to just yoink your code, but I also don't think I'll have constructive feedback from code review.
berberman_ has quit [Ping timeout: 240 seconds]
berberman has joined #ocaml
<Corbin> I'm writing programming languages. I prototyped Egg already, and wrote high-level operations on my high-level language AST. But it was not great, mostly because alpha-equivalence is a pain and beta-reduction is non-trivial.
<companion_cube> (my congruence closure isn't struct of array ified yet)
<companion_cube> Ah, so equally the use case of the paper
<companion_cube> Have you considered bindlib? Or DB indices?
<Corbin> My current attempt is no names at all, just categorical combinators. I'll eventually implement the high-level language by classical reduction techniques, but I'm still working on low-level parts.
<companion_cube> Hmmm, are these the same as SKIBC?
<Corbin> This fixes the alpha-equivalence problem, because no names, and it makes beta-reduction simple enough to be a standard e-matching rule. So now I can go full egg.
<Corbin> No, these are id, curry, apply, pair, dup, that sort of thing.
<Corbin> SKI reduction's really cool, but also really hard to safely put into an egg-ish form because S is so unrelentingly explosive.
<Anarchos> Corbin sure, S is a distributive operator
<Corbin> TIL bindlib. This looks super-useful. It's like ABTs or Haskell's "bound" library. I don't want to do this sort of thing ever again, but if I have to, I'll make sure to remember bindlib.
<companion_cube> Corbin: oh interesting
<companion_cube> Does this correspond to a stack machine? Or like exponential categories or whatever?
<Corbin> It corresponds to Cartesian closed categories. It was at this point that I realized I was on the same mountain as Curien in the 1980s, so I went back and read a bunch of papers, and I'm here because OCaml's got the best implementation of that sort of machine.
<companion_cube> Yeah bindlib is HOAS I think
<companion_cube> Ah, fun.
<Corbin> Elliott's got a paper which goes in the other direction, and shows that we don't need names if we have the right combinators: http://conal.net/papers/compiling-to-categories/compiling-to-categories.pdf
<Corbin> So basically my goal is now: Take high-level language, desugar, remove names and get categorical combinators in a fancy category. Then, make the category less fancy by interpreting it with a stack of monad transformers (there's another two Elliott papers on this, IIRC)
<companion_cube> My problem is that I could never grasp categories :)
<companion_cube> Egg is closer to my level of skill
<Corbin> Egg's core rebuilding algorithm turned me to mush. When I rewrote it in Monte, I changed that loop entirely so that it was iterative instead of recursive.
<Corbin> Actually, I changed something which I wish Egg would change too. The Rust version is unsafe in that it is only correct if the user remembers to manually rebuild the e-graph in-between doing matches.
<Corbin> My API takes a *list* of pairs of e-classes to unify, and automatically rebuilds after iteratively working through the list. So the user can't possibly injure themselves and misoptimize.
<Anarchos> companion_cube what are the troubles with categories ?
<companion_cube> Anarchos: gets too abstract for me too quickly
<Anarchos> companion_cube i must admit i strugle to understand yoneda's lemma and all the fuz around representable functors....
<Anarchos> Corbin orange is the new black ;)
Guest60 has quit [Ping timeout: 246 seconds]
motherfsck has quit [Quit: quit]
motherfsck has joined #ocaml
Anarchos has quit [Quit: Vision[0.10.3]: i've been blurred!]
zebrag has joined #ocaml
olle has joined #ocaml
neiluj has quit [Remote host closed the connection]
neiluj has joined #ocaml
waleee has joined #ocaml
olle has quit [Ping timeout: 268 seconds]
gravicappa has quit [Ping timeout: 258 seconds]
nullheroes has quit [Quit: WeeChat 3.1]
favonia has quit [Remote host closed the connection]
favonia has joined #ocaml
neiluj has quit [Quit: Leaving]
Fardale has quit [Quit: WeeChat 2.8]
Guest4585 has quit [Quit: Konversation terminated!]
spip has joined #ocaml
spip is now known as Guest3131
Fardale has joined #ocaml
bartholin has quit [Quit: Leaving]
dhil has quit [Ping timeout: 268 seconds]