<rgrinberg>
i wonder if ocamlmq could run well on mirage
<rgrinberg>
you'd need something else for persistence
<Drup>
rgrinberg: cowablog² :]
AlexRussia has joined #ocaml
<mfp>
it could be sort of fun to build a mini-leveldb directly on a mirage block device
<mfp>
oh noes "2. A Keyword has priority over Match and Region items." I can't match let% w/o hacking the std ocaml.vim syntax and removing regular "let"'s highlight :-/
<rgrinberg>
no way to remove a syntax keyword with a command?
<mfp>
rgrinberg: re blog shopping, isn't it almost faster to hack something with opium, omd and cheapo poll-FS style persistence (so that you can run on mirage), the same way ocsiblog did, than looking for something able to run on mirage?
Submarine has quit [Ping timeout: 256 seconds]
AltGr has joined #ocaml
<mfp>
maybe if I set % as a keyword char (iskeyword)
mfp has left #ocaml ["Leaving"]
mfp has joined #ocaml
<rgrinberg>
that's a good idea. Wil speed me towards getting opium working on mirage
<mfp>
I assumed you wanted to run it on mirage, with no reason :P
<rgrinberg>
running your blog on mirage is what the cool kids these days
<rgrinberg>
there's even ssl now
<mfp>
> my tired brain just mixing up things after I read the latest ocaml.reddit posting on exactly that
<Drup>
I'm not a cool kid, I just want to have static stuff with custom preprocessing rules x)
<mfp>
how is ocaml-tls going speed-wise?
<Drup>
so that I can host everything in github pages and be done with it :>
<rgrinberg>
mfp: i believe it hosts openmirage.org
<mfp>
it was IIRC 5X slower than openssl ocaml-ssl IIRC
<rgrinberg>
you can try ddosing that for a datapoint :D
<Drup>
I'm sure mirage people would appreciate the experiment :D
<rgrinberg>
mfp: is that from your own benchmarks or somewhere on the web?
<whitequark>
how about just putting the fucking version there
<Drup>
meh
<whitequark>
this "dev" is very annoying, because it screws up the constraints elsewhere
<Drup>
the converse is true too
<whitequark>
how so?
<Drup>
opam will assume constraint are respected when they aren't
<whitequark>
they aren't?
<Drup>
(if you broke compat)
<Drup>
anyway, jerome will do whatever he wants.
antinomy has quit [Ping timeout: 272 seconds]
travisbrady has joined #ocaml
waneck_ has joined #ocaml
waneck has quit [Ping timeout: 245 seconds]
<rgrinberg>
Drup: thanks
Submarine has quit [Quit: Leaving]
<rgrinberg>
yeah that looks good. i didn't realize re's packaging was mostly okay
<rgrinberg>
it would be good to require oasis in dev like in your packages
antegallya has quit [Ping timeout: 260 seconds]
<Drup>
not necesseray
<Drup>
it's normal oasis setup in re
<rgrinberg>
also was the comment about jerome with regards to re or your convo with whitequark?
<Drup>
to the comment from whitequark
<rgrinberg>
ok, i thought i missed something :D
ygrek has quit [Ping timeout: 256 seconds]
antinomy has joined #ocaml
struktured has joined #ocaml
<rgrinberg>
Drup: how come ocsigenserver doesn't use oasis (or at least oasis)
<rgrinberg>
i remember there was a good reason for eliom
<Drup>
the reason is that nobody succeeded at converting the set of makefile to ocamlbuild T__T
<Drup>
(js_of_ocaml also uses makefiles, but those are mostly clean, so we don't need to switch)
<Drup>
(there is an ocamlbuild version, but it was slower and didn't bring anything new, so it was just droped)
kakadu has quit [Remote host closed the connection]
rgrinberg has quit [Quit: Leaving.]
<whitequark>
not having makefiles is a feature
rgrinberg has joined #ocaml
rgrinberg has quit [Read error: Connection reset by peer]
rgrinberg1 has joined #ocaml
<rgrinberg1>
the whole ocamlbuild being extensible thing is so lost on me. what's the point if 99% of the time you can't customize anything since you're using generated crap from oasis
<rgrinberg1>
oasis could just as well generate some sh file to drive ocamlbuild
<Drup>
x)
<whitequark>
that's actually not far from what it does
<struktured>
ocamlbuild looks like the end game, but for some reason oasis thought it wasn't
<whitequark>
oasis is basically "NIH, the software"
<rgrinberg1>
if anything it would have made sense if oasis was some ocamlbuild plugin
<whitequark>
it reimplements everything ocamlbuild does, poorly
<whitequark>
rgrinberg1: it predates ocamlbuild plugins
<Drup>
it also tries to fix ocamlbuild's issues
<Drup>
or rather "tried"
<rgrinberg1>
whitequark: why would it choose ocamlbuild as the target though
<rgrinberg1>
imo obuild is the most sane
<Drup>
availability, I guess
<whitequark>
it predates obuild
<whitequark>
by many, many years
jao has joined #ocaml
jao has quit [Changing host]
jao has joined #ocaml
jwatzman|work has quit [Quit: jwatzman|work]
<rgrinberg1>
it would be perfect except for its aversion to dependencies :/
<struktured>
so...if oasis is not great, and ocamlbuild is not enough...what do I pick exactly? or should something else be written?
<rgrinberg1>
struktured: if you have a simple project + little time to mess around + hate waiting around for ocamlbuild then obuild is pretty much the only game in town
<whitequark>
ocamlbuild is just fine
<rgrinberg1>
whitequark: how? by itself its almost useless. also its too slow
<Drup>
oasis is really not that much of an issue for simple projects ...
<rgrinberg1>
struktured: obuild is easy and intuitive. the only minus is the cli interface sucks b/c its home made
<struktured>
rgrinberg1: will take a look, thanks
NoNNaN has joined #ocaml
rgrinberg1 has quit [Quit: Leaving.]
HrafnA has quit [Quit: HrafnA]
shinnya has quit [Ping timeout: 250 seconds]
lordkryss has quit [Quit: Connection closed for inactivity]
nojb has joined #ocaml
ygrek has joined #ocaml
rgrinberg has joined #ocaml
rgrinberg has quit [Client Quit]
q66 has quit [Quit: Leaving]
<sdegutis>
Out of the four types of apps people write (web apps, GUI apps, command line utils, background processes), which is OCaml most ideal for?
<whitequark>
generally, last two
<Drup>
web apps aren't too bad either :]
<sdegutis>
Hmm. I don't write the last two ever.
<sdegutis>
Is OCaml excellent at interfacing with Objective-C?
<sdegutis>
I do have a command line app I wouldn't mind writing in something new, as long as it can access Objective-C and C fairly simply.
<joncfoo>
I think you might have more luck with the c interface
<sdegutis>
Sounds like I have no use for experimenting with OCaml :(
<sdegutis>
Wish I did.
<joncfoo>
I'm using it to write a piece of a system that I'm writing to handle computations around money
<joncfoo>
it's kinda important I do it correctly heh
<joncfoo>
calculating fees around specified schedules
<joncfoo>
I don't really trust myself to get it right with python which is what the rest of the system is written in
<joncfoo>
the type system helps a lot w/regards to modeling the data and making sure I cover all the possible case
<joncfoo>
cases*
<sdegutis>
Oh :)
<joncfoo>
right now I only have a cmd line interface which...works for the traffic i'm expecting (not much)
lostman has joined #ocaml
<joncfoo>
ideally I'd love to write the entire web app in ocaml but I suppose it's enough to get my feet wet for now
<lostman>
Hi all. I'm trying to write a simple app using cohttp and websocket and I can't figure out how to have cohttp server where one of the routes upgrades to websocket connection. Basically host:8080/foo is a normal route and host:8080/bar is websocket. Any ideas?
nullcat_ has quit [Ping timeout: 264 seconds]
srcerer_ has joined #ocaml
ebzzry_ has quit [Ping timeout: 256 seconds]
srcerer has quit [Ping timeout: 272 seconds]
srcerer_ is now known as srcerer
Puffin has quit [Ping timeout: 240 seconds]
rgrinberg has joined #ocaml
MrScout_ has joined #ocaml
MrScout has quit [Ping timeout: 258 seconds]
MrScout_ has quit [Ping timeout: 258 seconds]
koderok has joined #ocaml
koderok has quit [Client Quit]
darkf has joined #ocaml
srcerer has quit [Ping timeout: 272 seconds]
<joncfoo>
is CCError similar to BatResult?
* joncfoo
stares and it
<struktured>
companion_cube: ccmultiset still work for you? getting undefined global in utop, not sure why
<struktured>
I actually really like markdown now that I get the point of it. looks ok in text and the web
jonludlam has quit [Quit: Coyote finally caught me]
kido1412 has joined #ocaml
Anarchos has joined #ocaml
MrScout has joined #ocaml
MrScout__ has quit [Ping timeout: 258 seconds]
martintrojer has quit [Max SendQ exceeded]
martintrojer has joined #ocaml
MrScout has quit [Ping timeout: 264 seconds]
<kido1412>
hi, I'm reading the book "unix system programming in ocaml", there's one line code in my file ` in_fd : file_descr;`, and I can corebuild this file. But when I try to #use this file in utop, it tells me that "Unbound type constructor file_descr". How to fix it?
<kido1412>
I have try to open Unix;; in utop first, but still failed.
martintrojer has quit [Max SendQ exceeded]
martintrojer has joined #ocaml
pgomes has quit [Ping timeout: 245 seconds]
martintrojer has quit [Max SendQ exceeded]
<adrien>
is "unix.cma" loaded?
martintrojer has joined #ocaml
<kido1412>
@adrien #load "unix.cma";; done, but still that error
<adrien>
and _then_ open Unix?
<kido1412>
I have google for solution, I know I need to #load "unix.cma";; then open Unix;;, but still an error. I think that some conflict with Core.Std or something.
<whitequark>
don't say "an error". tell us what error exactly do you get.
<kido1412>
File "fd_lib.ml", line 5, characters 10-20: Error: Unbound type constructor file_descr
liweijian has joined #ocaml
<whitequark>
hm
nuki has joined #ocaml
<whitequark>
indeed, try not opening Core.Std
<nuki>
Excuse me, but it's possible to generate unit value (as an parsetree.expression) for -ppx?
<MercurialAlchemi>
kido1412: what if you use Unix.file_descr?
<kido1412>
Error: Unbound type constructor Unix.file_descr
<whitequark>
nuki: open Ast_helper;; Exp.unit ();;
<whitequark>
or -require ppx_tools.metaquot and [%expr ()]
<whitequark>
the latter is more elegant, when it is possible
<whitequark>
George___: apt-get and opam if you use system compiler, only opam if not
<alpha06>
mrvn: ?
<mrvn>
alpha06: line 3 is a tupple, line 5 a list. That's not the same type.
<alpha06>
“This pattern matches values of type 'a list but a pattern was expected which matches values of type”
<George___>
it says it is alrady installed (the newest version)
<mrvn>
alpha06: you need one function to print the list and one for the whole thing
bezirg has quit [Ping timeout: 258 seconds]
<alpha06>
mrvn: can you suggest me something to read? Because I can’t write a function like that.. because if I try to match first the tuple and then the list I always got some type error :/
<mrvn>
alpha06: any introductory book on ocaml
<George___>
camlp4 is installed, but not sexplib.syntax
arj has quit [Ping timeout: 265 seconds]
ygrek has quit [Ping timeout: 245 seconds]
bytbox has joined #ocaml
jonludlam has joined #ocaml
Simn has quit [Ping timeout: 260 seconds]
antinomy has quit [Ping timeout: 260 seconds]
demonimin has quit [Ping timeout: 260 seconds]
jcloud has quit [Ping timeout: 260 seconds]
dch has quit [Ping timeout: 260 seconds]
msch has quit [Ping timeout: 260 seconds]
nuki has quit [Remote host closed the connection]
jeroud has quit [Ping timeout: 260 seconds]
andreypopp_ has quit [Ping timeout: 260 seconds]
kgzm has quit [Ping timeout: 260 seconds]
bobpoekert has quit [Ping timeout: 260 seconds]
ruoso_ has quit [Ping timeout: 260 seconds]
lostman has quit [Ping timeout: 260 seconds]
chris2 has quit [Ping timeout: 260 seconds]
sgnb` has quit [Ping timeout: 260 seconds]
kakadu has quit [Remote host closed the connection]
_whitelogger has quit [Ping timeout: 260 seconds]
_whitelogger has joined #ocaml
mort___ has joined #ocaml
cdidd has quit [Ping timeout: 258 seconds]
thomasga has quit [Quit: Leaving.]
arj has joined #ocaml
psy_ has quit [Ping timeout: 264 seconds]
nojb has quit [Quit: nojb]
nojb has joined #ocaml
arj has quit [Ping timeout: 258 seconds]
psy_ has joined #ocaml
ingsoc1 has joined #ocaml
ingsoc has quit [Ping timeout: 272 seconds]
Sim_n is now known as Simn
kakadu has joined #ocaml
arj has joined #ocaml
antegallya has quit [Remote host closed the connection]
ygrek has joined #ocaml
joncfoo has joined #ocaml
sgnb`` is now known as sgnb
rand000 has joined #ocaml
ontologiae_ has quit [Ping timeout: 264 seconds]
Yoric has quit [Remote host closed the connection]
Yoric has joined #ocaml
Yoric_ has joined #ocaml
Yoric__ has joined #ocaml
Yoric___ has joined #ocaml
Yoric____ has joined #ocaml
Yori_____ has joined #ocaml
Yoric____ has quit [Read error: Connection reset by peer]
Yoric has quit [Ping timeout: 265 seconds]
Yori_____ has quit [Read error: Connection reset by peer]
Yoric has joined #ocaml
Yoric_ has quit [Ping timeout: 265 seconds]
Yoric__ has quit [Ping timeout: 265 seconds]
Yoric___ has quit [Ping timeout: 244 seconds]
Yoric_ has joined #ocaml
axiles has quit [Quit: Quitte]
Yoric__ has joined #ocaml
Yoric___ has joined #ocaml
Yoric__ has quit [Read error: Connection reset by peer]
Yoric has quit [Ping timeout: 244 seconds]
Yoric has joined #ocaml
Yoric__ has joined #ocaml
Yoric has quit [Read error: Connection reset by peer]
Yoric_ has quit [Ping timeout: 244 seconds]
Yoric__ has quit [Read error: Connection reset by peer]
Yoric has joined #ocaml
Yoric_ has joined #ocaml
Yoric___ has quit [Ping timeout: 265 seconds]
Yoric__ has joined #ocaml
Yoric___ has joined #ocaml
Yoric____ has joined #ocaml
Yoric has quit [Ping timeout: 244 seconds]
Yoric____ has quit [Read error: Connection reset by peer]
Yoric____ has joined #ocaml
Yoric_ has quit [Ping timeout: 265 seconds]
Yoric__ has quit [Ping timeout: 244 seconds]
Yoric_ has joined #ocaml
Yoric___ has quit [Ping timeout: 244 seconds]
Yoric_ has quit [Read error: Connection reset by peer]
Yoric__ has joined #ocaml
Yoric_ has joined #ocaml
cantstanya has quit [Quit: WeeChat 1.0]
Yoric_ has quit [Read error: Connection reset by peer]
Yoric has joined #ocaml
cantstanya has joined #ocaml
Yoric has quit [Read error: Connection reset by peer]
Yoric has joined #ocaml
Yoric____ has quit [Ping timeout: 265 seconds]
cantstanya has quit [Changing host]
cantstanya has joined #ocaml
Yoric_ has joined #ocaml
Yoric__ has quit [Ping timeout: 244 seconds]
AltGr has left #ocaml [#ocaml]
Yoric__ has joined #ocaml
Yoric___ has joined #ocaml
Yoric__ has quit [Read error: Connection reset by peer]
Yoric__ has joined #ocaml
Yoric has quit [Ping timeout: 265 seconds]
Yoric_ has quit [Ping timeout: 265 seconds]
Yoric__ has quit [Read error: Connection reset by peer]
Yoric has joined #ocaml
Yoric_ has joined #ocaml
Yoric__ has joined #ocaml
Yoric___ has quit [Ping timeout: 244 seconds]
joncfoo has quit [Ping timeout: 250 seconds]
Yoric___ has joined #ocaml
Yoric has quit [Ping timeout: 244 seconds]
Yoric has joined #ocaml
Yoric_ has quit [Ping timeout: 244 seconds]
Yoric has quit [Read error: Connection reset by peer]
Yoric____ has joined #ocaml
Yoric__ has quit [Ping timeout: 244 seconds]
Yoric has joined #ocaml
Yoric_ has joined #ocaml
Yoric___ has quit [Ping timeout: 258 seconds]
Yoric____ has quit [Ping timeout: 244 seconds]
Yoric has quit [Ping timeout: 264 seconds]
mcclurmc has joined #ocaml
Yoric has joined #ocaml
travisbrady has joined #ocaml
girrig_ has joined #ocaml
alpha06 has quit [Quit: alpha06]
clog_ has joined #ocaml
<whitequark>
Drup: btw, wasn't there a discussion about adding >>| to Lwt.Infix?
pgas` has joined #ocaml
engil1 has joined #ocaml
gdsfh1 has joined #ocaml
chris2_ has joined #ocaml
jerith_ has joined #ocaml
chris2 has quit [Disconnected by services]
chris2_ is now known as chris2
Yoric_ has quit [*.net *.split]
nojb has quit [*.net *.split]
clog has quit [*.net *.split]
gdsfh has quit [*.net *.split]
girrig has quit [*.net *.split]
Unhammer has quit [*.net *.split]
engil has quit [*.net *.split]
pii4 has quit [*.net *.split]
ski has quit [*.net *.split]
pgas has quit [*.net *.split]
jerith has quit [*.net *.split]
NoNNaN has quit [*.net *.split]
nicoo has quit [*.net *.split]
pii4 has joined #ocaml
nojb has joined #ocaml
ski has joined #ocaml
Unhammer has joined #ocaml
thomasga has joined #ocaml
<companion_cube>
whitequark: what's the point?
bezirg has quit [Ping timeout: 265 seconds]
bezirg has joined #ocaml
ontologiae_ has joined #ocaml
BitPuffin has joined #ocaml
<whitequark>
having the same bind/map operators as async
samrat has joined #ocaml
<companion_cube>
you're going to need a wrapper anyway, don't you?
Thooms has joined #ocaml
MrScout has joined #ocaml
ontologiae_ has quit [Ping timeout: 264 seconds]
axiles has joined #ocaml
<whitequark>
just for consistency
<whitequark>
not reusability
<companion_cube>
ok, sure
MrScout has quit [Remote host closed the connection]
antinomy_ has quit [Quit: WeeChat 1.0.1]
shinnya has joined #ocaml
toolslive has joined #ocaml
MrScout_ has joined #ocaml
MrScout_ has quit [Remote host closed the connection]
badon has quit [Disconnected by services]
badon_ has joined #ocaml
badon_ is now known as badon
rand000 has quit [Ping timeout: 244 seconds]
mcclurmc has quit [Remote host closed the connection]
mcclurmc has joined #ocaml
clog_ has quit [Quit: ^C]
clog has joined #ocaml
NoNNaN has joined #ocaml
chambart has joined #ocaml
nicoo has joined #ocaml
kapil__ has quit [Quit: Connection closed for inactivity]
darkf has quit [Quit: Leaving]
jao has joined #ocaml
jao has quit [Changing host]
jao has joined #ocaml
chinglish has joined #ocaml
arj has quit [Quit: Leaving.]
mcclurmc has quit [Remote host closed the connection]
bezirg has left #ocaml [#ocaml]
mcclurmc has joined #ocaml
samrat has quit [Quit: Computer has gone to sleep.]
nojb has quit [Quit: nojb]
jao has quit [Ping timeout: 264 seconds]
mcclurmc has quit [Remote host closed the connection]
ygrek has quit [Ping timeout: 272 seconds]
<Drup>
rgrinberg is categoria :O
* Drup
never connected the dots.
<Drup>
whitequark: there was a discussion about that, yes, but I don't remember where
<pyon>
Here is a toy Haskell program that uses GADTs: http://ideone.com/YN969J . I am trying to translate it to OCaml: https://eval.in/235577 . The only part that I could not translate is the "list" function. How should I translate it?
<Drup>
what is "fix" ?
<Drup>
(I have a guess, but I want to be sure)
<pyon>
In Haskell, it means greatest fixpoint, if I understand correctly. In OCaml, I would probably want to use a least fixpoint.
<pyon>
Basically, in the OCaml version, I would want a value that "points to itself", very much like "let rec xs = 1 :: xs".
<pyon>
Oh, and I forgot to translate "conv", but that one is easy.
<pyon>
Oh, never mind, I figured it out!
arquebus has quit [Quit: Konversation terminated!]
<Drup>
let list x = let rec y = Iso (Sum (Unit, Prod (x, y)), conv) in y
<Drup>
:D
<Drup>
(I have no idea if it's semantically valid, but it types !)
<pyon>
Yeah, that is exactly what I got! Thanks!
<pyon>
And my function is a little bit too strict.
mcclurmc has quit [Remote host closed the connection]
tharugrim has joined #ocaml
ygrek has quit [Ping timeout: 272 seconds]
q66 has joined #ocaml
slash^ has joined #ocaml
travisbrady has quit [Quit: travisbrady]
jwatzman|work has joined #ocaml
travisbrady has joined #ocaml
HrafnA has joined #ocaml
toolslive has quit [Quit: Leaving]
toolslive_ has joined #ocaml
matason has quit [Quit: Later!]
pyon is now known as pyon-gadt
pgomes has joined #ocaml
psy_ has quit [Quit: Leaving]
psy_ has joined #ocaml
WraithM has joined #ocaml
toolslive_ has left #ocaml ["Using Circe, the loveliest of all IRC clients"]
Hannibal_Smith has joined #ocaml
kakadu has quit [Ping timeout: 246 seconds]
struk|work has quit [Quit: Page closed]
<Thooms>
pyon-gadt: least fixed point, I think
waneck has joined #ocaml
<Thooms>
greatest fixed point is for coinductive types definition
<Thooms>
oh I didn't read all the log, don't mind me.
mort___ has quit [Ping timeout: 244 seconds]
waneck has quit [Ping timeout: 245 seconds]
waneck has joined #ocaml
MrScout has joined #ocaml
tizoc has quit [Quit: Coyote finally caught me]
tizoc has joined #ocaml
davine has joined #ocaml
davine has left #ocaml [#ocaml]
jonludlam has joined #ocaml
struk|work has joined #ocaml
kakadu has joined #ocaml
samrat has quit [Ping timeout: 264 seconds]
mcclurmc has joined #ocaml
waneck_ has joined #ocaml
chambart has quit [Ping timeout: 250 seconds]
mcclurmc has quit [Ping timeout: 256 seconds]
jao has joined #ocaml
jao has quit [Changing host]
jao has joined #ocaml
waneck has quit [Ping timeout: 240 seconds]
nuki has quit [Quit: ChatZilla 0.9.91 [Iceweasel 31.1.0/20140903072827]]
Arsenik has joined #ocaml
badkins has joined #ocaml
superjudge has left #ocaml [#ocaml]
Arsenik has quit [Ping timeout: 255 seconds]
yomimono has joined #ocaml
gdsfh has joined #ocaml
<yomimono>
Does anyone have recs for unit testing/randomized testing frameworks? I've been using oUnit + ocaml-quickcheck but it looks like ocaml-quickcheck isn't really maintained.
<yomimono>
I've seen references to Kaputt but it looks like there haven't been any updates to that since 2012.
igstan has joined #ocaml
* Drup
whispers something to companion_cube.
samrat has joined #ocaml
gdsfh1 has quit [Ping timeout: 264 seconds]
mcclurmc has joined #ocaml
larhat has quit [Quit: Leaving.]
__w_a_n_e_c_k__ has joined #ocaml
Arsenik has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
travisbrady has quit [Quit: travisbrady]
waneck_ has quit [Ping timeout: 244 seconds]
jonludlam has quit [Quit: Coyote finally caught me]
mcclurmc has joined #ocaml
_andre has quit [Quit: leaving]
pgomes has quit [Quit: Leaving]
jonludlam has joined #ocaml
chambart has joined #ocaml
pgomes has joined #ocaml
samrat has quit [Ping timeout: 245 seconds]
tani has joined #ocaml
arj has joined #ocaml
samrat has joined #ocaml
tane has quit [Ping timeout: 256 seconds]
Thooms has quit [Quit: WeeChat 1.0.1]
<icicled>
has anyone noticed this before: if the channel that really_input contains < N bytes then it doesn't even add the contents of the channel to the buffer
<icicled>
really_input uses*
<nojb>
that is the point of really_input
<icicled>
I was using CCIO.read_all and it wasn't returning the data that was available in the channel (socket) so I dug deeper
<icicled>
using the input function works though
<icicled>
ok, so it's not a bug then
ggole has quit []
yomimono has quit [Ping timeout: 265 seconds]
<icicled>
is there a function that I'm overlooking that will exhaust an input_channel?
manud has joined #ocaml
<nojb>
let read_all ic = really_input_string ic (in_channel_length ic)
<flux>
I don't think that works with streams, though
<nojb>
streams ?
<flux>
icicled, you probably want to use Batteries (or Core) to have stuff like that
<mrvn>
a stream could be endless
<flux>
uh, I meant such as standard input
<mrvn>
flux: press ctrl-d to EOF stdin
<nojb>
well, then you must specify what you mean by “exhaust”
<flux>
mrvn, yes, but in_channel_length stdin probably returns 0
<mrvn>
flux: or use select to only read while there is input.
<mrvn>
flux: oh yeah. Also input could be 100TB on a 32bit system.
Yoric has joined #ocaml
<flux>
nojb, what else would it mean that when you have an input, you get it all?-)
<flux>
apparently its functionality in this case is undefined, in my environment it raises Exception: Sys_error "Illegal seek".
travisbrady has joined #ocaml
<mrvn>
flux: I would read the input in 4-64k chunks
tani is now known as tane
<mrvn>
make that 4-16k. ocaml doesn't more than 16k at a time.
<mrvn>
+do
shinnya has quit [Ping timeout: 272 seconds]
<flux>
I was going to write a read_all that works always, but noticed at maybe 20% that it's too long for irc :)
<mrvn>
why not simply close the channel? There is no point in exhausting it
<flux>
maybe nicer though than earlier with the newish way to pattern match exceptions :)
<flux>
mrvn, I thought the point was actually getting all the data from the input channel, not just exhausting it
matason has joined #ocaml
<flux>
but as you are asking, there is a point: if someone is writing to the file descriptor's other end, they don't get a SIGPIPE/EPIPE
igstan has quit [Quit: igstan]
<mrvn>
flux: but that is the point. they should get one. Producing the input might be expensive and should stop when it no longer is needed.
<flux>
it depends. maybe it has been decided that the source must finish its job for its side effects, but the output must be trashed
mgzk has joined #ocaml
<icicled>
by exhaust I just mean read what is available
slash^ has quit [Read error: Connection reset by peer]
<icicled>
right now I'm reading from a socket channel so whatever is available is good enough
<mrvn>
flux: | { ./foo; cat >/dev/null; }
<mrvn>
icicled: set it to non-blocking.
<flux>
icicled, ah you're doing non-blocking io with Unix.select?
<icicled>
I'm just doing a plain old blocking IO with Unix.establish_server
<mrvn>
icicled: that a read only returns what is available is not garanteed unless you set non-blocking.
<flux>
hm, I mean: you're doing -buffered- io with Unix.select
<flux>
icicled, so has the other end closed the connection?
<icicled>
yes
samrat has joined #ocaml
<flux>
well, if you can easily reproduce the issue, I would debug it with 'strace'
<flux>
in particular it is interesting what happens to the read system call after the connection id disconnected
<flux>
I mean, it should just return 0
<flux>
and it should raise End_of_file
<flux>
and that should be the end of it. but isn't?
<companion_cube>
icicled: CCIO.read_all blocks until the channel has been exhausted
<mrvn>
flux: first it returns as much as is left in the buffer, next call returns 0. ocaml should raise EOF then.
<nojb>
`input`/`read/ return 0 on EOF, End_of_file is not raised IIRC
matason has quit [Read error: Connection reset by peer]
<mrvn>
nojb: channel should
<flux>
"add_channel b ic n reads exactly n character from the input channel ic and stores them at the end of buffer b . Raise End_of_file if the channel contains fewer than n characters."
<flux>
actually I wonder if that's what's happening here
<nojb>
really_input does
<flux>
fewer than n characters were read
<nojb>
but not input
<flux>
therefore they are NOT stored at the end of the buffer, because it's not exactly n
<mrvn>
flux: that seems pretty unusable for networking. You loose data on EOF
<flux>
and then the End_of_file is raised
<flux>
mrvn, I'm not sure where that is useful anyway
<flux>
well, I suppose if you are reading blocked input
<mrvn>
flux: seekable files where you check the size first
<flux>
but I would certainly say it's a bit surprising
<companion_cube>
this should be tested, and documented
<mrvn>
but even that would be racy
<flux>
I guess in this case it's really a bad thing that End_of_file is raised
<icicled>
yes that's the problem
<flux>
it should be called add_channel_really :-)
<icicled>
if there is < than N characters it doesn't even add the chars read to the buffer
<mrvn>
I guess it works if you have structured input and know the size it must have. On EOF you raise a parse error.
<companion_cube>
well, data is lost upon End_of_file...
<flux>
seek/size/etc all fail with streams so those are not options
<nojb>
there is no reliable way to “read all data” from a file descriptor that is not closed …
<companion_cube>
you can use Bytes
<icicled>
nojb, just whatever is available is good enough but I don't know what the size will be
<flux>
so it calls 'really_input'. "really_input ic buf pos len reads len characters from channel ic , storing them in byte sequence buf , starting at character number pos . Raise End_of_file if the end of file is reached before len characters have been read. Raise Invalid_argument really_input if pos and len do not designate a valid range of buf ."
<flux>
so as it doesn't return normally if there are fewer characters to be read, it will cause add_channel to raise End_of_file before adding the data to the buffer as well (before incrementing the position)
rgrinberg has joined #ocaml
<nojb>
icicled: then if you want to make sure that you read all available data you must use non-blocking io/ select
<icicled>
nojb, got it - thanks
<flux>
why must he use non-blocking io/select?
<flux>
example of an application that consumes all its input and doesn't use non-blocking io: cat
<companion_cube>
icicled: your goal is to read the whole socket or file into a string?
<nojb>
cat blocks waiting for input
<icicled>
companion_cube, yes
<flux>
nojb, and it seemed to me that it's ok for icicled as well
<companion_cube>
then you don't need non-blocking input, you'll just block until you've read the whole thing
<nojb>
then he can use plain `input`, i don’t understand what is the problem
<companion_cube>
well I need to fix CCIO.read_all
<icicled>
I was attempting to do that
<icicled>
hooray for finding bugs :)
<flux>
with plain 'input' you need to allocate a gigabyte string up front if you except the input may be a gigabyte long
<icicled>
the connection will be proxied from a webserver that has input limit lengths, etc.
<icicled>
so I'm not worried about that
<flux>
in any case I don't think it's good form to allocate input size based on potential data size, even if one does have upper limits
<companion_cube>
I think the behavior of Buffer.add_channel should be changed, or an alternative function be provided
<flux>
after getting that 10 byte string (of 1 gigabyte) you then need to duplicate it to another 10-byte string, so you can have the gc discard the big buffer
<flux>
companion_cube, I guess a case for changing its behavior could be made, but at the moment it does follow its documentation
<icicled>
flux, I'd love to use Gen on the input_channel - I'm happy to work with that
<flux>
so it's only a useless function, not a buggy one :)
<companion_cube>
flux: it does, but the documentation isn't really clear, and the function is useless
<flux>
perhaps it'd be a fun idea to find uses of said function and see if it works
Yoric has quit [Remote host closed the connection]
<companion_cube>
I was going to propose the same thing :)
<companion_cube>
first, bugfix
arj has quit [Quit: Leaving.]
<icicled>
is there a channel_to_gen btw?
<icicled>
I didn't see one in containers 0.6.1
<companion_cube>
CCGen is deprecated anyway, use the library "gen"
<companion_cube>
(it's the exact same thing but named "Gen")
<struk|work>
how do people typically release oasis projects on the opam repo ? Is this a common approach? https://github.com/ocaml/oasis2opam Is there something better?
<companion_cube>
there"s opam-publish I think
Dzyan has quit [Ping timeout: 240 seconds]
<struk|work>
companion_cube: didn't think that was oasis centric but it might relieve some pain regardless
<companion_cube>
exactly
Dzyan has joined #ocaml
<companion_cube>
so the bug is fixed, I'm pushing a PR on opam-repository
<icicled>
thanks!
<nojb>
struk|work: I don’t think oasis2opam is being mantained, I wouldn’t use it
npouillard has quit [Quit: WeeChat 0.4.3]
<struk|work>
nojb: ok thanks.
travisbrady has quit [Quit: travisbrady]
nojb has quit [Quit: nojb]
larhat has joined #ocaml
dav has quit [Ping timeout: 250 seconds]
<companion_cube>
gosh, Bytes is so annoying
arj has joined #ocaml
dav has joined #ocaml
waneck_ has joined #ocaml
<icicled>
hey companion_cube, do you know how to resolve this issue when having gen & containers installed side-by-side: gen.cma & containers.cma disagree over interface Gen_intf
__w_a_n_e_c_k__ has quit [Ping timeout: 245 seconds]
<icicled>
it's not a big deal in toplevel I suppose - they work fine when building & running
<companion_cube>
icicled: next version will discard Gen
<companion_cube>
in containers, I mean
<companion_cube>
so only the "gen" library will provide this module
dav_ has joined #ocaml
dav has quit [Ping timeout: 250 seconds]
Yoric has joined #ocaml
<icicled>
gotcha
<companion_cube>
so, I had to ditch Buffer and use Bytes, resizing manually
<flux>
256 bytes sounds like a very small buffer..
<flux>
up it atleast to 4k :)
<flux>
for example my machine can dd 256-byte /dev/zero blocks to /dev/null at 721M/s
<adrien>
companion_cube: hmmm, why?
<flux>
4k bytes it can do 6.6 gigabytes/s
<adrien>
and over 4k I think it doesn't do much more
<flux>
16k it can do 10 GB/s
<flux>
but I guess usually you don't have that fast devices around :)
<adrien>
:)
<companion_cube>
adrien: there isn't a good way to read a channel into a buffer
<adrien>
for network, reading with buffers of 512 bytes also proved to be too little
<adrien>
companion_cube: an in_channel?
<companion_cube>
yes
<adrien>
val add_channel : t -> Pervasives.in_channel -> int -> unit
<adrien>
?
<flux>
721M/s is less than 10Gbit network
<companion_cube>
no.
<companion_cube>
it's useless
<companion_cube>
just submitted a bug report about it