<wmeyer>
ousado: functors and modules are very powerful concept, and usually they don't bite as type classes in some cases :-)
<wmeyer>
(but I do love type classes once they are robust in Coq)
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
<ousado>
:)
pkrnj has joined #ocaml
<ousado>
wmeyer: thanks
<wmeyer>
ousado: I wouldn't be worried too much about not being able to parametrise the type, in practice it's really a high level abstraction that's not strictly required.
<wmeyer>
but you do have a tool
<wmeyer>
:-)
<ousado>
yes, I think you're right there
<wmeyer>
ousado: no wory, have fun
<wmeyer>
damn it, I have to write code! :-D
<ousado>
hehe
<wmeyer>
actually I want to share a project with somebody, that would be perfect, but have no idea what I'll be writing this weekend, probably working for my daytime job
<ousado>
wmeyer: what do you have in mind?
<ousado>
you could take a look at the haxe compiler :D
<wmeyer>
i could but not at the moment
<MarcWeber>
wmeyer: You could also write a composable make system for ocaml :)
<wmeyer>
I think pippijn would beat me down :-)
* wmeyer
is going to bed. Good night!
<ousado>
wmeyer: good night!
oriba has joined #ocaml
ollehar has quit [Ping timeout: 276 seconds]
emmanuelux has quit [Remote host closed the connection]
ulfdoz_ has joined #ocaml
ulfdoz has quit [Ping timeout: 268 seconds]
ulfdoz_ is now known as ulfdoz
<amiller_>
why can't i write this in ocaml:
<amiller_>
let f_on_int_and_string (f : 'a -> unit) (x : int) (y : string) = (f x; f y);;
<amiller_>
i tried sneaking a forall 'a in there
<amiller_>
let fxy (f : 'a . 'a -> unit) ... but that doesn't parse
wmeyer has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
osnr has quit [Ping timeout: 268 seconds]
chris2 has joined #ocaml
Yoric has quit [Ping timeout: 252 seconds]
csakatoku has quit [Remote host closed the connection]
osa1_ has quit [Ping timeout: 268 seconds]
ggole has joined #ocaml
Nahra_ has quit [Quit: leaving]
Nahra has joined #ocaml
Nahra has quit [Changing host]
Nahra has joined #ocaml
Kakadu has joined #ocaml
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
osnr has quit [Ping timeout: 264 seconds]
<whitequark>
pippijn: yeah
<whitequark>
so I have this problem with ocamlbuild: ocamlbuild launches menhir with --infer, and so it needs to actually process the source
<whitequark>
however if I attempt to use extlib inside the parser, it explodes, because ocamlbuild doesn't pass any -package flags to the ocamlc invocation which it gives to menhir
mfp has quit [Read error: Connection reset by peer]
<amiller_>
is it the case that i cannot marshal serialize anything larger than 1GB?
ollehar has joined #ocaml
ollehar1 has quit [Ping timeout: 248 seconds]
<wmeyer>
pippijn: indeed. I'd like to have time for this, but currently have no real time.
<wmeyer>
pippijn: beat me down, you know despite we were doing quite well with the previous project, I think your knowledge about the build system is now far more advanced than mine.
osa1 has quit [Quit: Konversation terminated!]
mfp has joined #ocaml
mrvn has joined #ocaml
mcclurmc has joined #ocaml
<mrvn>
Is there a framework that helps with writing ocaml structures to a socket and reading them back? And something that helps with maintaining compatibility over time? Something to handle out features and help with translating between different versions?
<ygrek>
extprot
<wmeyer>
hi ygrek
<ygrek>
why framework?
<ygrek>
wmeyer, hi!
<wmeyer>
:-)
<ygrek>
just a serialization format
<ygrek>
my choice is extprot, there are also atdgen and bin-prot, but they are more limited wrt compatibility iirc
<wmeyer>
a small chime in: bi-directional DSL for describing serialisation would be the best you could go. Both in binary and text. Worth to look at type-conv and the Boomerang language. Maybe someday I am going to write one.
<nicoo>
Protobuf is nice, also (though binary only)
<companion_cube>
Bencode is cool for text
<companion_cube>
(it's really basic thoughÃ
<ygrek>
protobuf has nothing wrt compatibility, the same for bencode
<ygrek>
ok, not sure about protobuf %)
<companion_cube>
right
<nicoo>
ygrek: protobuf has facilities for extending a format while staying {back;for}wards-compatible
<nicoo>
If that's what you meant
<nicoo>
(If you mean cross-platfom compat, it does have it too)
<mrvn>
ygrek: I want to write type foo = Bla of int | Blub of string | Barf of float @{ver >= 1.2} or something
ollehar has quit [Ping timeout: 264 seconds]
<mrvn>
The hardest part is how to tell the framework what older clients can do and how to translate between older and newer clients.
snearch has quit [Quit: Verlassend]
<nicoo>
Sounds doable with extension_points and poly variants (so as to have type foo1.0, foo1.2, ... with appropriate relationships)
Yoric has quit [Ping timeout: 252 seconds]
<mrvn>
nicoo: yes
<wmeyer>
mrvn: usually it just means that the protocol need to carry the additional information needed retract the changes between versions. Protobuf does it, but not fully
csakatoku has joined #ocaml
<mrvn>
wmeyer: ignoring unknown entries is one thing. But sometimes you can't just ignore stuff but have to transform the data into some other type to get at least partial meaning across.
<nicoo>
wmeyer: Actually, IIRC, this info is only in the protocol description. no such metadata is sent over the wire.
<nicoo>
And what do you mean by "not fully" ?
<wmeyer>
not only ignoring entires you have to have a bi-directional transform between them. If enum changes order you have to capture that.
<wmeyer>
restricting that is good
<wmeyer>
what kind of changes (removing or adding entries is one restriction for instance)
<wmeyer>
are possible
Watcher7|off is now known as Watcher7
csakatoku has quit [Ping timeout: 276 seconds]
<mrvn>
Does extprot have support for async IO? Is there something that I can feed chunks of data received and it calls a callback for every completed message or something that I feed a X bytes and it then tells me the total message length?
iZsh has quit [Quit: Coyote finally caught me]
<wmeyer>
nicoo: you can detect the version of the protocol, and send needed meta data, you have to do it just once per protocol
zpe has joined #ocaml
Neros has quit [Ping timeout: 268 seconds]
iZsh has joined #ocaml
iZsh has quit [Excess Flood]
iZsh has joined #ocaml
osa1 has joined #ocaml
<wmeyer>
mrvn: it must have I think. I'd guess one of the two solutions you have pointed (even driven IO, and classical poll) would work, which one is implemented (maybe both) I am not sure.
<wmeyer>
the other one which can be implemented on top any of these (although poll seems to be more flexible), is of course Lwt or Async interface for asynchonous code
<mrvn>
extprot doesn't seem to have anything for providing translators between different versions. Only seems to support extending with stuff that can be ignored if unknown and with default value if missing.
<mrvn>
:(
<wmeyer>
it's not so obvious how to do this :-)
<mrvn>
yeah. That's why I want a framework that tells me how. :)
<wmeyer>
write one mrvn!
<wmeyer>
the theorey of Darcs patches might be in help
<wmeyer>
to establish the implementation of the meta protocol that handles the version changes
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
Zerker has joined #ocaml
<mrvn>
Maybe I should implement the freeciv framework in ocaml. It has something to annotate structure members with feature flags and handles those features out on connect. And it keeps track of what client and server knows and sends only the bits of a structure that changed on update.
<nicoo>
Sound nice.
<mrvn>
but also complex. I don't quite grog all of it yet.
<mrvn>
They don't have a nice framework with docs and examples. Just the implementation in freeciv.
osnr has quit [Quit: Leaving.]
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
demonimin_ has joined #ocaml
demonimin has quit [Ping timeout: 252 seconds]
<ygrek>
mrvn, nothing for async but it is possible to do on the higher level
<ygrek>
nicoo, didn't know that protobuf can do forward-compatibility
Zerker has quit [Quit: Colloquy for iPad - Timeout (10 minutes)]
<mrvn>
ygrek: yeah, seems like I need to try read ... with IO.No_more_inpuit -> wait for more
<ygrek>
I just do framing and return a complete message for parsing with extprot when it is ready
demonimin_ is now known as demonimin
<mrvn>
ygrek: kind of stupid since extprot lists having the length of the message in the wire protocol as one of its features already.
<nicoo>
mrvn, ygrek : Just found about piqi.org ; doesn't have versioning, though.
<ygrek>
yes, but I prefer not to mix things
testcocoon has quit [Quit: Coyote finally caught me]
<ygrek>
the framing is common code that is used for all kinds of payload
<ygrek>
gtg
<mrvn>
nicoo: there are lots of serialize/deserialize frameworks. But the versioning and compatibility stuff is the hard part. That's what's missing.
<nicoo>
mrvn: Yup, I know. But piqi sound nicer than most.
<mrvn>
ygrek: How do you handle multiple different messages with extprot? Do you make a sum type over all possible messages and then a large switch statement in the reader?
ygrek has quit [Ping timeout: 264 seconds]
testcocoon has joined #ocaml
johnkk has joined #ocaml
<johnkk>
How do I convert any data type into the string which the REPL prints for that object? This is the code I have along with the output expected: http://pastie.org/8116083
<johnkk>
In that example, I want the string 'expr = Or (Var "a", And (Var "b", Var "c"))'
ben_zen has quit [Ping timeout: 276 seconds]
transfinite has quit [Quit: transfinite]
malo has joined #ocaml
csakatoku has joined #ocaml
zpe has quit [Remote host closed the connection]
yacks has quit [Ping timeout: 268 seconds]
csakatoku has quit [Ping timeout: 248 seconds]
Yoric has joined #ocaml
zorun has quit [Ping timeout: 256 seconds]
zorun has joined #ocaml
UncleVasya has joined #ocaml
Yoric has quit [Ping timeout: 252 seconds]
pkrnj has joined #ocaml
tchell_ is now known as tchell
yacks has joined #ocaml
Uvs has joined #ocaml
UncleVasya has quit [Ping timeout: 264 seconds]
Yoric has joined #ocaml
transfinite has joined #ocaml
darkf has quit [Quit: Leaving]
ski has joined #ocaml
johnkk has quit [Quit: Page closed]
mcclurmc has quit [Read error: Connection reset by peer]
csakatoku has joined #ocaml
gnuvince has quit [Ping timeout: 256 seconds]
csakatoku has quit [Ping timeout: 264 seconds]
zpe has joined #ocaml
zpe has quit [Ping timeout: 264 seconds]
q66 has quit [Remote host closed the connection]
q66 has joined #ocaml
pkrnj has quit [Quit: Computer has gone to sleep.]
Snark has quit [Ping timeout: 264 seconds]
fraggle_ has quit [Remote host closed the connection]
ashleyis_ has joined #ocaml
ashleyis has quit [Ping timeout: 252 seconds]
<mrvn>
Anyone familiar with oasis? E: Malformed log file '/home/mrvn/src/debian/ocaml-4.00/ocaml-expect/ocaml-expect-0.0.2/setup.log' at line 1
wmeyer has quit [Ping timeout: 264 seconds]
csakatoku has joined #ocaml
csakatoku has quit [Ping timeout: 264 seconds]
avsm has quit [Ping timeout: 246 seconds]
avsm has joined #ocaml
<nicoo>
Would someone know if there is a unicode library which makes accent removal simple ?
* nicoo
has yet to figure how to do that with Camomille
gautamc has quit [Read error: Connection reset by peer]
gautamc has joined #ocaml
<nicoo>
Seems /wg #code
<nicoo>
Oops
<whitequark>
nicoo: I think you need NFKD and then filtering by character classes
<nicoo>
whitequark: That's the part of the doc I was looking at, but Camomille's OCamlDoc isn't very helpful :o
Arthur__ has joined #ocaml
Arthur_ has quit [Read error: Connection reset by peer]
cdidd has quit [Read error: Connection reset by peer]
cdidd has joined #ocaml
csakatoku has joined #ocaml
weie_ has joined #ocaml
weie has quit [Ping timeout: 264 seconds]
cdidd has quit [Quit: Leaving]
csakatoku has quit [Remote host closed the connection]
jayprich has quit [Ping timeout: 268 seconds]
watermind has quit [Quit: Konversation terminated!]
cdidd has joined #ocaml
Watcher7 is now known as Watcher7|off
* nicoo
hugs companion_cube
<companion_cube>
\o
ulfdoz has quit [Ping timeout: 276 seconds]
walter has joined #ocaml
<whitequark>
hm, can you suggest a data structure? I have a set of consecutive ranges and each one has associated string
<whitequark>
e.g. 0-5:a 6-80:b 81-90:c
<whitequark>
and given a number, I need to quickly look up the corresponding string
wmeyer has joined #ocaml
<whitequark>
some kind of tree, I guess
<wmeyer>
is it so humid in France too?
<wmeyer>
here, the weather is brillaint, but a bit too hot
<nicoo>
companion_cube: Seems random, but I was too lazy to write a multiSet implementation, and a friend pointed me to ocaml-containers/multiSet :3
walter has quit [Client Quit]
<orbitz>
whitequark: interval tree perhaps?
<companion_cube>
nicoo: we've talked about it just today, you're lucky!
<whitequark>
orbitz: hm, the wiki article on interval tree says that for non-overlapping interval, I'm totally fine with a binary tree
<Drup>
interval tree is not necessary if it's known that the range are consecutive.
<whitequark>
essentially, I want that to efficiently store location info in AST
<whitequark>
a single location ("cursor") is represented by a single int, which indexes a concatenated view of all existing source files
<orbitz>
Just write it so yo ucan swap out the structure at any point and implement it with a list :)
<whitequark>
orbitz: obviously
<whitequark>
I already know that a naive approach here sucks, though :)
<orbitz>
Is your problem that your program is done and the naive approach is slowing it down or that your program is not done and you're optimizingsomething before you can even do what you want to do?
<whitequark>
orbitz: I wrote a prototype and linear search in a list was a bottleneck
<orbitz>
okay great
<whitequark>
(in some workloads I care about.)
<orbitz>
Does it sound like an interval tree will do what you want
<orbitz>
?
<whitequark>
yes, but it also looks like an overkill, since my ranges do not overlap
<Drup>
whitequark: if the goal is to know the string associated to an int, just do a binary search tree with leaf in the string
<Drup>
(and node indexed by int, obviously)
<whitequark>
Drup: well, I have the same string associated to an arbitrarily big range of consecutive ints
<Drup>
whitequark: yes, and you can encode that using int on the internal nodes
<whitequark>
I see. I should read up on data structures.
<whitequark>
thanks
<Drup>
it's good if you want fast access, I'm not sure it's really good if you want fast insertion/deletion
<whitequark>
I don't delete at all
<whitequark>
and I only add new nodes at the "end"
<Drup>
(it's still better than list)
<whitequark>
uh... if I just snap them on naively, I'll end up with a completely unbalanced tree
<Drup>
yes :)
<orbitz>
Do you know the entire set prior to adding them?
<Drup>
orbitz: I was precisely going to ask that :D
<whitequark>
orbitz: let's say no
jbrown has joined #ocaml
<orbitz>
well, that's annoying
walter has joined #ocaml
<orbitz>
do you need the tree created prior to adding?
<orbitz>
(do yo ureadfrom it at any point during the creation)
Yoric has quit [Ping timeout: 252 seconds]
<whitequark>
I think I can delay its creation until I actually need it, and by that point I'll have most of the ranges already known
<whitequark>
well, how to make a balanced tree in this case is obvious :)
<Drup>
indeed
<whitequark>
in fact, if I need to add more ranges afterwards, I may just as well throw it out completely and rebuild
walter has quit [Client Quit]
<whitequark>
chances that at the end, it will be faster than keeping it up
<whitequark>
I'll also use the same structure for looking up line numbers by position...
<wmeyer>
ping adrien
<mrvn>
I wonder if sexplib could be implemented with GADTs instead of camlp4
thomasga has quit [Quit: Leaving.]
pkrnj has joined #ocaml
yacks has quit [Ping timeout: 248 seconds]
<nicoo>
companion_cube: You have a pull request ! (Adding the trivial 'contains' function to multiSet)
<companion_cube>
there is a mem function
<companion_cube>
oh, I see
<nicoo>
Thanks :)
<mathieui>
nicoo: tri-cy-vial*
ollehar has joined #ocaml
Simn has quit [Quit: Leaving]
<whitequark>
ugh. ocamllex generated about 2200 LOC of junk
<whitequark>
what is wrong with it
* mrvn
gazes into his magic-8-ball
<mrvn>
error in line 23
<whitequark>
mrvn: lol, that was a rhetorical question
Uvs has quit [Remote host closed the connection]
<whitequark>
"why is its output so fucking ugly"
<mrvn>
generated code usualy is
<whitequark>
though I think I know why... each keyword is a separate rule
<mrvn>
companion_cube: you should make yout triplet as Pair of Pair
<companion_cube>
mrvn: you can use both, it's just simpler to have triplets when needed
<mrvn>
| Triple : 'a t * 'b t * 'c t -> ('a * ('b * 'c)) t
<mrvn>
Is the Switch and Branch* for records?
emmanuelux has joined #ocaml
<companion_cube>
it's for algebraic datatypes
<companion_cube>
because the encoded type depends on which constructor is used
<mrvn>
Ok. So no support for records then?
<whitequark>
aren't records product types essentially
tobiasBora has quit [Quit: Konversation terminated!]
<mrvn>
except for labels and mutability
<whitequark>
right, mutability.
<whitequark>
mrvn: labels (imo) don't matter, since that is just syntactic sugar
<mrvn>
labels only matter for pretty printing
<whitequark>
you can do without them on the lowest level, eg erlang
<mrvn>
I stuffed the record into a recursive type. Would be nicer to have a list or array for it.
<mrvn>
(accessor * type) array
<companion_cube>
mrvn: well, products are just tuples, here
<mrvn>
Problem there is that for each index the accessor and type have a different type.
<mrvn>
e.g. ((fun r -> r.x), Int) and ((fun r -> r.f), Float)
<mrvn>
Maybe something like type _ entry = Entry : a * 'b * 'c -> 'c entry and then 'c entry array
<companion_cube>
the potential difficulty is to handle deserialization, because then you need to create the whole record at once
<mrvn>
easier with recursive definition too. You then just need a function taking all fields and you feed it the values one by one recursively and you end up with the record.
<mrvn>
With list/array you need to encode the length in the type
<mrvn>
companion_cube: Have you looked at sexplib and how it does this?
<companion_cube>
sexplib does it by generating code, I believe
<mrvn>
camlp4 module
<mrvn>
Might not be too difficult to adapt sexplib to output GADTs instead of the code and then use GADT based code for the conversions and pretty printing.
ollehar has quit [Ping timeout: 276 seconds]
* mrvn
curses at whoever thought it a good idea to change the type of Pa_type_conv.add_sig_generator