ChanServ changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | http://www.ocaml.org | OCaml 4.01.0 announce at http://bit.ly/1851A3R | Logs at http://irclog.whitequark.org/ocaml
pyon has quit [Quit: Fiat justitia ruat caelum.]
pyon has joined #ocaml
<sheijk_> whitequark: i think the issue is not that the source is missing but that the source location info is missing. might just not be implemented for mach-o executables. guess i'll have to move to linux for debugging
badon has quit [Ping timeout: 272 seconds]
enquora has quit [Quit: enquora]
badon has joined #ocaml
tobiasBora has quit [Quit: Konversation terminated!]
keen____ has quit [Ping timeout: 245 seconds]
jao has joined #ocaml
jao has quit [Changing host]
jao has joined #ocaml
Anarchos has joined #ocaml
mort___ has quit [Quit: Leaving.]
thomasga has quit [Quit: Leaving.]
maattdd has joined #ocaml
maattdd has quit [Ping timeout: 250 seconds]
jwatzman|work has quit [Quit: jwatzman|work]
ygrek has joined #ocaml
miko has quit [Ping timeout: 245 seconds]
philtor has quit [Ping timeout: 256 seconds]
yrrebaer has joined #ocaml
yrrebaer has left #ocaml [#ocaml]
zpe has joined #ocaml
Tucks has joined #ocaml
zpe has quit [Ping timeout: 260 seconds]
sheijk_ has quit [Quit: n8]
izaak has joined #ocaml
ygrek has quit [Ping timeout: 250 seconds]
izaak has quit [Ping timeout: 264 seconds]
Tucks has quit [Quit: Page closed]
q66 has quit [Quit: Leaving]
maattdd has joined #ocaml
eikke__ has quit [Ping timeout: 256 seconds]
maattdd has quit [Ping timeout: 272 seconds]
ygrek has joined #ocaml
_5kg has quit [Ping timeout: 240 seconds]
_5kg has joined #ocaml
shinnya has quit [Ping timeout: 240 seconds]
WraithM has quit [Remote host closed the connection]
izaak has joined #ocaml
huza has joined #ocaml
manizzle has quit [Ping timeout: 255 seconds]
zpe has joined #ocaml
zpe has quit [Ping timeout: 255 seconds]
samrat has joined #ocaml
philtor has joined #ocaml
maattdd has joined #ocaml
maattdd has quit [Ping timeout: 260 seconds]
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
samrat has quit [Quit: Computer has gone to sleep.]
samrat has joined #ocaml
zpe has joined #ocaml
zpe has quit [Ping timeout: 255 seconds]
ebzzry has quit [Ping timeout: 255 seconds]
izaak has quit [Ping timeout: 260 seconds]
philtor has quit [Ping timeout: 250 seconds]
yacks has quit [Ping timeout: 250 seconds]
pyon has quit [Quit: Fiat justitia ruat caelum.]
maattdd has joined #ocaml
pyon has joined #ocaml
maattdd has quit [Ping timeout: 245 seconds]
huza has quit [Quit: WeeChat 0.3.8]
manizzle has joined #ocaml
ousado has joined #ocaml
ousado_ has quit [Ping timeout: 260 seconds]
manizzle has quit [Ping timeout: 255 seconds]
ebzzry has joined #ocaml
axiles has joined #ocaml
izaak has joined #ocaml
zpe has joined #ocaml
samrat has quit [Quit: Computer has gone to sleep.]
zpe has quit [Ping timeout: 260 seconds]
samrat has joined #ocaml
fraggle_laptop has joined #ocaml
maattdd has joined #ocaml
izaak has quit [Read error: Connection reset by peer]
maattdd has quit [Ping timeout: 250 seconds]
izaak has joined #ocaml
izaak has quit [Ping timeout: 260 seconds]
badon has quit [Ping timeout: 255 seconds]
ggole has joined #ocaml
samrat has quit [Quit: Computer has gone to sleep.]
manizzle has joined #ocaml
badon has joined #ocaml
nojb has joined #ocaml
ggole has quit [Ping timeout: 245 seconds]
zpe has joined #ocaml
zpe has quit [Ping timeout: 240 seconds]
bjorkintosh has quit [Ping timeout: 240 seconds]
bjorkintosh has joined #ocaml
ggole has joined #ocaml
manizzle has quit [Ping timeout: 264 seconds]
samrat has joined #ocaml
samrat has quit [Client Quit]
maattdd has joined #ocaml
arj has joined #ocaml
Simn has joined #ocaml
pyon has quit [Quit: Fiat justitia ruat caelum.]
maattdd has quit [Ping timeout: 256 seconds]
pyon has joined #ocaml
manizzle has joined #ocaml
WraithM has joined #ocaml
manizzle has quit [Max SendQ exceeded]
manizzle has joined #ocaml
Hannibal_Smith has joined #ocaml
msch has quit [Ping timeout: 240 seconds]
manizzle has quit [Ping timeout: 272 seconds]
jennmoneydollars has quit [Ping timeout: 272 seconds]
lostman has quit [Ping timeout: 272 seconds]
_tca has quit [Ping timeout: 240 seconds]
steshaw has quit [Ping timeout: 240 seconds]
jzelinskie has quit [Ping timeout: 240 seconds]
msch has joined #ocaml
ygrek has quit [Ping timeout: 240 seconds]
_tca has joined #ocaml
steshaw has joined #ocaml
jao has quit [Ping timeout: 250 seconds]
jennmoneydollars has joined #ocaml
lostman_ has joined #ocaml
freling has quit [Ping timeout: 256 seconds]
paddymahoney has quit [Ping timeout: 264 seconds]
jzelinskie has joined #ocaml
zpe has joined #ocaml
samrat has joined #ocaml
zpe has quit [Ping timeout: 272 seconds]
izaak has joined #ocaml
lostman_ has quit [Ping timeout: 260 seconds]
jennmoneydollars has quit [Ping timeout: 256 seconds]
jzelinskie has quit [Ping timeout: 240 seconds]
_tca has quit [Ping timeout: 272 seconds]
Kakadu has joined #ocaml
steshaw has quit [Ping timeout: 260 seconds]
jzelinskie has joined #ocaml
lostman_ has joined #ocaml
_tca has joined #ocaml
izaak has quit [Ping timeout: 255 seconds]
jennmoneydollars has joined #ocaml
steshaw has joined #ocaml
ollehar has joined #ocaml
maattdd has joined #ocaml
hhugo has joined #ocaml
nojb has quit [Remote host closed the connection]
maattdd has quit [Ping timeout: 240 seconds]
ggole has quit [Read error: Connection reset by peer]
Kakadu has quit [Quit: Konversation terminated!]
ggole has joined #ocaml
ollehar has quit [Ping timeout: 256 seconds]
darkf has quit [Ping timeout: 240 seconds]
darkf has joined #ocaml
mort___ has joined #ocaml
ygrek has joined #ocaml
samrat has quit [Quit: Computer has gone to sleep.]
mort___ has quit [Quit: Leaving.]
samrat has joined #ocaml
parcs has quit [Ping timeout: 255 seconds]
zpe has joined #ocaml
darkf_ has joined #ocaml
darkf has quit [Ping timeout: 240 seconds]
parcs has joined #ocaml
zpe has quit [Ping timeout: 250 seconds]
sgnb has quit [Remote host closed the connection]
sgnb has joined #ocaml
izaak has joined #ocaml
izaak has quit [Ping timeout: 260 seconds]
zpe has joined #ocaml
eikke__ has joined #ocaml
srax has joined #ocaml
maattdd has joined #ocaml
darkf_ is now known as darkf
maattdd has quit [Ping timeout: 256 seconds]
AltGr has joined #ocaml
samrat has quit [Quit: Computer has gone to sleep.]
mort___ has joined #ocaml
<companion_cube> o/
yacks has joined #ocaml
morphles has joined #ocaml
keen____ has joined #ocaml
mort___ has quit [Quit: Leaving.]
_2can has quit [Remote host closed the connection]
Kakadu has joined #ocaml
nojb has joined #ocaml
dsheets has joined #ocaml
_0xAX has joined #ocaml
arquebus has joined #ocaml
izaak has joined #ocaml
arquebus has left #ocaml [#ocaml]
WraithM has quit [Ping timeout: 250 seconds]
izaak has quit [Ping timeout: 245 seconds]
arquebus has joined #ocaml
arquebus has left #ocaml [#ocaml]
jonludlam has quit [Remote host closed the connection]
lostman_ has quit [Quit: Connection closed for inactivity]
miko has joined #ocaml
maattdd has joined #ocaml
srax has quit [Quit: WeeChat 0.3.8]
maattdd has quit [Ping timeout: 272 seconds]
srax has joined #ocaml
NoNNaN has quit [Remote host closed the connection]
tane has joined #ocaml
NoNNaN has joined #ocaml
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
zpe has quit [Ping timeout: 245 seconds]
robink has quit [Ping timeout: 240 seconds]
robink has joined #ocaml
sagotch has joined #ocaml
thomasga has joined #ocaml
morphles has quit [Ping timeout: 240 seconds]
izaak has joined #ocaml
nojb has quit [Ping timeout: 264 seconds]
samrat has joined #ocaml
samrat has quit [Client Quit]
izaak has quit [Ping timeout: 240 seconds]
locallycompact has joined #ocaml
locallycompact has quit [Remote host closed the connection]
locallycompact has joined #ocaml
maattdd has joined #ocaml
zpe has joined #ocaml
maattdd has quit [Ping timeout: 245 seconds]
maattdd has joined #ocaml
mbac_ is now known as mbac
avsm has joined #ocaml
maattdd has quit [Quit: WeeChat 0.4.3]
lc__ has joined #ocaml
maattdd has joined #ocaml
BitPuffin has joined #ocaml
testcocoon has quit [Quit: Coyote finally caught me]
testcocoon has joined #ocaml
Anarchos has joined #ocaml
sagotch has quit [Ping timeout: 250 seconds]
tane has quit [Quit: Verlassend]
tobiasBora has joined #ocaml
cdidd_ has joined #ocaml
cdidd has quit [Ping timeout: 250 seconds]
izaak has joined #ocaml
maattdd has quit [Ping timeout: 272 seconds]
jonludlam has joined #ocaml
izaak has quit [Ping timeout: 240 seconds]
Hannibal_Smith has quit [Quit: Sto andando via]
ebzzry has quit [Remote host closed the connection]
uggwar has joined #ocaml
sagotch has joined #ocaml
avsm has quit [Quit: Leaving.]
ewd has joined #ocaml
pminten has joined #ocaml
cdidd_ is now known as cdidd
avsm has joined #ocaml
tobiasBora has quit [Ping timeout: 264 seconds]
demonimin has quit [Ping timeout: 256 seconds]
izaak has joined #ocaml
tane has joined #ocaml
samrat has joined #ocaml
samrat has quit [Client Quit]
izaak has quit [Ping timeout: 250 seconds]
_andre has joined #ocaml
nojb has joined #ocaml
maattdd has joined #ocaml
neilmed has joined #ocaml
<neilmed> Hi, I'm impressed with the ocaml toplevel's ability to underline the location of errors in already displayed text. But I'm curious: How does this work under the hood? Fundamentally, how does one go about altering already-displayed text in a terminal? Is something like ncurses able to do this?
<tane> yes ncurses does exactly that
<neilmed> very cool - do you know if the toplevel is using ncurses to achieve this functionality? Or is there some lighter-weight way to do this in Ocaml? It'd be very handy for one of my Ocaml projects
Hannibal_Smith has joined #ocaml
<tane> i don't know what it uses
<tane> you can of course, do that all by yourself :)
<Drup> neilmed: go go lambda-term
<Drup> don't use ncurse, it's a crappy library
<neilmed> it just seems tricky to roll this oneself - there are many different kinds of terminals with different functionalities -
<neilmed> Drup: great - I will go look up lambda-term, thank you!
tobiasBora has joined #ocaml
<Drup> (lambda-term is the library supporting utop)
ygrek has quit [Ping timeout: 240 seconds]
mort___ has joined #ocaml
<nojb> the ocaml toplevel does not use ncurses - just plain old standout mode (see e.g. https://github.com/ocaml/ocaml/blob/d3e731774e8c38a79cc936b211e7a6f99c41ffae/utils/terminfo.ml)
<neilmed> nojb: ahh, great, i didn't know about this. thank you
<nojb> neilmed: see https://github.com/ocaml/ocaml/blob/d3e731774e8c38a79cc936b211e7a6f99c41ffae/parsing/location.ml#L77-L109 for the exact way in which the highlighting is done
<neilmed> nojb: amazing, this is exactly what i need to understand - thank you!
ebzzry has joined #ocaml
pango has quit [Ping timeout: 240 seconds]
neilmed has quit [Quit: Page closed]
al-maisan has left #ocaml ["See ya later!"]
ygrek has joined #ocaml
pminten has quit [Quit: Leaving]
thomasga1 has joined #ocaml
thomasga has quit [Ping timeout: 240 seconds]
tobiasBora has quit [Ping timeout: 245 seconds]
tobiasBora_ has joined #ocaml
avsm has quit [Quit: Leaving.]
izaak has joined #ocaml
<jeroud> I really like the Format module.
<companion_cube> whitequark: what does [@@deriving Eq] do on a type that contains functions? fail at compile time ?
rand000 has joined #ocaml
izaak has quit [Ping timeout: 250 seconds]
<whitequark> companion_cube: try it :p
<whitequark> but yes
<companion_cube> too lazy to switch to 4.02 version right now :p
<companion_cube> I have releases to do
tobiasBora_ has quit [Ping timeout: 245 seconds]
tobiasBora_ has joined #ocaml
englishm has joined #ocaml
englishm has quit [Changing host]
englishm has joined #ocaml
englishm_ has joined #ocaml
samrat has joined #ocaml
darkf has quit [Quit: Leaving]
englishm has left #ocaml [#ocaml]
tobiasBora_ has quit [Quit: Konversation terminated!]
paddymahoney has joined #ocaml
morphles has joined #ocaml
izaak has joined #ocaml
izaak has quit [Ping timeout: 264 seconds]
<nojb> Are calls to Lwt_io.*print* serialized ? That is, if I do not wait for one of these calls to complete before calling another one of these calls, is there a chance that the output might not come out in order ?
morphles has quit [Ping timeout: 255 seconds]
<whitequark> they are serialized
<nojb> whitequark: thanks
<whitequark> basically, in Lwt, all operations you perform always come in order
<whitequark> the only thing a print call can do except printing and returning the control is "blocking"
<whitequark> in which case, even if you don't explicitly sequence the two calls, the second one will block as well and be the second in queue
<whitequark> at least, that's how I understand it
<nojb> whitequark: I am not sure I see it: suppose that you have Lwt_io.print "1"; Lwt_io.print "2", then it is feasible that the first call might block but the second might not and so the printing order will be inverted, no?
<nojb> unless there is a queue behind the scenes making sure that can't happen ...
<nojb> maybe I should just take a look ...
samrat has quit [Quit: Computer has gone to sleep.]
<dsheets> I would guess that it doesn't happen until bind-time and then it enters a select loop or equivalent
<nojb> Yes, indeed that is what happens, so it is possible that they might be printed out of order.
maattdd has quit [Ping timeout: 260 seconds]
maattdd has joined #ocaml
avsm has joined #ocaml
samrat has joined #ocaml
<sagotch> Let say I have `type _ t = Int : int t | Float : float t | Unit : unit t`, is it possible to write a function with `int t` or `float t` parameters but not `unit t`? (looking for a way to write the signature)
samrat has quit [Ping timeout: 260 seconds]
<nojb> sagotch: as a general remark subtyping and gadts do not mix well
<nojb> I don't think there is a simple way to do it
<Drup> sagotch: no
<sagotch> too bad :(
<Drup> and I confirm, gadt and subtyping mix very badly
<ggole> Consider polymorphic variants
<ggole> By the way it is *possible*, just horrible
<ggole> I looked into it a while back.
Hannibal_Smith has quit [Quit: Sto andando via]
<sagotch> how horrible?
<Drup> ggole: the problem is that if 'a t is a gadt, the compiler is not going to be able to agree with you that it's covariant
<Drup> I tried very hard, and in the end, it was too much of a mess
<Drup> and I switch to phantom type + combinators
<ggole> The hack I considered involved a type argument for each desired subtype decision
studybot has quit [Remote host closed the connection]
<ggole> Totally not worth it.
studybot has joined #ocaml
<Drup> ggole: ahah, that may work indeed, in my case I didn't even considered it, it would far too many x)
<sagotch> thanks for the paper!
<ggole> I also tried phantom types with polymorphic variant arguments, but ran into some complicated issue (which may well have been variance)
<ggole> ^ example of the multiple-argument approach
topher has joined #ocaml
<Drup> interesting trick
<sagotch> hum... multiple (two) argument approach may fit my use case, I have to think about it.
<sagotch> (forked just in case I do not remember it tomorrow :P)
rand000 has quit [Quit: leaving]
ewd has quit [Remote host closed the connection]
demonimin has joined #ocaml
<ggole> An more fine-grained example
<ggole> As you can see it gets out of hand.
_0xAX has quit [Remote host closed the connection]
<Drup> https://gist.github.com/Drup/8f43b945f96118156706 the phantom + combinator version
dant3 has quit [Quit: I'm using a Free IRC Bouncer from BNC4FREE - http://bnc4free.com/]
<Drup> you have to be very careful with the basic combinators
<Drup> but after that, the type checker is much more efficient that with gadts
<Drup> of course, the typechecker is not going to ensure pattern match exhaustivness anymore
<Drup> so, if you actually need that, gadt are better
<Drup> (and of course, t should be abstract)
dant3 has joined #ocaml
<companion_cube> or private
<sagotch> what do you mean by "much more efficient"?
<Drup> sagotch: you don't have to annotate everything past the basic combinators
<Drup> with gadt ... it depends
<sagotch> ok
<nojb> I am using lambda-term and the output gets garbled if I use print_* functions ... how does utop handle this ?
<ggole> I often wonder whether there's a more natural design than GADTs
<ggole> They seem poorly matched to some use cases
<Drup> nojb: you have specific print function in the LTerm module
<ggole> (Usually where the type variable is "flat", eg, no nesting.)
<Drup> ggole: dependent types ? :D
<ggole> Dunno, don't have enough experience with those yet
<ggole> I poked at ATS a few times
<Drup> ATS is not really the language to learn dependent types, I think
shinnya has joined #ocaml
yomimono has joined #ocaml
<companion_cube> more like Idris?
samrat has joined #ocaml
morphles has joined #ocaml
tane has quit [Quit: Verlassend]
jnaimard has joined #ocaml
<Drup> or Agda
sagotch has quit [Remote host closed the connection]
<companion_cube> :s
<Drup> (but Idris is more ML-like, so might be more pleasant for people around here)
morphles has quit [Ping timeout: 240 seconds]
seanmcl has joined #ocaml
kerneis_ is now known as kerneis
eikke__ has quit [Ping timeout: 264 seconds]
octachron has joined #ocaml
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
zpe has quit [Ping timeout: 255 seconds]
<nicoo> Agda is quite nice. Hadn't had yet the time to play around Idris and port Ulf's tutorial to Idris
tane has joined #ocaml
nojb has quit [Ping timeout: 255 seconds]
philtor has joined #ocaml
arj has quit [Quit: Leaving.]
yomimono has left #ocaml ["Leaving"]
yomimono has joined #ocaml
sad0ur has quit [Ping timeout: 250 seconds]
xyh has joined #ocaml
slash^ has joined #ocaml
sad0ur has joined #ocaml
xyh has left #ocaml ["ERC Version 5.3 (IRC client for Emacs)"]
yomimono has quit [Quit: Leaving]
Submarine has joined #ocaml
philtor has quit [Ping timeout: 240 seconds]
mort___ has quit [Remote host closed the connection]
Kakadu has quit [Ping timeout: 246 seconds]
maattdd has quit [Ping timeout: 240 seconds]
philtor has joined #ocaml
jao has joined #ocaml
jao has quit [Changing host]
jao has joined #ocaml
maattdd has joined #ocaml
shinnya has quit [Ping timeout: 260 seconds]
englishm_ is now known as englishm
maattdd has quit [Ping timeout: 245 seconds]
octachron has quit [Ping timeout: 246 seconds]
xyh has joined #ocaml
morphles has joined #ocaml
zpe has joined #ocaml
zpe has quit [Ping timeout: 240 seconds]
jwatzman|work has joined #ocaml
morphles has quit [Ping timeout: 256 seconds]
sgnb has quit [Ping timeout: 272 seconds]
<tane> Hej, is there any vector-like container in Core which autoresizes giving a O(1) indexed-access?
dsheets has quit [Ping timeout: 255 seconds]
<tane> (i remind seeing something like that in batteries though)
<Drup> oh my bad, it's O(log)
troutwine_away is now known as troutwine
<Drup> (shouldn't be called vect ...)
<def`> (Drup: pure and O(log), mutable and O(1))
<Drup> def`: yeah, but usually "Vectors" are the mutable ones
fraggle_ has quit [Remote host closed the connection]
<tane> yeah
ollehar has joined #ocaml
fraggle_ has joined #ocaml
jnaimard has quit [Ping timeout: 250 seconds]
xyh has quit [Remote host closed the connection]
Hannibal_Smith has joined #ocaml
<tane> well, thanks for the help :)
<tane> probably need to compare batteries and core deeper or just use both
q66 has joined #ocaml
<Drup> how to bloat your executables :3
<tane> any recommendations? :)
<tane> the bigger that better, isn't it?
<Drup> well, I like to use libraries with a documentation, so I prefer batteries :p
<tane> yeah... i see your point :)
maattdd has joined #ocaml
avsm has quit [Quit: Leaving.]
<ggole> Bah, what's the point of using a language that makes writing data structures easy if you don't NIH your own?
troutwine is now known as troutwine_away
divyanshu has joined #ocaml
<bernardofpc> well, somehow NIHing everything is not exactly what makes your language do different new cool stuff
<bernardofpc> (emphasis on *everything*)
<bernardofpc> )(and of course, NIH is good for learning / testing / sketching / ...
ollehar has quit [Quit: ollehar]
<tane> what is NIH?
AltGr has left #ocaml [#ocaml]
<Unhammer> Not Invented Here
<tane> doesn't make sense as a verb though
<Drup> (wikipedia is misleading :p)
<Unhammer> reinventing wheels
<Unhammer> works as verb
wormphle1m has quit [Ping timeout: 250 seconds]
Kakadu has joined #ocaml
troutwine_away is now known as troutwine
* companion_cube honks
thomasga1 has quit [Ping timeout: 260 seconds]
<jerith> Is there a way to write (or generate) a polymorphic function that has different input and output types?
<ggole> let f x = assert false
<ggole> Alternatively, let f x = f x
<jerith> I'm parsing an XML spec and I need to walk over attributes and child elements, collecting them.
<Drup> Obj.magic
<Drup> :D
<jerith> But that's a lot of boilerplate to write for all the various cases.
<ggole> Hmm, you could compress that a bit as written by matching more thoughtfully
<jerith> All of those functions have the same form, though: "match this value, apply this function, add result to list"
malo has joined #ocaml
<Drup> By curiosity, why aren't you using xmlm or xml-light ?
<jerith> Drup: xmlm.
<Drup> oh, you are, my bad
<jerith> Oh, right. I *am* using xmlm.
wormphlegm has joined #ocaml
<jerith> I'm building a tree to walk down rather than building a giant state machine for the events.
<jerith> I need to rewrite the attribute extraction to do something similar to the child element stuff, because currently there's no easy way to make sure I'm not leaving out any attributes.
<jerith> (I'd use an option rather than a list for that.)
<jerith> I suspect that what I want is either impossible or worse than the boilerplate, but I thought I'd ask the experts. :-)
philtor has quit [Ping timeout: 250 seconds]
<Drup> I'm not sure what you want, in fact
<Drup> but in this case, I would change the xml_tree data type and do this attribute sorting directly in the function passed to Xmlm.input_tree
<Drup> a Rule node and an Assert node
<companion_cube> I'd be curious to see what ppx_deriving.Fold would do on Yojson.json type
nlucaroni has joined #ocaml
<jerith> Drup: I want to write something that takes a list of (name, builder_func) and outputs lists of built things.
<jerith> Drup: Although your idea is probably better.
thomasga has joined #ocaml
<Drup> companion_cube: nothing, there are no holes :D
<companion_cube> oh, it's only on polymorphic types?
<companion_cube> sad
<jerith> I'd still need something to handle the attributes, though.
<Drup> it would be possible to do it on recursive too
maattdd has quit [Ping timeout: 264 seconds]
zpe has joined #ocaml
lc__ has quit [Ping timeout: 240 seconds]
locallycompact has quit [Ping timeout: 256 seconds]
<Drup> jerith: ok, I actually look down in your code, and saw all the repeated functions
<ggole> Folds or hand-rolled funcs are pretty clumsy ways to express that kind of thing
maattdd has joined #ocaml
<Drup> jerith: I wonder if poly variant wouldn't be actually well suited here
<Drup> jerith: is it recursive ? can "chassis" contains a "assert" ?
<ggole> ...hmm, you could map from string to reference easily enough, and have one function to fill em in
troutwine is now known as troutwine_away
<jerith> Drup: It's not recursive, but some elements can appear in various places.
<Drup> that's not a problem
<Drup> if it's not recursive, I would do with polymorphic variants
divyanshu has quit [Quit: Computer has gone to sleep.]
<jerith> How would that work?
<Drup> the issue with polymorphic variants AST is that type error get out of hands very quickly because of the recursive nature of it
<jerith> I can build a tree of polymorphic variants fairly easily, but that wouldn't solve the problem of extracting the lists of child elements and such.
<Drup> well, you would do only once, instead of having 4 functions to do it, depending of the things you are looking at
troutwine_away is now known as troutwine
<jerith> I'd still have to do it once per element type, wouldn't I?
divyanshu has joined #ocaml
<jerith> Maybe I'm misunderstanding your suggestion.
<ggole> Could try something like that
<ggole> (Not tested.)
Kakadu has quit [Read error: Connection reset by peer]
Kakadu has joined #ocaml
<ggole> Er, gonna need List.rev in there too if you care about order.
<mrvn> order is overrated. long live the chaos.
<jerith> Will the different types of parse_rule and parse_assertion be a problem?
<ggole> Hmm, guess they will be
<jerith> Or do those need to return a variant type?
<Drup> and throw all your parse_ function away
<ggole> You could put the ref inside each func, I guess
<asmanur> your code looks weird Drup
<jerith> Drup: I'd still need to collect the children of each type.
<Drup> jerith: you can do one function that take the full thing and collect them
<Drup> asmanur: fail copy pasta :(
<Drup> jerith: basically, it's going to be exactly the same function that you wrote before, to collect into a list, except you will write it only once
<jerith> Drup: Oh, I see.
<companion_cube> >copy pasta
nojb has joined #ocaml
<Drup> :3
<jerith> So each element will get a list for each other element, but some of them will always be empty?
<Drup> yeah
* jerith thinks.
<companion_cube> time for the flat_map!!
<Drup> I don't think flatmap would help here
<ggole> Updated the gist with an approach that hides the ref, that should type ok
<ggole> But yeah, one pass over the whole thing seems like it would be better.
<jerith> So instead of a tree where each element has a single list of arbitrary children, I'd have a tree where each element has a list for each type of child.
<Drup> no
<Drup> Each element will still have a list of any children
<Drup> arbitrary*
<Drup> it's just that the children classification ("domain" is a domain, and so on) will be done once, at parsing time, instead of in each _children function
<jerith> Drup: The classification isn't the problem.
<jerith> The problem is collecting all "constant" elements into one list and all "domain" elements into another.
<Drup> the classification is precisely why you are duplicating your function 4 time
maattdd has quit [Ping timeout: 250 seconds]
<jerith> The classification just means I'm matching `Domain instead of (_, "domain") in the functions.
<jerith> [`Domain foo; `Constant bar; `Domain baz] doesn't help me, but ([`Domain foo; `Domain baz], [`Constant bar]) does help me.
<Drup> then why did you duplicate the function from the start ? :p
<jerith> I was looking at each element individually.
<jerith> So I split up the possible children for each separately.
<jerith> I didn't think of doing it all at once. :-)
<jerith> I'll try doing it this way and see where I end up.
<jerith> Thanks for your help, everyone.
nojb has quit [Ping timeout: 245 seconds]
philtor has joined #ocaml
yacks has quit [Ping timeout: 250 seconds]
samrat has quit [Quit: Computer has gone to sleep.]
binarybitme has quit [Remote host closed the connection]
wormphlegm has quit [Ping timeout: 264 seconds]
wormphlegm has joined #ocaml
WraithM has joined #ocaml
nojb has joined #ocaml
divyanshu has quit [Quit: Computer has gone to sleep.]
lc__ has joined #ocaml
lc__ has quit [Read error: Connection reset by peer]
binarybitme has joined #ocaml
hhugo has quit [Quit: Leaving.]
maattdd has joined #ocaml
slash^ has quit [Read error: Connection reset by peer]
jao has quit [Read error: Connection reset by peer]
BitPuffin has quit [Ping timeout: 264 seconds]
hhugo has joined #ocaml
morphles has joined #ocaml
nojb has quit [Ping timeout: 250 seconds]
divyanshu has joined #ocaml
morphles has quit [Ping timeout: 256 seconds]
jonludlam has quit [Ping timeout: 260 seconds]
Thooms has joined #ocaml
troutwine is now known as troutwine_away
maattdd has quit [Ping timeout: 255 seconds]
BitPuffin has joined #ocaml
BitPuffin has quit [Read error: Connection reset by peer]
BitPuffin has joined #ocaml
<jerith> Bleh. Text nodes mess this up. :-(
jonludlam has joined #ocaml
<jerith> I can use what I've learned to clean up my other code, though.
philtor has quit [Ping timeout: 240 seconds]
<jerith> Functional record updates instead of piles of lists.
<Drup> and you can factor out the tag matching to make the code slightly cleaner
<jerith> Yup.
<jerith> I'll do that first, actually.
ollehar has joined #ocaml
troutwine_away is now known as troutwine
ygrek has quit [Ping timeout: 272 seconds]
<tane> Drup, thanks for the hint.. batteries works fine.. and the documentation is readable :)
troutwine is now known as troutwine_away
omqal has joined #ocaml
eikke__ has joined #ocaml
ollehar has quit [Quit: ollehar]
nlucaroni has quit [Quit: leaving]
troutwine_away is now known as troutwine
rand000 has joined #ocaml
troutwine is now known as troutwine_away
nojb has joined #ocaml
troutwine_away is now known as troutwine
<jerith> Oh, wait. I'm being an idiot here.
<jerith> I don't need to build types for each element's children.
manizzle has joined #ocaml
<jerith> I can just change my output type constructor functions to give me empty ones and then fill them with children afterwards.
* jerith does that instead.
maattdd has joined #ocaml
stevej has quit [Quit: ["Textual IRC Client: www.textualapp.com"]]
divyanshu has quit [Quit: Computer has gone to sleep.]
maattdd has quit [Ping timeout: 255 seconds]
bernardofpc has quit [Ping timeout: 272 seconds]
Nahra has joined #ocaml
agarwal1975 has joined #ocaml
<gperetin> does anybody know what are the checks in "OCaml is often able to generate machine code that jumps directly to the matched case based on an efficiently chosen set of runtime checks"
<gperetin> (quote from RWO book, chapter on pattern matching)
<whitequark> I think it means that it doesn't check the cases in-order, but rather builds a decision tree
bernardofpc has joined #ocaml
<gperetin> do you know the criteria for decision tree?
<Drup> (I think it's the right paper)
<gperetin> wow, awesome! Thanks Drup!
<Drup> (funnily, I though it was from xavier leroy, not Luc Maranget)
philtor has joined #ocaml
pango has joined #ocaml
<nojb> Xavier's original compilation strategy can be found in his thesis - http://gallium.inria.fr/~xleroy/publi/ZINC.pdf
<nojb> it is simpler but produces less optimal code IIRC
<ggole> There are also some older papers on compiling pattern matching
<Drup> nojb: ah, thanks ! confirms what I though
<jerith> Why does this spec have to have an element with a name that is its own plural?
<gperetin> thanks all!
<ggole> It's been around for a while now
vfoley_ has quit [Changing host]
vfoley_ has joined #ocaml
<jerith> chassis : chassis
<jerith> I have to use an incorrect plural to differentiate the thing I'm adding to the list from the list I'm adding it to. :-(
zpe has quit [Remote host closed the connection]
<Drup> chassis_list ?
zpe has joined #ocaml
<ggole> a_chassis::chassis
<jerith> Then I either have to be inconsistent or I need to use "field_list" instead of "fields" or something.
<jerith> Although I'm not sure I actually *need* to use the singular anywhere.
<jerith> A generic word like "item" or "value" should suffice and it'll also solve my problem with "class" and "assert".
<Drup> put h and t everywhere, and be done with it :D
zpe has quit [Ping timeout: 255 seconds]
<jerith> The plural needs to be a field name in a record.
Walter__ has joined #ocaml
WraithM has quit [Ping timeout: 264 seconds]
axiles has quit [Remote host closed the connection]
Submarine has quit [Quit: Leaving]
philtor has quit [Ping timeout: 245 seconds]
hhugo has quit [Quit: Leaving.]
rand000 has quit [Quit: leaving]
mort___ has joined #ocaml
BitPuffin has quit [Ping timeout: 264 seconds]
omqal has quit [Quit: omqal]
yomimono has joined #ocaml
BitPuffin has joined #ocaml
tobiasBora has joined #ocaml
maattdd has joined #ocaml
jonludlam has quit [Ping timeout: 245 seconds]
tobiasBora has quit [Quit: Konversation terminated!]
thomasga has quit [Quit: Leaving.]
tane has quit [Quit: Verlassend]
miko has quit [Ping timeout: 256 seconds]
ggole has quit []
avsm has joined #ocaml
stevej has joined #ocaml
jao has joined #ocaml
jao has quit [Changing host]
jao has joined #ocaml
Walter__ has quit [Quit: Page closed]
BitPuffin has quit [Ping timeout: 264 seconds]
_andre has quit [Quit: leaving]
agarwal1975 has quit [Quit: agarwal1975]
topher has left #ocaml [#ocaml]
zpe has joined #ocaml
NoNNaN has quit [Remote host closed the connection]
NoNNaN has joined #ocaml
<jerith> Drup: I'm much happier with my current version: https://github.com/jerith/ypotryll/blob/master/code_gen/spec_parser.ml#L74-L88
<jerith> Are there any other improvements you can suggest?
<Drup> still 4 time the same function :(
<jerith> Assuming you have the time and are willing to help, of course. :-)
jonludlam has joined #ocaml
<jerith> It's not quite the same function -- I'm extracting different child elements each time.
BitPuffin has joined #ocaml
<Drup> also, unless I'm missing something in your code, it's going to drop everything after the first doc element
<jerith> I have one line per attribute, two lines per child element, and about five lines of boilerplate per function.
<Drup> oh no, my bad
<jerith> No, it parses the whole thing.
<Drup> you did it in a weird way, with a callback, I don't like it but ok
<jerith> Is there a better way to do it?
maattdd has quit [Ping timeout: 264 seconds]
oriba has joined #ocaml
<jerith> I want to factor out the three matchers that are common to everything, but still continue recursing.
<Drup> I would have done "swallow_element elem ; parse_children meth elems"
<jerith> Ah, right.
<Drup> swallow is doing nothing except raising an error or calling the callback
<jerith> That does make more sense.
tobiasBora has joined #ocaml
troutwine is now known as troutwine_away
jonludlam has quit [Ping timeout: 260 seconds]
Hannibal_Smith has quit [Quit: Sto andando via]
miko has joined #ocaml
<Drup> jerith: I would just do a big record that agregate all the list, write one collection function and error out if the list is not empty when I expect it to be empty
<Drup> less pretty, but much shorter
<Drup> if a list*
<jerith> Drup: I tried that, but it got very messy.
<Drup> hum, ok
<jerith> This way I don't need to keep my own record of lists, because I can use the output records instead.
<jerith> Also, each element's parser is self-contained and can be understood on its own.
thomasga has joined #ocaml
<jerith> I think I'm done for the night.
<jerith> Thanks for all your help, Drup. I'm much happier with this code than I was when I started. :-D
yomimono has quit [Quit: Leaving]
agarwal1975 has joined #ocaml
thomasga has quit [Quit: Leaving.]
jao has quit [Ping timeout: 272 seconds]
troutwine_away is now known as troutwine
philtor has joined #ocaml
seanmcl has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
WraithM has joined #ocaml
Nahra has quit [Remote host closed the connection]
maattdd has joined #ocaml
zpe has quit [Ping timeout: 256 seconds]
Nahra has joined #ocaml
maattdd has quit [Ping timeout: 260 seconds]
thomasga has joined #ocaml
maattdd has joined #ocaml
Simn has quit [Quit: Leaving]
englishm has quit [Remote host closed the connection]
englishm has joined #ocaml
englishm has quit [Ping timeout: 256 seconds]
avsm has quit [Quit: Leaving.]
Thooms has quit [Ping timeout: 250 seconds]
troutwine is now known as troutwine_away
troutwine_away is now known as troutwine
avsm has joined #ocaml
jonludlam has joined #ocaml
Kakadu has quit [Quit: Konversation terminated!]
avsm has quit [Ping timeout: 240 seconds]
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
thomasga has quit [Quit: Leaving.]
troutwine is now known as troutwine_away
tobiasBora has quit [Quit: Konversation terminated!]
troutwine_away is now known as troutwine
miko has quit [Ping timeout: 255 seconds]
<Drup> mrvn: ^ I'm sure you know
maattdd has quit [Ping timeout: 240 seconds]
avsm has joined #ocaml
darkf has joined #ocaml
avsm has quit [Ping timeout: 272 seconds]
WraithM has quit [Quit: Lost terminal]
nojb has quit [Ping timeout: 255 seconds]
avsm has joined #ocaml
shinnya has joined #ocaml
WraithM has joined #ocaml
thomasga has joined #ocaml
zpe has joined #ocaml
eikke__ has quit [Ping timeout: 255 seconds]
zpe has quit [Ping timeout: 250 seconds]
<whitequark> maybe something to do with float arrays?
<whitequark> actually, I'm really curious how float arrays work together with polymorphism
<Drup> what would it have to do with float arrays ? let them be packed, on the contrary
<whitequark> you'd have a `float array` with unboxed data somewhere, and you'd pass it as `'a array`, and how is that going to work?
thomasga has quit [Quit: Leaving.]
<Drup> whitequark: I think before doing stuff on an array, the tag is checked to verify if it's packed or not
<Drup> something like that
<Drup> (in the context of a polymorphic function only, obviously)
<whitequark> oh I see
<Drup> at least, I know you can tell an array is packed by inspecting tags
<Drup> whitequark: answer the guy asking for a ppx example on the ML :D
<whitequark> fine, fine!
<Drup> :]
avsm has quit [Quit: Leaving.]
madroach has quit [Ping timeout: 250 seconds]
madroach has joined #ocaml
NoNNaN has quit [Remote host closed the connection]
NoNNaN has joined #ocaml
cthuluh has quit [Ping timeout: 272 seconds]
oriba has quit [Quit: oriba]