AnAverageHuman has quit [Ping timeout: 256 seconds]
pierpal has quit [Remote host closed the connection]
olle__ has joined #ocaml
loli has quit [Ping timeout: 245 seconds]
loli has joined #ocaml
silver has quit [Read error: Connection reset by peer]
iovec has quit [Quit: Connection closed for inactivity]
marvin2 has quit []
loli has quit [Ping timeout: 240 seconds]
loli has joined #ocaml
dedgrant has quit [Ping timeout: 240 seconds]
kroot_ has quit [Remote host closed the connection]
kroot_ has joined #ocaml
AnAverageHuman has joined #ocaml
gravicappa has joined #ocaml
tormen has joined #ocaml
iovec has joined #ocaml
tormen_ has quit [Ping timeout: 268 seconds]
jao has quit [Ping timeout: 250 seconds]
loli has quit [Ping timeout: 250 seconds]
doesntgolf has quit [Remote host closed the connection]
loli has joined #ocaml
AnAverageHuman has quit [Ping timeout: 256 seconds]
keep_learning has joined #ocaml
loli has quit [Ping timeout: 246 seconds]
sagotch has joined #ocaml
loli has joined #ocaml
sagotch has quit [Read error: Connection timed out]
sagotch has joined #ocaml
abdallah has joined #ocaml
abdallah has quit [Client Quit]
KeyJoo has joined #ocaml
pierpal has joined #ocaml
loli has quit [Ping timeout: 250 seconds]
loli has joined #ocaml
sagotch has quit [Quit: Leaving.]
freyr69 has joined #ocaml
ziyourenxiang has quit [Ping timeout: 268 seconds]
sagotch has joined #ocaml
Haudegen has joined #ocaml
ggole has joined #ocaml
Birdface has joined #ocaml
loli has quit [Ping timeout: 250 seconds]
loli has joined #ocaml
KeyJoo has quit [Quit: KeyJoo]
KeyJoo has joined #ocaml
status402 has joined #ocaml
Khady has quit [Remote host closed the connection]
Khady has joined #ocaml
Khady has quit [Changing host]
Khady has joined #ocaml
Khady has quit [Client Quit]
Khady has joined #ocaml
Khady has quit [Changing host]
Khady has joined #ocaml
dhil has joined #ocaml
GeoffK has joined #ocaml
linse has joined #ocaml
olle__ has quit [Ping timeout: 268 seconds]
asymptotically has joined #ocaml
linse has quit [Read error: Connection reset by peer]
status402 has quit [Quit: status402]
linse has joined #ocaml
status402 has joined #ocaml
loli has quit [Ping timeout: 244 seconds]
GeoffK has quit [Ping timeout: 250 seconds]
GeoffK has joined #ocaml
GeoffK has quit [Remote host closed the connection]
GeoffK has joined #ocaml
GeoffK has quit [Remote host closed the connection]
GeoffK has joined #ocaml
GeoffK has quit [Remote host closed the connection]
loli has joined #ocaml
status402 has quit [Ping timeout: 245 seconds]
bartholin has joined #ocaml
linse has quit [Read error: Connection reset by peer]
linse has joined #ocaml
status402 has joined #ocaml
jao has joined #ocaml
sagotch has quit [Quit: Leaving.]
status402 has quit [Ping timeout: 258 seconds]
status402 has joined #ocaml
Birdface has quit [Ping timeout: 268 seconds]
ziyourenxiang has joined #ocaml
jao has quit [Ping timeout: 250 seconds]
Birdface has joined #ocaml
loli has quit [Ping timeout: 268 seconds]
ollehar has joined #ocaml
Haudegen has quit [Read error: Connection reset by peer]
bartholin has quit [Ping timeout: 250 seconds]
Haudegen has joined #ocaml
loli has joined #ocaml
<freyr69>
Are there any examples of a Dune+Ctypes setup?
<freyr69>
For stubs generation
status402 has quit [Read error: Connection reset by peer]
status402 has joined #ocaml
bartholin has joined #ocaml
engil has quit [Ping timeout: 250 seconds]
MarcWeber has joined #ocaml
<MarcWeber>
I've been thinking a lot about what language to use. For instance at the moment I need a library whichcan target both plv8 (JS) (synchrotously) and postgresql database, maybe node.
<MarcWeber>
So I found reason by accident, but was surprised it did use Promise .then style a lot. But Ocaml has monads, so there should be nice abstractions possible.
<MarcWeber>
What about type safe queries? WHat libraries to look at?
<MarcWeber>
And can you implement functions which turn into async implementations once you use one async function?
status402 has quit [Remote host closed the connection]
sagotch has joined #ocaml
<freyr69>
Caqti for postgres
<adrien>
(or other dbs too)
<freyr69>
You can functorize your io for async
<adrien>
and there's stuff for node too but I'm not very knowledgeable on the topic
<freyr69>
Like mirage does, but you would still need to write separate implementations for each io type
<Drup>
for asynchronous things, most peole use Lwt or Async. Both also work in JS with jsoo. For bucklescript, use repromise, it's better than the builtin API
<Drup>
MarcWeber: That's just a research prototype, the libraries is not production ready =)
<Drup>
caqti is more solid
mfp has joined #ocaml
KeyJoo has quit [Quit: KeyJoo]
Haudegen has quit [Remote host closed the connection]
sagotch has quit [Quit: Leaving.]
KeyJoo has joined #ocaml
loli has quit [Ping timeout: 246 seconds]
marvin2 has joined #ocaml
loli has joined #ocaml
<freyr69>
This expression has type int Cyusb__Cyusb_generated.return
<freyr69>
but an expression was expected of type 'a Lwt.t
<freyr69>
Why does it generate Cyusb__Cyusb_generated.return instead of Lwt.t with Cstubs.lwt_jobs?
<freyr69>
Ok
<freyr69>
It seems it wraps lwt thread in a record
<freyr69>
{ lwt : 'a Lwt.t }
<freyr69>
why?
<freyr69>
The documentation says that it should be 'a Lwt.t, not { 'a Lwt.t }
KeyJoo has quit [Remote host closed the connection]
KeyJoo has joined #ocaml
q9929t has joined #ocaml
silver has joined #ocaml
dhil has quit [Ping timeout: 268 seconds]
q9929t has quit [Quit: q9929t]
Haudegen has joined #ocaml
dhil has joined #ocaml
<freyr69>
Is it safe to write bigarray out of C code while GIL is released?
lobo has quit [Ping timeout: 250 seconds]
<ggole>
iirc the GC won't move bigarray memory at any time
<freyr69>
ggole: can I wrap dynamically allocated memory in Bigarray out of C? Who would free the memory then? It seems caml_ba_alloc is meant for static arrays.
loli has quit [Ping timeout: 240 seconds]
ziyourenxiang has quit [Quit: Leaving]
<ggole>
Yeah, you can do that. You have to arrange for the memory to be freed.
jbrown has quit [Ping timeout: 258 seconds]
<freyr69>
By setting CAML_BA_EXTERNAL flag?
<freyr69>
CAML_BA_MANAGED
<freyr69>
it seems
<ggole>
Use caml_ba_alloc and free the memory yourself on the C side
<ggole>
The problem is knowing when it's safe to do that
<freyr69>
What's the best way to wrap an opaque pointer, Custom value?
FreeBirdLjj has joined #ocaml
lobo has joined #ocaml
AnAverageHuman has joined #ocaml
jbrown has joined #ocaml
indistylo has quit [Read error: Connection reset by peer]
loli has quit [Ping timeout: 246 seconds]
ygrek has quit [Remote host closed the connection]
freyr69 has quit [Remote host closed the connection]
loli has joined #ocaml
AnAverageHuman has quit [Ping timeout: 256 seconds]
aciniglio has joined #ocaml
sagotch has joined #ocaml
jao has joined #ocaml
AnAverageHuman has joined #ocaml
sagotch has quit [Quit: Leaving.]
pierpal has quit [Quit: Poof]
pierpal has joined #ocaml
<cemerick>
companion_cube: is there any way to check sequence emptiness without advancing the iteration? I don't want persistence in this case, so it looks like matching on `head` and then consing any `Some` result back onto the remainder of the source sequence is the only way?
<companion_cube>
`Sequence` is really not designed to be consumed item by item
kakadu has quit [Quit: Konversation terminated!]
loli has quit [Ping timeout: 246 seconds]
<cemerick>
weird, `is_empty` works as I'd expect in the repl (i.e. doesn't advance the sequence), but the real code seems to need persistent :-/
<Armael>
are you talking about Seq?
<cemerick>
companion_cube: I guess, but one does need to made decisions based on sequence contents, etc
<Drup>
companion_cube: you could have a function `if_empty : (unit -> 'a t) -> 'a t -> 'a t` that is lazy, or something the like
<Drup>
not sure if that's sufficient for what cemerick wants
<Armael>
companion_cube: shouldn't you have the repo redirect to c-cube/iter ?
<companion_cube>
I mean, you almost never need `is_empty` only once, right?
<companion_cube>
Armael: yes but no, it breaks hashes of previous releases.
<companion_cube>
(I tried)
<Armael>
ugh..
<companion_cube>
yeah
<companion_cube>
this annoys me.
<Armael>
is it enough to do one bulk update of the opam packages?
<Drup>
yes, it is
AnAverageHuman has quit [Ping timeout: 256 seconds]
loli has joined #ocaml
aciniglio has quit [Ping timeout: 240 seconds]
<cemerick>
Drup: at the moment, I'm not sure what I want. I must be doing something wrong.
<cemerick>
In every way I can tell (in utop, in a sample simple program, etc), both `is_empty` and `head` do not advance the sequence; but in "real" code, they absolutely seem to, and just applying `persistent` prior to examining any sequence like this yields expected results.
Haudegen has quit [Remote host closed the connection]
<Armael>
AFAIU with sequence, whenever you want to inspect a sequence you have to traverse it fully, so I don't see how is_empty could work without advancing it
<companion_cube>
exactly.
<Armael>
(because you don't have control over the iteration, you basically call some "iter" function)
<companion_cube>
(unless you use `persistent` or such, because then you can restart iteration safely)
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
<notnotdan>
What should I look into if I want to do parsing of binary formats? For instance, I've mmapped the contents of a file to memory, and now I want to print a string that is at offset 10, and then an integer that is at offset 20? In C I can simply to `char* s = &m[10];` and `unit16 i = (uint16_t) m[20]`.
<notnotdan>
The only sensible API methods that I see in the Bigarray module are get and set for individual elements
<companion_cube>
angstrom, I think, notnotdan
<companion_cube>
or ppx cstruct
<Armael>
cemerick: well, the sequence you create with of_list is persistent I assume
<Armael>
so here the list "lst" just gets traversed twice
<companion_cube>
yes, anything build from in memory structures that don't change is safe to traverse twice
FreeBirdLjj has quit [Ping timeout: 258 seconds]
<companion_cube>
the big exceptions to that are: IO streams, and iterator over a container that has been muted since (like a hashtable)
<Drup>
(wtb iterator invalidation :p)
<notnotdan>
companion_cube: i dont think there is a way to tell angstrom to just read one integer
<cemerick>
companion_cube: not sure what to say; I have roughly the same code driving a traversal over items stored in a graph, where members are pulled from a list on vertices. Adding a `persistent` call yields different behaviour.
<notnotdan>
oh wait nvm, I must have been looking at a wrong place
<cemerick>
the alternative I landed on was using head, and then consing that back onto the rest of the sequence if it exists
<companion_cube>
notnotdan: hmmm no idea about buffering
<companion_cube>
cemerick: :/
ollehar has quit [Ping timeout: 246 seconds]
<companion_cube>
you're not doing that in a loop, are you?
<cemerick>
so e.g. if I remove `persistent` here, the returned `neighbors` is missing the first element in `t.members`
<companion_cube>
ah it's because it's one value!
<companion_cube>
try `let neighbors k = โฆ |> Sequence.iter k`
<companion_cube>
(instead of the persistent)
kakadu has joined #ocaml
nikivi has quit [Quit: ZNC is awesome]
<cemerick>
companion_cube: same behaviour
linse has quit [Quit: linse]
<cemerick>
can you clarify re: "one value"?
<Drup>
cemerick: you need to eta expand :)
ggole has quit [Quit: Leaving]
<companion_cube>
`neighbors` is a closure that contains some internal state
<companion_cube>
so if you traverse it twice (`is_empty` and then normally) the state isn't reset between the two traversals
<Drup>
Of course, the tradeoff is that you recompute the filters twice if you remove the persistency ....
nikivi has joined #ocaml
<cemerick>
whooo, ok, I see what's up
<Drup>
a function `if_empty: 'a t -> (unit -> 'b) -> ('a t -> 'b) -> 'b` would help, I suppose.
<cemerick>
much better would be `peakable` as an alternative to `persistent`
<cemerick>
a la rust, I guess
<Drup>
cemerick: Well, it's called `Seq` ...
<cemerick>
which I guess is what I backed into via my `match head s with Some x -> cons x s ...` bit
<cemerick>
Drup: too many things are called seq :-P
<Drup>
yeah, let's just stop calling it sequence and agree on "Iter"
<Drup>
( companion_cube just rename it already x)
<cemerick>
I can do that as soon as it says so in the code
<companion_cube>
Drup: I just wish renaming the repo didn't break past releases
<Drup>
companion_cube: just do it, and patch opam repo, it'll be done.
<Drup>
Just rip the bandaid off instead of agonizing over it :)
<Drup>
cemerick: If you start wanting to really manipulate the elements explicitely, you should use Seq, not Iter. Iter is really only good at iterations
<companion_cube>
ughhhhhhh
<companion_cube>
then I need to also do a release on the fly, that's going to take some motivation
<cemerick>
Drup: Sequence really is perfect. The breadth of the library is unmatched elsewhere AFAICT. Maybe I'll put together a `peekable` PR, since this is the only sort of pattern that is a slight misfit.
<companion_cube>
Drup: I'm at work, and will not have time tonight
<companion_cube>
otoh if you want to help, I'm happy you're watching this video ;)
<companion_cube>
cemerick: have you looked at OSeq? :)
<companion_cube>
(and if things are missing compared to Sequence, open issues?)
<Drup>
(OSeq is Seq, but with all the combinators for ... the rest of the universe)
<Drup>
from*
<companion_cube>
hmm I should release oseq again I guess, Armael contributed sth
<Drup>
a cycle detection algorithm ? :D
<companion_cube>
almost as complicated: `find_map` :p
<companion_cube>
hmm I see that a lot of the relational-ish stuff is missingโฆ
<cemerick>
oh good another seqiterllistgen library ๐
<companion_cube>
it's Seq-compatible
<companion_cube>
:p
<Drup>
cemerick: honestly, the confusion of name and history make it more complicated than it is
<cemerick>
I know, I'm just trolling companion_cube a bit :-)
<cemerick>
I'm actually in a place now where I have a nontrivial amount of nicely-working reasonably-fast code, so I'm super not shopping for new foundational APIs
<Drup>
Ideally, the compiler would be good enough so that Seq is the same speed as Iter, really :/
<companion_cube>
:/
<companion_cube>
it does require more effort from the optimiser though
<companion_cube>
cemerick: if you want to discuss a `peekable` API, feel free to open an issue!
<cemerick>
companion_cube: I'm on a sprint to get a prototype finished, but will do :-)
<companion_cube>
sure, I'm not going to release ~iter~ sequence right now anyway
<companion_cube>
despite Drup's sense of urgency
loli has quit [Ping timeout: 258 seconds]
<Drup>
it's not urgency as much as "it's fucking time"
<companion_cube>
well the branch has everything, but releasing + moving repo + fixing opam-repo is going to be a PITA
<companion_cube>
(do you want admin rights? cause it's how you get admin rights :p)
* cemerick
will just keep calling it Sequence as a motivator ๐
<companion_cube>
๐
<Drup>
companion_cube: if you give me admin rights, I _might_ do it, if and when I have time, which is no garantee to happen in the current circumstances
<companion_cube>
alright, since I'm in the same situation, let's do it :p
dedgrant has joined #ocaml
Serpent7776 has joined #ocaml
loli has joined #ocaml
<cemerick>
is there any tooling (e.g. around merlin or whatever) that understands the contents of qtest comments?
<companion_cube>
sadly, not
<cemerick>
it's so strange to me that a language with pretty solid type discipline otherwise has attracted the use of code in _comments_ of all things
<companion_cube>
it's old AF
<companion_cube>
qtest predates ppx
<cemerick>
reminds me of my python days
<cemerick>
likewise expect-style stuff
<companion_cube>
I don't even know what the ppx modern equivalent is
<companion_cube>
oh god, ppx_inline_test depends on base
<companion_cube>
I should do a ppx_qtest
thizanne_ is now known as thizanne
<cemerick>
Really anything is better than code in comments
<companion_cube>
well it's code that's checked at test time, by definition ^^'
linse has joined #ocaml
gravicappa has quit [Ping timeout: 258 seconds]
jbrown has quit [Ping timeout: 244 seconds]
amcorvi has joined #ocaml
olle_ has joined #ocaml
ravenousmoose has joined #ocaml
johnelse has quit [Ping timeout: 258 seconds]
loli has quit [Ping timeout: 258 seconds]
KeyJoo has quit [Quit: KeyJoo]
dedgrant has quit [Quit: Leaving]
johnelse has joined #ocaml
loli has joined #ocaml
<Leonidas>
companion_cube: could've used camlp4 instead of ppx back then *ducks*
<companion_cube>
ugh, no
<companion_cube>
I'd rather use comments, thank you
dhil has quit [Ping timeout: 268 seconds]
bugabinga has quit [Quit: bugabinga]
bugabinga has joined #ocaml
loli has quit [Ping timeout: 246 seconds]
kjak has joined #ocaml
loli has joined #ocaml
ravenousmoose has quit [Quit: Taking a quick nap...ZZzzz]
Serpent7776 has quit [Quit: leaving]
jbrown has joined #ocaml
bugabinga has quit [Quit: bugabinga]
linse has quit [Quit: linse]
iovec has quit [Quit: Connection closed for inactivity]
asymptotically has quit [Quit: Leaving]
olle_ has quit [Ping timeout: 245 seconds]
loli has quit [Ping timeout: 250 seconds]
bartholin has quit [Remote host closed the connection]
spew has quit [Quit: going home]
loli has joined #ocaml
kakadu has quit [Remote host closed the connection]