ChanServ changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml 4.02.1 announcement at http://ocaml.org/releases/4.02.html | Public channel logs at http://irclog.whitequark.org/ocaml
dav has quit [Ping timeout: 244 seconds]
dav_ has joined #ocaml
<adrien> but it had comments iirc
<adrien> or at least I think so
* adrien already in bed, night
<mfp> yes it did
<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?
<mfp> pessimized lwt_ssl/ocaml-ssl, if I may add (re: https://github.com/savonet/ocaml-ssl/pull/15 )
<rgrinberg> if the latter, link plz
<sdegutis> Is it possible to extract an enum's associated value using a generic function based on the type given to it?
<mfp> I'm not sure
<Drup> sdegutis: I need an example to understand what you want.
<sdegutis> Well the example I have is only using Swift so I'm not sure how it should look in OCaml syntax.
<Drup> just put the swift example
<rgrinberg> sdegutis: can you write a type signature for your function?
<sdegutis> Yeah, right now it returns Optional<LuaValue>, but LuaValue is just an enum that has cases for String, Number, etc
<sdegutis> So I want to just assign the value to a temporary binding of type String, and let it thus extract the String version of the enum.
srcerer_ is now known as srcerer
<Drup> and what if it's not a String ?
<sdegutis> I want it to choose either the right type, or if match then to return nil.
<Drup> I see
<sdegutis> That way you can just do: let s: String = luaState.get(-1) and it'll extract it properly.
<Drup> you can do that in swift ?
<mfp> I thought I'd compared oraft with ocaml-tls vs. lwt-ssl and taken the 5X figure from there, but I cannot find the code using lwt-ssl
<sdegutis> No. I'm trying to figure out how to do it in Swift or OCaml.
<Drup> ok
<sdegutis> I was told OCaml is basically the free version of Swift but with ML syntax.
<Drup> I'm pretty sure you will not be able to encode that in swift's type system
<sdegutis> So once I figure out how to do it in OCaml I'll just transliterate it to Swift.
<Drup> oh
<Drup> I looked at your example
<Drup> yeah
<Drup> so the answer is no, and that's because it's *evil*
<whitequark> Drup: pong
antegallya has quit [Ping timeout: 245 seconds]
<sdegutis> Drup: inherently so?
<Drup> whitequark: pongpong ?
<Drup> sdegutis: you are doing implicit conversion
<Drup> EVIL
<whitequark> Drup: ocaml-lz4 is the one with oasis
antegallya has joined #ocaml
Submarine has joined #ocaml
<Drup> oh, right, thanks !
<sdegutis> Drup: Right now I have a bunch of functions, like luaState.toNumber, toString, toBool, etc.
<sdegutis> Drup: It seems like these should have a generic wrapper function just for cleanness.
<Drup> sdegutis: do you really want to be able to transform the case Number of a LuaValue in String ?
travisbrady has joined #ocaml
<sdegutis> Drup: No, if the type if the expected value doesn't match the type of the given enum case's associated value, then it should return nil.
<Drup> ok
<sdegutis> Drup: But I see your point. I am looking at it wrongly.
<Drup> then it's easy, but you can't make it general, not like that at least
<sdegutis> Right on.
<Drup> you can use an advanced feature of the OCaml type system called GADT to do it
<sdegutis> Drup: This is the code I was hoping to genericize somehow:
<Drup> but I don't advise it, at least for now
<Drup> this code
<Drup> is really
<Drup> ugly-ssime.
<sdegutis> :(
<Drup> sorry :D
<sdegutis> Drup: I thought I did a good job on it though?
rgrinberg has quit [Quit: Leaving.]
<sdegutis> Drup: I worked really hard on this code for a few days.
<Drup> yeah, I don't know Lua, can't say if it's good lua code
<sdegutis> It's not Lua, it's Swift.
<Drup> oh
<sdegutis> It's a Lua interface for Swift.
<Drup> right
<sdegutis> So that you can add Lua scripting to a Swift proagrum.
chambart has quit [Ping timeout: 264 seconds]
<Drup> so, why aren't you using a sum type
<Drup> let me write it in OCaml.
<sdegutis> I don't know calculus.
<Drup> nothing to do with calculus :D
madroach has quit [Ping timeout: 250 seconds]
<HrafnA> I don't know type algebra.
rgrinberg has joined #ocaml
<Drup> not much to do with type algebra either :p
<mfp> Drup: well type calculus is when you do zippers :P
mfp has left #ocaml ["Leaving"]
mfp has joined #ocaml
madroach has joined #ocaml
thomasga has quit [Quit: Leaving.]
thomasga has joined #ocaml
dav_ is now known as dav
<HrafnA> I came in in the middle of a conversation.
NoNNaN has quit [Remote host closed the connection]
Haudegen has quit [Quit: No Ping reply in 180 seconds.]
<Drup> sdegutis: what I call sum type is pretty much what you call enum
Haudegen has joined #ocaml
<HrafnA> My apologies, ought to read back before dropping remarks.
<mfp> success! here you go:
<mfp> :setlocal iskeyword=@,48-57,_,%,192-255
<mfp> :syntax region ocamlKeyword start="let" end="%" conceal
<Drup> mfp: doesn't that mean that you will conceal *any* let%foo ?
<mfp> and then :ab lwt let%lwt
<mfp> Drup: yes, but it's not a pb I think. Maybe with a suitable cchar...
<Drup> all that for 4 chars.
<mfp> it's the indentation really
<Drup> the indentation ? it doesn't have much to do with the indentation
<mfp> 1 sec
ontologiae_ has quit [Ping timeout: 255 seconds]
<mfp> Drup: lately, I've been formatting code as in http://paste.debian.net/136763/
<Drup> meh
<whitequark> well, don't do that :p
<mfp> (imagine the expressions are longer and close to a 80 ~ char limit, so that cutting at >|= etc makes sense)
<mfp> I find it rather easy to read
<Drup> "I hurt myself with a piece of metal, so I tried to make the metal softer so that it hurts slightly less"
<Drup> ;D
<Drup> (half kidding, but let's just say I would break a line after the "=" and be done with it :p)
<mfp> that's how I used to format my code
<Drup> that's your choice :p
<Drup> but really, if you tweak your indentation locally, anyone that edits (and even *read*) your code will have the indentation screwed up
<Drup> so, hum, that's quite bad
<mfp> I find that putting the exprs on the right side (and not below the let xxx =) makes it easier to read
<mfp> true
<Drup> rgrinberg: so, what's the issue with re's packaging ?
<whitequark> Drup: I approve of the idea of deriving AST visitors and mappers
<whitequark> but it's a lot of work
<whitequark> or rather, I'm really tired of writing countless derivers
<Drup> I can understand that
<Drup> I have not an immediate need for such deriver, it was more of a side idea, so I won't try that now.
<whitequark> ah ok
<Drup> (or to be more precise: I need a visitor, but you wouldn't be able to derive it directly like that)
ygrek has joined #ocaml
<Drup> rgrinberg: https://github.com/ocaml/ocaml-re/pull/46 did you had more in mind than that ?
<whitequark> Drup: btw, you don't have to "remove" those in non-dev package
<whitequark> rather just track the version inside opam, it's more convenient
<Drup> well, remove or modify
<Drup> technically, they are not needed in opam.
<whitequark> they're convenient for opam-query.
<Drup> huum
<Drup> ok, give me a sec.
<Drup> there :)
travisbrady has quit [Quit: travisbrady]
<whitequark> huh?
<whitequark> # Modify in non-dev package. ?
<Drup> well, it's pretty clear :>
<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 ...
thomasga has quit [Quit: Leaving.]
<struktured> Drup: I use oasis but I am not impressed
<struktured> ocamlbuild is awesome but not quite enough to me
<Drup> oh, you have every right not to be impressed
<Drup> there are tons of issues with it
<whitequark> rgrinberg1: almost useless? too slow? I don't know, I'm using it for everything I do with great success
<rgrinberg1> whitequark: dont you use oasis?
<whitequark> nope
travisbrady has quit [Quit: travisbrady]
<rgrinberg1> lies
<whitequark> that's because it's linked from somewhere as an example of using oasis
antinomy has quit [Ping timeout: 272 seconds]
<struktured> rgrinberg1: its not a speed thing but minimalist build config files I'm after
travisbrady has joined #ocaml
<whitequark> yes.
<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
rgrinberg has quit [Quit: Leaving.]
<struktured> companion_cube: ah, containers.data isn't it?
rgrinberg has joined #ocaml
<struktured> companion_cube: yep, that did it. never mind
pyon has joined #ocaml
manud has quit [Quit: Lingo: www.lingoirc.com]
srcerer has joined #ocaml
manizzle has quit [Ping timeout: 244 seconds]
kapil__ has joined #ocaml
nojb has quit [Quit: nojb]
rgrinberg has quit [Read error: Connection reset by peer]
rgrinberg has joined #ocaml
<whitequark> companion_cube: I want CCError.bind
<rgrinberg> surely CCError.(>>=) :D
<whitequark> exactly, and I want bind
<whitequark> although
<whitequark> actually I want flat_map
<travisbrady> Would someone enlighten me: do topkg, oasis and assemblage all solve the same problem?
<rgrinberg> travisbrady: it's complicated :D
<whitequark> yes
<struktured> whitequark: seems like an easy PR : )
<whitequark> there is at least ten buildsystems for OCaml
<rgrinberg> topkg isn't quite a build system
<travisbrady> Let’s build one more, I
<rgrinberg> but close enough
<travisbrady> I’m sure this one will be the last
<whitequark> famous last words
nojb has joined #ocaml
<travisbrady> whitequark: I’ve noticed you use topkg (at least in ppx_deriving_yojson) are you happy with it?
<whitequark> yes
nojb has quit [Quit: nojb]
sdegutis has left #ocaml ["Leaving..."]
travisbrady has quit [Quit: travisbrady]
msch has quit [Ping timeout: 244 seconds]
<joncfoo> anyone have experience with ocaml-scgi ?
<joncfoo> i.e. does it work well enough?
ggherdov has quit [Ping timeout: 244 seconds]
jcloud has quit [Ping timeout: 244 seconds]
cantstanya has quit [Ping timeout: 244 seconds]
myyst has quit [Ping timeout: 244 seconds]
thegameg has quit [Ping timeout: 244 seconds]
zozozo has quit [Ping timeout: 244 seconds]
mehdi___ has quit [Ping timeout: 244 seconds]
myyst has joined #ocaml
mehdi_ has joined #ocaml
<rgrinberg> joncfoo: it's used in production so it can't be that bad
jcloud has joined #ocaml
msch has joined #ocaml
thegameg has joined #ocaml
zozozo has joined #ocaml
<whitequark> PHP is very widely used in production
cantstanya has joined #ocaml
joncfoo has quit [Ping timeout: 244 seconds]
ggole has joined #ocaml
ggherdov has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
mearnsh has quit [Ping timeout: 272 seconds]
mearnsh has joined #ocaml
jao has quit [Ping timeout: 250 seconds]
rand000 has quit [Quit: leaving]
AlexRussia has quit [Quit: WeeChat 1.1-dev]
samrat has joined #ocaml
rgrinberg has quit [Quit: Leaving.]
rgrinberg has joined #ocaml
nullcat has joined #ocaml
MercurialAlchemi has joined #ocaml
SomeDamnBody has joined #ocaml
ygrek has quit [Ping timeout: 258 seconds]
<SomeDamnBody> Is it possible ocaml could list includes associated with a particular package?
<SomeDamnBody> is there any command for that, so that when I go to compile, I get the right directory for that package based on compiler version
<SomeDamnBody> ...possible /s/ocaml/opam could...
<SomeDamnBody> in order that it, say, find caml/camlidlruntime.h
<whitequark> ocamlfind query pkg
chambart has joined #ocaml
<SomeDamnBody> k
nuki has quit [Quit: ChatZilla 0.9.91 [Iceweasel 31.1.0/20140903072827]]
pgomes has joined #ocaml
chambart has quit [Ping timeout: 272 seconds]
ygrek has joined #ocaml
ebzzry has joined #ocaml
rgrinberg1 has joined #ocaml
mcclurmc has joined #ocaml
rgrinberg has quit [Read error: Connection reset by peer]
SomeDamnBody has quit [Ping timeout: 258 seconds]
mcclurmc has quit [Ping timeout: 240 seconds]
MrScout has joined #ocaml
arj has joined #ocaml
MrScout_ has joined #ocaml
MrScout__ has joined #ocaml
Haudegen has quit [Ping timeout: 245 seconds]
MrScout has quit [Read error: Connection reset by peer]
Haudegen has joined #ocaml
MrScout_ has quit [Ping timeout: 250 seconds]
<struktured> whitequark: am I getting better with markdown? https://github.com/struktured/ocaml-prob-cache
<whitequark> yeah that looks really good
<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?
nullcat has quit [Quit: Textual IRC Client: www.textualapp.com]
<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
<nuki> Thanks a lot :)
<nuki> Exp.unit (à doesn't exists
<whitequark> err
<whitequark> Exp.construct (Location.mknoloc "()")
<nuki> Yes thanks, I could use ppx_tool
<nuki> Pexp_construct (Location.mknoloc (Lident "()"), None) :)
<nuki> I'm writting tool to provide test with attributes
<nuki> [@@@test
<nuki> let t1 = assert(1=1) ]
<nuki> and -ppx ppx_test set test and -ppx ppx_no_test disable it
<nuki> But i don't found how to erase an attribute, so i transforme it in let _ = ()
<whitequark> there's already a ppx_ounit
<whitequark> to erase a floating attribute, you must override the structure (not structure_item) field in the mapper
<nuki> oh oké, thanks (I dont want create a standard, just training me)
antinomy has joined #ocaml
lu324__ has joined #ocaml
lu324_ has quit [Remote host closed the connection]
Yoric has joined #ocaml
axiles has quit [Quit: Quitte]
<nuki> (ahah it's much better with "struct" :) thank you whitequark)
antegallya has joined #ocaml
<nuki> [@@@t let x = ()] is same as let x[@t] = () ?
<nuki> ah nop
koderok has joined #ocaml
<whitequark> no, not at all
kakadu has joined #ocaml
<nuki> yep, let x[@t] is suppressed every times?
<whitequark> what?
kido1412 has quit [Quit: Page closed]
<nuki> when i'm show code with let x[@something] with -dsource, the annotation 's not visible
<whitequark> hmm
rgrinberg1 has quit [Quit: Leaving.]
<whitequark> that's a bug in -dsource. the annotation gets placed on the pattern x
<whitequark> please report it on mantis
<whitequark> caml.inria.fr/mantis/bug_report_page.php
<nuki> ok
liweijian has quit [Quit: Textual IRC Client: www.textualapp.com]
matason has joined #ocaml
<whitequark> actually nevermind, I'll do it myself
<whitequark> done
<nuki> aha i was creating my account :D
<nuki> (waiting to the confirmation)
<nuki> thanks
ontologiae_ has joined #ocaml
thomasga has joined #ocaml
<companion_cube> whitequark: sure, CCOpt.flat_map is easy. Why do you need exactly "flat_map" ? functor? :)
sol__ has joined #ocaml
<companion_cube> hmm, but it's already defined...
antegallya has quit [Ping timeout: 260 seconds]
<companion_cube> ah, in CCError, my bad
<whitequark> it's already there
Simn has joined #ocaml
antegallya has joined #ocaml
larhat has quit [Quit: Leaving.]
seangrove has quit [Ping timeout: 250 seconds]
ollehar has joined #ocaml
antegallya has quit [Ping timeout: 245 seconds]
kapil__ has quit [Quit: Connection closed for inactivity]
_andre has joined #ocaml
George___ has joined #ocaml
arj has quit [Ping timeout: 258 seconds]
mcclurmc has joined #ocaml
ingsoc has joined #ocaml
mcclurmc has quit [Ping timeout: 265 seconds]
bezirg has joined #ocaml
arj has joined #ocaml
demonimin has quit [Read error: Connection reset by peer]
<companion_cube> gasche: I've been told "unused" extension attributes could trigger warnings in a near future?
demonimin has joined #ocaml
larhat has joined #ocaml
kapil__ has joined #ocaml
nuki has quit [Quit: ChatZilla 0.9.91 [Iceweasel 31.1.0/20140903072827]]
<whitequark> no
<whitequark> not in near future.
<whitequark> this is a very complex work.
nuki has joined #ocaml
antegallya has joined #ocaml
Yoric has quit [Remote host closed the connection]
nojb has joined #ocaml
arj has quit [Ping timeout: 264 seconds]
arj has joined #ocaml
axiles has joined #ocaml
arj has quit [Ping timeout: 265 seconds]
lordkryss has joined #ocaml
nojb has quit [Quit: nojb]
antegallya has quit [Quit: Leaving.]
axiles has quit [Ping timeout: 250 seconds]
axiles has joined #ocaml
nojb has joined #ocaml
bytbox has quit [Ping timeout: 265 seconds]
arj has joined #ocaml
tane has joined #ocaml
larhat has quit [Ping timeout: 245 seconds]
larhat has joined #ocaml
alpha06 has joined #ocaml
<alpha06> hi guys, how can I print a data structure like this: ('b * 'c) list * 'd * 'e ?
<mrvn> step by step
samrat has quit [Quit: Computer has gone to sleep.]
<mrvn> with pretty printers
<George___> guys, how to install sexplib.syntax? it is not installed with sexplib
<alpha06> I tried with this: http://pastebin.com/0RSMmLQH but it doesn’t work
<whitequark> George___: install camlp4 too
<George___> using opam, or apt-get?
<mrvn> alpha06: fix your type error
<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
<whitequark> categoria?..
<whitequark> Drup: on the issue tracker in some unrelated issue that was closed
<companion_cube> wow, just made the link too
Yoric has quit [Remote host closed the connection]
nojb has joined #ocaml
waneck_ has quit [Remote host closed the connection]
rand000 has joined #ocaml
Yoric_ has joined #ocaml
Yoric__ has joined #ocaml
mcclurmc has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
Yoric_ has quit [Ping timeout: 244 seconds]
samrat has joined #ocaml
hugomg has joined #ocaml
mcclurmc has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
<nojb> is there a function with signature ‘a Lwt.t -> ‘a ?
<whitequark> Lwt_main.run
<whitequark> note that it's not in general reentrant
<nojb> ah, ok … I’ll take a look
<nojb> thanks
<Drup> yeah
<Drup> never nest Lwt_main.run
<Drup> It's bad and if it works, it's by accident
<hannes> there's Lwt.async : (unit -> 'a Lwt.t) -> unit
<whitequark> "it appears to work"
<whitequark> is what I prefer to say
<Drup> hannes: not really the same semantic, though :)
<nojb> I need to call a lwt-blocking function from non-lwt code …
<Drup> are you going to use this non-lwt code inside lwt code later on ?
<nojb> no, not really, I don’t want to have to rewrite everything monadically
<Drup> then you can use run.
<Drup> but write it in big and red in the documentation :)
<nojb> great - thanks :)
<Drup> (and you should really monadify it)
<Drup> (or abstract over this specific thing)
q66[lap] has quit [Ping timeout: 250 seconds]
q66[lap] has joined #ocaml
mcclurmc has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
fraggle_ has joined #ocaml
ygrek has joined #ocaml
Yoric__ has quit [Remote host closed the connection]
<companion_cube> Drup: shouldn't nested Lwt_main.run raise?
<companion_cube> it should be easy to do, with a global ref that stores true iff Lwt_main.run is running
<Drup> I don't know.
<Drup> I'm not knowledgeable enough in lwt to answer this question :p
ollehar has quit [Ping timeout: 272 seconds]
<pyon> Is there any paste site that uses a recent version of OCaml? ideone.com uses a version that does not support GADTs.
arquebus has joined #ocaml
nuki has joined #ocaml
<whitequark> eval.in?
<pyon> Ah, checking! And thanks!
<Drup> http://ocsigen.github.io/js_of_ocaml/#version=4.02.0 very nice pastebin for OCaml, can even execute code
<Drup> :D
jonludlam has quit [Ping timeout: 250 seconds]
<flux> quite pretty
j0sh__ is now known as j0sh
<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.
<pyon> Hooray, it worked! https://eval.in/235578 Thanks!
jerith_ is now known as jerith
chinglish has quit [Quit: Nettalk6 - www.ntalk.de]
larhat1 has quit [Remote host closed the connection]
larhat has joined #ocaml
Unhammer has quit [Quit: ZNC - http://znc.sourceforge.net]
Unhammer has joined #ocaml
tharugrim has quit [Ping timeout: 245 seconds]
mcclurmc has joined #ocaml
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> hmm, ok
shinnya has joined #ocaml
<flux> it was simpler than I thought, I forgot Buffer.add_channel exists: https://github.com/c-cube/ocaml-containers/blob/master/core/CCIO.ml#L123
samrat has quit [Ping timeout: 245 seconds]
<icicled> yes, but Buffer.add_channel calls really_input
<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...
<companion_cube> terrible
<companion_cube> unless seek_in/pos_in is used
<companion_cube> but that still looks hack-ish
<companion_cube> I tested this behavior
<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 ."
<companion_cube> ohhh, that is a bug in CCIO
<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
<adrien> link?
samrat has quit [Quit: Computer has gone to sleep.]
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
travisbrady has joined #ocaml
<adrien> companion_cube: hmpf, annoying indeed
<icicled> http://lpaste.net/116638 < input channel to gen - works so far
<companion_cube> in the meantime, I just used a Bytes.t ref
<companion_cube> CCIO.read_chunks?
mgzk has quit [Ping timeout: 240 seconds]
<icicled> ah
<companion_cube> :)
<icicled> can't use gen with containers it seems
<companion_cube> you can use CCGen
<companion_cube> for now
<companion_cube> it's the same type
<companion_cube> also, it's ok to read by chunks of 256 because the buffer size is doubled every time, in the new CCIO.read_all
<icicled> companion_cube, I just tried let () = CCGen.iter (CCIO.read_chunks stdin) - no dice
<icicled> it calls Buffer.add_channel once again
<thomasga> Drup: assemblage bootstraps again https://github.com/samoht/assemblage/pull/152 :p
<icicled> err I mean since it calls Buffer.add_channel, anything less than 256 bytes won't register
<smondet> thomasga: 1h ago I tried assemblage, it didn't build, started using oasis for the new project :D
<icicled> type "hello" with the example + ctrl-d
<thomasga> smondet: damn, I was not quick enough :p
<thomasga> but anyway, that's sensible to use oasis, assemblage is still experimental ...
<icicled> sorry, it should be let () = CCGen.iter print_endline (CCIO.read_chunks stdin)
<companion_cube> gaaaah
<companion_cube> I usually use read_lines
<icicled> delimiters aren't always \r\n or \n :)
chambart has quit [Ping timeout: 272 seconds]
<icicled> http://lpaste.net/116638 < this doesn't store into a buffer so it streams it as it gets used/is available
<icicled> not a Buffer.t anyway
<companion_cube> yes, I'm writing the same
arj has quit [Quit: Leaving.]
<companion_cube> thanks
<companion_cube> Buffer could have been the easy migration path for safe-string, but instead it's painful and too limited
<icicled> it seems so
<icicled> I think Buffer.add_channel should be marked with warning that when the exception is raised the data is not available
<icicled> at the very least
<companion_cube> I think the current behavior is a bug ^^
<icicled> I'd agree
__w_a_n_e_c_k__ has joined #ocaml
nojb has joined #ocaml
<companion_cube> well, pushed too
waneck_ has quit [Ping timeout: 265 seconds]
__w_a_n_e_c_k__ has quit [Read error: Connection reset by peer]
__w_a_n_e_c_k__ has joined #ocaml
<companion_cube> ohhh, Bytes.extend exists
<companion_cube> neat
<companion_cube> it's been well-thought apparently
nojb has quit [Quit: nojb]
chambart has joined #ocaml
dav_ is now known as dav
<MercurialAlchemi> companion_cube: well, maybe Buffer will get better if enough people complain, you never know
<companion_cube> yeah :)
<MercurialAlchemi> or alternatively, five different alternatives will pop ip
<MercurialAlchemi> up
<companion_cube> I made a bug report
<icicled> hoorah!
ingsoc1 has quit [Ping timeout: 272 seconds]
ingsoc has joined #ocaml
travisbrady has quit [Quit: travisbrady]
MercurialAlchemi has quit [Ping timeout: 264 seconds]
waneck_ has joined #ocaml
__w_a_n_e_c_k__ has quit [Ping timeout: 264 seconds]
ingsoc has quit [Quit: Leaving.]
Thooms has joined #ocaml
__w_a_n_e_c_k__ has joined #ocaml
pgomes has quit [Quit: Leaving]
waneck_ has quit [Ping timeout: 250 seconds]
manud has quit [Quit: Be back later ...]
chambart has quit [Ping timeout: 264 seconds]
manud has joined #ocaml
nojb has joined #ocaml
travisbrady has joined #ocaml
rgrinberg has quit [Read error: Connection reset by peer]
rgrinberg1 has joined #ocaml
ontologiae_ has joined #ocaml
<companion_cube> much cleaning, wow
<icicled> companion_cube, I forgot about a condition of `input`, if it reads < len characters that means it consumed everything that was available
<icicled> I'm not sure if that's relevant to the implementation of CCIO.read_chunks that you updated
<icicled> just thought I'd point it out since I ran into an issue on my end
<companion_cube> what's the issue you ran in?
<companion_cube> and no, if 'input' returns less than len chars, it doesn't mean it reached End_of_file
<companion_cube> it's only if it returns 0
<icicled> ah ok
<companion_cube> btw rgrinberg1, there's containers.advanced.CCCat for your monadic stuff
<icicled> I'm just being silly then
<companion_cube> icicled: the doc says that the in_channel can decide to return less than the required number of bytes, if it's more convenient
<icicled> gotcha so I should only rely on the number of read bytes = 0 to demarcate that no more data is available
<companion_cube> yes
<icicled> thanks
<nojb> icicled: read bytes = 0 on END OF FILE, but if no data is available (for example, if reading from stdin), then input will simply block
<icicled> got it
ontologiae_ has quit [Ping timeout: 265 seconds]
yomimono has joined #ocaml
manud has quit [Quit: Lingo: www.lingoirc.com]
ontologiae_ has joined #ocaml
__w_a_n_e_c_k__ has quit [Ping timeout: 256 seconds]
badkins has quit []
tane has quit [Quit: Verlassend]
cdidd has joined #ocaml
jao has quit [Ping timeout: 256 seconds]
* companion_cube pondering whether making a parser functorized over an IO monad, is simpler to write than a streaming parser
<nojb> what is a “streaming parser” ?
<companion_cube> something like http://erratique.ch/software/jsonm/doc/Jsonm
<companion_cube> it can stop parsing when it has consumed all its input, waiting for its caller to provide more
<nojb> ah, ok .. I would say it is simpler, but in general I found that funtorizing over IO monad ends up being more trouble that it is worth ...
<companion_cube> I'm not sure, really
<nojb> you end up having to include all kinds of stuff in the IO signature or otherwise have to target lowest common denominator …
<nojb> what are you parsing ?
<companion_cube> well it's the occasion to abstract a bit over the input, I guess
<companion_cube> I have a small S-expression parsing lib that is streaming, but it's hard
BitPuffin has quit [Ping timeout: 255 seconds]
<companion_cube> and I was wondering how hard it would be with a monad
<nojb> do you have access to the whole input before you start parsing ?
<companion_cube> no, of course not :D
<companion_cube> the point is to be able to read from a string, a channel, a bigarray, or even a Lwt_io.input
<nojb> do you need a backtracking parser ?
<companion_cube> no, it's not required for this kind of things
<nojb> Some time back I used combinator parsers to make a streaming parser … it was really simple but not very efficient I guess …
<companion_cube> well, I intend to keep writing this kind of stuff by hand
<companion_cube> not with combinators
<companion_cube> https://github.com/c-cube/ocaml-containers/issues/23 (@ adrien: discuss)
waneck has joined #ocaml
<nojb> actually I think this could nicely be done with the new menhir
<nojb> it has an incremental API
<companion_cube> indeed
<companion_cube> it's easier with a parser generator because it already has all the required state
<nojb> right
<companion_cube> incremental menhir is going to be awesome though
<nojb> I now remember that I couldn’t use something like this because I couldnt separate lexer & parser … no such problem for sexpressions though
<companion_cube> yep.
<companion_cube> I have several parsers in this style and they always are messy to write
<companion_cube> maybe a monad can help
travisbrady has quit [Quit: travisbrady]
Hannibal_Smith has quit [Quit: Leaving]
Simn has quit [Quit: Leaving]
travisbrady has joined #ocaml
<rgrinberg1> "maybe a monad can help" :)
<rgrinberg1> hmm we should have an stdlib free monad functor i believe
rgrinberg has joined #ocaml
rgrinberg1 has quit [Read error: Connection reset by peer]
travisbrady has quit [Quit: travisbrady]
ontologiae_ has quit [Ping timeout: 250 seconds]
WraithM has quit [Remote host closed the connection]
ontologiae_ has joined #ocaml
rgrinberg has quit [Quit: Leaving.]
joncfoo has joined #ocaml
<Leonidas> LazyList.take 10 LazyList.nil;;
<Leonidas> Exception: BatLazyList.Invalid_index 10.
<Leonidas> this seems wrong
<Leonidas> take n l returns up to the n first elements from list l, if available.
rand000 has quit [Quit: leaving]