average has quit [Quit: Connection closed for inactivity]
jonasbits has quit [Ping timeout: 248 seconds]
mro has quit [Remote host closed the connection]
<d_bot>
<ostera> does the ocaml compiler do any fusion on stream operations / data flow? 🤔
<companion_cube>
not that I know of
<d_bot>
<ostera> i realized this morning that i had never thought of look into this
<d_bot>
<ostera> but that in the haskell community "fused" stuff is a thing
<companion_cube>
yes, but they're lazy
<companion_cube>
and more "pure", so these kind of optimizations are more relevant
<d_bot>
<ostera> in general then, a bunch of piped mapping operations over an option would have to box/unbox
<olle>
Is OCaml LR(1), btw?
<zozozo>
@ostera : well, in some cases, flambda can remove the unnecessary box/unbox operations
<d_bot>
<Bluddy> And fusion usually relates to reifying large collections in memory rather than option types.
<Drup>
olle: menhir is LR1, ocaml uses menhir, so yes :p
<companion_cube>
modulo lexer hacks? :p
<companion_cube>
o/ Drup
<companion_cube>
have you been on vacation?
<Drup>
yep, 2 weeks :p
<Drup>
well, a bit more
<Drup>
Did I miss anything ? :D
<olle>
Drup: Got it, thanks!
olle has quit [Ping timeout: 240 seconds]
<d_bot>
<ostera> gotcha, thanks @Bluddy 🙂
<d_bot>
<Bluddy> the equivalent to fusion in OCaml is to use Seq data types
<d_bot>
<Bluddy> or even better, @companion_cube 's Iter
<companion_cube>
more or less… with flambda it can almost entirely disappear, yes
<d_bot>
<ostera> the specific use case i've got is a collection of options, and I'm going to map ~50 functions over each one (no binds, just maps tho)
<d_bot>
<ostera> ofc i could manually write all of this under a single `match` too
<companion_cube>
indeed, esp since `map` would just become a series of |>
<d_bot>
<ostera> but i wondered if the compiler would be smart enough to figure that out for me, and "fuse" all these operations for me
<d_bot>
<ostera> its okay if it doesn't
<companion_cube>
ocaml is historically a pretty straightforward compiler ;)
<companion_cube>
what it does is close to what you write
<companion_cube>
ofc people like zozozo try to improve optimizations with flambda
<d_bot>
<Bluddy> haskell's fusions don't do that either afaik since you've got to be able to express a full option type at each point, and that requires more than one word
<d_bot>
<Bluddy> but if you're trying to not allocate the collection at each map point, you can do that with Iter (or haskell map fusions)
mro has joined #ocaml
<zozozo>
and we're getting there in terms of (reasonable) optimizations, but then you find out that some people use the Obj module a bit too much... :p
<d_bot>
<Bluddy> @ostera what are you storing in your option?
<d_bot>
<ostera> not much, just a boolean right now
<d_bot>
<Bluddy> well if you're willing to create a type you can map that instead and it'll fit into an integer
<d_bot>
<Bluddy> (or use polymorphic variants)
mro has quit [Ping timeout: 248 seconds]
<d_bot>
<Bluddy> depends how performance-critical this part is
<d_bot>
<Bluddy> I'm going to move the outreachy channel to the ECOSYSTEM area since it doesn't seem to be used anymore
<companion_cube>
zozozo: are you going to emit warnings on unsafe uses of Obj? :)
<zozozo>
companion_cube: well, it's hard to do, so I don't think so; but basically, every use of Obj is unsafe technically, :p
<d_bot>
<Bluddy> yeah I think if you mess with Obj, you shouldn't expect flambda to work
<Armael>
I hope there'll be a warning detecting non-terminating code as well
<zozozo>
and I don't know if it's possible for flambda to distinguish an unsafe (or dangerous) use of Obj, from a really complicated code using GADTs
<companion_cube>
zozozo: even for variance stuff? :p
<companion_cube>
well, there are soem functions in Obj that are more/always unsafe, no?
<companion_cube>
like mutating a field
mro has joined #ocaml
<zozozo>
sure, but in effect, since it's hard to actually get the information from types (since the types are not propagated after type-checking), flambda actually reconstructs the information it needs (such as the shapes of values and/or mutability) a lot from the acutal uses of the values
<zozozo>
(and a little bit from what little is propagated after type-checking)
<d_bot>
<Bluddy> zozozo: how far along is flambda2? any release date in mind?
jonasbits has joined #ocaml
<zozozo>
@Bluddy : there should be an experimental release of flambda2 in a few months if everything goes well
mro has quit [Ping timeout: 258 seconds]
<d_bot>
<Bluddy> sweet
<companion_cube>
amazing
<companion_cube>
zozozo: and you have some cool programs to try to optimize :p
<zozozo>
yup
<d_bot>
<Bluddy> are you guys using CPS in the end?
<d_bot>
<Bluddy> (zozozo)
<zozozo>
@Bluddy : yup
<Corbin>
Neat. That'll make pointfree style more tenable, hopefully.
<companion_cube>
not really idiomatic, Corbin :)
mro has joined #ocaml
<Corbin>
companion_cube: I'm not asking for flambda2 to be centered around my needs. It just seems like a nice bonus.
<Corbin>
(Also, c'mon, really? Nominal idioms suck. I'm tired of alpha-equivalence; it is a hassle. We can have GC, but not freedom from alpha-equivalence!?)
<companion_cube>
well no :p
<companion_cube>
value restriction will still be there
<companion_cube>
not sure why alpha equivalence matters to the users
<companion_cube>
you mean eta-equivalence? :)
gravicappa has quit [Ping timeout: 240 seconds]
mro has quit [Ping timeout: 240 seconds]
hornhack has quit [Remote host closed the connection]
<Corbin>
I'm compiling a "higher-level" language "down" to OCaml, so I do mean alpha-equivalence. Eta-equivalence is certainly annoying, but pointfree style removes that particular problem from consideration too.
<companion_cube>
if you compile, you can introduce names for the combinators anyway?
<d_bot>
<ggole> Generating names doesn't seem that hard?
<Corbin>
Well, I don't mind generating names, but that seems a little silly, doesn't it? TBH I'd prefer to generate bytecode directly, but the bytecode format's not stable, and the recommended interface is through OCaml text.
<companion_cube>
that doesn't seem silly for a compiler
<companion_cube>
OCaml itself generates new functions, after all, when you use lambdas
<companion_cube>
also, the bytecode isn't supposed to be stable, but if you emit it I'm pretty sure the existing opcodes will continue working as is
<Corbin>
zozozo: Yes. It's a very verbose target, and also not stable; otherwise it would be fine.
<Corbin>
Okay, but I *already* have everything working on CHICKEN Scheme already and the speed's acceptable. It will be nice to try OCaml again once flambda2 is available.
<Drup>
wait, bytecode *is* fairly stable
<companion_cube>
for sure, scheme will be simpler
<Drup>
I mean, it changes once in a blue moon, and it's always very minor
<Drup>
(also, generating names is not silly at all for a to-source compiler, it's rather standard, and given that eta-reduction is not type preserving in ocaml because of value restriction, it's rather necessary)
mro has joined #ocaml
hackinghorn has joined #ocaml
hornhack has joined #ocaml
hackinghorn has quit [Ping timeout: 240 seconds]
hornhack has quit [Ping timeout: 248 seconds]
olle has joined #ocaml
mro has quit [Ping timeout: 258 seconds]
hendursa1 has quit [Quit: hendursa1]
hendursaga has joined #ocaml
waleee has joined #ocaml
mro has joined #ocaml
gravicappa has joined #ocaml
mro has quit [Ping timeout: 245 seconds]
favonia has quit [Ping timeout: 248 seconds]
olle has quit [Ping timeout: 252 seconds]
mro has joined #ocaml
mbuf has quit [Quit: Leaving]
mro has quit [Ping timeout: 268 seconds]
favonia has joined #ocaml
glassofethanol has quit [Quit: leaving]
mro has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
mro has quit [Remote host closed the connection]
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
mro has quit [Ping timeout: 240 seconds]
olle has joined #ocaml
mro has joined #ocaml
mro has quit [Ping timeout: 245 seconds]
mro has joined #ocaml
Haudegen has joined #ocaml
mro has quit [Ping timeout: 252 seconds]
Tuplanolla has joined #ocaml
mro has joined #ocaml
mro has quit [Ping timeout: 245 seconds]
mro has joined #ocaml
mro has quit [Ping timeout: 240 seconds]
mro has joined #ocaml
mro has quit [Ping timeout: 248 seconds]
mro has joined #ocaml
olle has quit [Ping timeout: 240 seconds]
gravicappa has quit [Ping timeout: 252 seconds]
gravicappa has joined #ocaml
gravicappa has quit [Ping timeout: 252 seconds]
olle has joined #ocaml
mro has quit [Quit: Leaving...]
olle has quit [Ping timeout: 252 seconds]
hackinghorn has joined #ocaml
hendursaga has quit [Remote host closed the connection]
hendursaga has joined #ocaml
favonia has quit [Ping timeout: 252 seconds]
cedric has joined #ocaml
Serpent7776 has quit [Quit: leaving]
favonia has joined #ocaml
Haudegen has quit [Quit: No Ping reply in 180 seconds.]
Haudegen has joined #ocaml
bartholin has quit [Quit: Leaving]
zebrag has joined #ocaml
cedric has quit [Quit: Konversation terminated!]
<d_bot>
<froyo> @ostera : there's that one "stream fusion to completeness" paper