adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org and http://caml.inria.fr | http://ocaml.org/releases/4.02.0.html | Public channel logs at http://irclog.whitequark.org/ocaml
rgrinberg has joined #ocaml
zpe has quit [Ping timeout: 272 seconds]
MrScout has joined #ocaml
jabesed has quit [Remote host closed the connection]
MrScout has quit [Remote host closed the connection]
MrScout has joined #ocaml
sheijk has quit [Ping timeout: 258 seconds]
AltGr has joined #ocaml
sheijk has joined #ocaml
shinnya has joined #ocaml
MrScout has quit [Ping timeout: 265 seconds]
jabesed has joined #ocaml
Submarine has quit [Remote host closed the connection]
jabesed has quit [Remote host closed the connection]
Thooms has quit [Quit: WeeChat 1.0.1]
jabesed has joined #ocaml
travisbrady has joined #ocaml
manud__ has joined #ocaml
zpe has joined #ocaml
manud__ has quit [Read error: Connection reset by peer]
<lordkryss> guys
manud__ has joined #ocaml
<lordkryss> just to let you know oca.ml is a valid domain
<lordkryss> somebody could buy it and point it to some official website
rgrinberg1 has joined #ocaml
rgrinberg has quit [Read error: Connection reset by peer]
madroach has quit [Ping timeout: 250 seconds]
madroach has joined #ocaml
zpe has quit [Ping timeout: 240 seconds]
jabesed has quit [Quit: Konversation terminated!]
pyon has joined #ocaml
jabesed has joined #ocaml
jabesed has quit [Client Quit]
NoNNaN has quit [Remote host closed the connection]
NoNNaN has joined #ocaml
samuel02 has joined #ocaml
manud__ has quit [Remote host closed the connection]
manud has joined #ocaml
serge has quit [Remote host closed the connection]
serge has joined #ocaml
samuel02 has quit [Ping timeout: 272 seconds]
<struktured> Denommus: without actually googling, I can say that such a program would be useless beyond being a means to learn ocaml. The number of ocaml software positions is sufficiently small that even claiming to know ocaml will probably get you an interview :)
darkf has joined #ocaml
<whitequark> lordkryss: it costs $350 or something
shinnya has quit [Ping timeout: 256 seconds]
manud_ has joined #ocaml
igitoor has quit [Ping timeout: 272 seconds]
ygrek has joined #ocaml
manud has quit [Read error: Connection reset by peer]
avsm has quit [Quit: Leaving.]
Submarine has joined #ocaml
hausdorff has quit [Remote host closed the connection]
igitoor has joined #ocaml
manud_ has quit [Quit: Be back later ...]
igitoor has joined #ocaml
igitoor has quit [Changing host]
zpe has joined #ocaml
rgrinberg1 has quit [Quit: Leaving.]
rgrinberg has joined #ocaml
jwatzman|work has quit [Quit: jwatzman|work]
rgrinberg has quit [Client Quit]
zpe has quit [Ping timeout: 250 seconds]
travisbrady has quit [Quit: travisbrady]
igitoor has quit [Ping timeout: 265 seconds]
igitoor has joined #ocaml
sheijk has quit [Ping timeout: 291 seconds]
igitoor has quit [Ping timeout: 272 seconds]
demonimin has quit [Ping timeout: 260 seconds]
fraggle_ has quit [Ping timeout: 260 seconds]
jcloud has quit [Ping timeout: 260 seconds]
sh1ken has quit [Ping timeout: 260 seconds]
segmond has quit [Ping timeout: 261 seconds]
gperetin has quit [Ping timeout: 257 seconds]
rom1504 has quit [Ping timeout: 257 seconds]
cespinoza has joined #ocaml
sh1ken_ has joined #ocaml
claudiuc has quit [Remote host closed the connection]
jcloud_ has joined #ocaml
demonimin_ has joined #ocaml
seggy has joined #ocaml
jcloud_ is now known as jcloud
rom1504_ has joined #ocaml
hellome has quit [Read error: Connection reset by peer]
manud_ has joined #ocaml
travisbrady has joined #ocaml
hausdorff has joined #ocaml
emery_ has quit [Ping timeout: 250 seconds]
gperetin has joined #ocaml
emery has joined #ocaml
rom1504_ is now known as rom1504
hausdorff has quit [Ping timeout: 272 seconds]
igitoor has joined #ocaml
sheijk has joined #ocaml
igitoor has joined #ocaml
igitoor has quit [Changing host]
sheijk has quit [Ping timeout: 250 seconds]
dsheets has quit [Ping timeout: 258 seconds]
q66 has quit [Quit: Leaving]
zpe has joined #ocaml
kdef has joined #ocaml
zpe has quit [Ping timeout: 240 seconds]
travisbrady has quit [Quit: travisbrady]
lordkryss has quit [Quit: Connection closed for inactivity]
rgrinberg has joined #ocaml
hausdorff has joined #ocaml
hausdorff has quit [Remote host closed the connection]
hausdorff has joined #ocaml
sheijk has joined #ocaml
hausdorff has quit [Remote host closed the connection]
samrat has joined #ocaml
sheijk has quit [Ping timeout: 264 seconds]
zpe has joined #ocaml
zpe has quit [Ping timeout: 255 seconds]
<mcc> …so:
<mcc> let z = 1 in let y = a.x <- a.x + z; a.x in y;;
<mcc> how does it decide which "let x in EXP" exp is being broken by the single-semicolon?
<whitequark> it's unambiguous
<whitequark> let is the left delimiter, and in is the right one, essentially
<whitequark> try to add parens to make the ways you think it could be parsed explicit, and you will see
travisbrady has joined #ocaml
<mcc> let z = 1 in let y = (a.x <- a.x + z; a.x) in y;; … this is where i *THINK* it's "putting the parenthesis". am i right?
<whitequark> yep
bgianf has quit [Ping timeout: 245 seconds]
bgianf has joined #ocaml
kandu is now known as dudu
<mcc> cool
travisbrady has quit [Quit: travisbrady]
manud_ has quit [Quit: Lingo: www.lingoirc.com]
sheijk has joined #ocaml
sheijk has quit [Ping timeout: 272 seconds]
samuel02 has joined #ocaml
Submarine has quit [Remote host closed the connection]
samuel02 has quit [Ping timeout: 264 seconds]
igitoor has quit [Remote host closed the connection]
igitoor has joined #ocaml
larhat has quit [Quit: Leaving.]
appd has joined #ocaml
zpe has joined #ocaml
hsuh has quit [Ping timeout: 255 seconds]
hsuh has joined #ocaml
mw has joined #ocaml
zpe has quit [Ping timeout: 245 seconds]
mw has left #ocaml [#ocaml]
hausdorff has joined #ocaml
igitoor has joined #ocaml
igitoor has quit [Changing host]
samrat has quit [Quit: Computer has gone to sleep.]
MrScout has joined #ocaml
hsuh has quit [Ping timeout: 255 seconds]
hsuh has joined #ocaml
MrScout has quit [Remote host closed the connection]
MrScout has joined #ocaml
sheijk has joined #ocaml
siddharthv_away is now known as siddharthv
Submarine has joined #ocaml
Submarine has joined #ocaml
sheijk has quit [Ping timeout: 265 seconds]
appd has quit [Remote host closed the connection]
rgrinberg has quit [Quit: Leaving.]
zpe has joined #ocaml
samrat has joined #ocaml
AlexRussia has quit [Ping timeout: 244 seconds]
zpe has quit [Ping timeout: 245 seconds]
ygrek has quit [Ping timeout: 264 seconds]
wwilly has joined #ocaml
<struktured> holy crap. Core.Std.Option.map, where have you been all my life?
ggole has joined #ocaml
<mcc> can anyone help me figure out this mystery? it announces a field is unbound in a struct, and it's definitely in a struct.
<mcc> saying currentPosition () : codePosition does not help.
samuel02 has joined #ocaml
<whitequark> context?
sheijk has joined #ocaml
<whitequark> and the specific error message, too
<mcc> uhhhhhhh
<mcc> i thought i pasted this url but i didn't http://pastie.org/9711018
<mcc> more context can be provided if helpful
<whitequark> no, this is enough
<whitequark> so, unless you open Token, the fields are not in scope
<mcc> oh wait geez... could this happen if name is the wrong type
<whitequark> you can do Token.fileName
<mcc> huh. really?
<mcc> okay
<whitequark> yeah, that's the proper way
<whitequark> relying on inference is fragile, as you may have noticed
<ggole> Compiles fine here, btw (when I replace the expressions with something that's in scope)
<ggole> Oh wait, in different files. Right.
<struktured> mcc: or prefix it with "let open Token in "..., although I rarely do that
<mcc> that's a little scary but ok
<ggole> Token.{ ... } works too
<mcc> so later i try to say p.fileName
<ggole> (In a recent OCaml)
<mcc> and i get, again, Error: Unbound record field fileName
<struktured> ggole: oh that's pretty cool. so the entire {...} is scoped? nice
<mcc> do i have to… what, Token.fileName p ?
<ggole> mcc: yeah
<whitequark> p.Token.fileName
<mcc> yikes ok
<ggole> Unless you open or shorten the module
<whitequark> note that you only need to prefix one field when constructing a struct
<whitequark> { Token.fileName; lineNumber; ... }
samuel02 has quit [Ping timeout: 260 seconds]
sheijk has quit [Ping timeout: 244 seconds]
<mcc> i'm trying to avoid open... i'm happy to use the prefixes usually but prefixes for *field accesses* seems a bit extreme
<ggole> Shortening is probably preferable
<ggole> Most ocaml code is written with short names that are intended to be used qualified
<ggole> Queue.create, Hashtbl.create, etc
<ggole> mcc: it's a bit annoying, yeah. That's the price for inference.
<mcc> i guess it seems like i should well be able to just type p as a codePosition and that's… i mean, that's not hard to find what the field names are from there
arj has joined #ocaml
<ggole> Very recently something similar was added
<ggole> But there's a warning for relying on it
<ggole> eg you can do let current_pos () : Token.pos = { name = ...; line = ...; }
<mcc> i tried that and it didn't work
<ggole> Which version of ocaml do you have? It was added quite recently.
<whitequark> using just Token.name would be even shorter, here
<ggole> Right, but ascription also works for arguments
<mcc> ok. um, 4.02.1
<ggole> Then it should work... sec, I'll put up some test code.
<mcc> i'll double-check, there's other type errors in the vicinity
<ggole> This should raise a warning but still compile.
<mcc> okay, interesting, that did exactly what you said
<ggole> You can muffle the warning if you decide you want to take this approach
<ggole> ...though maybe I shouldn't be advising things that require muffling warnings.
<mcc> yeah reading too
MercurialAlchemi has joined #ocaml
ygrek has joined #ocaml
<mcc> *ah*
<mcc> now i see why i wasn't getting the warning even
zpe has joined #ocaml
ggole_ has joined #ocaml
zpe has quit [Ping timeout: 255 seconds]
ggole has quit [Ping timeout: 244 seconds]
ggole_ is now known as ggole
<mcc> i sure am starting to wish i had one of those fancy eye dee ees that when there's an error highlights the line it's on
<whitequark> mcc: editor?
<mcc> IDE. sorry
<whitequark> yes, sure, I'm asking what editor do you use.
<mcc> oh! sublime text, currently. likely to switch to "Atom" soon.
<ggole> If you use emacs or vim, there's a nifty little thing called merlin that will do that
<mcc> you were writing some stuff about Sublime, right?
<ggole> (Or sublime text?)
<mcc> neat!
<whitequark> does exactly what you want, and more
<mcc> ...ah, hm. sublime text 3
<whitequark> "goto definition", completion, "show me the type of this"
<whitequark> hm
<mcc> 3 doesn't work on my OS D:
<mcc> i'll wait a few months.
<whitequark> D:
<mcc> in theory, i'm getting a new computer in december. i guess.
<whitequark> i never thought that's possible, back when I said "you don't need to support ST2"
<mcc> whitequark: hey, here is a question-- you run sublime3 on linux, right? does it ... like ... crash all the time for you?
<ggole> Hahaha
<whitequark> mcc: I don't think it ever crashed
<mcc> hm, ok
<whitequark> I did experience strange hangups one or two times
<whitequark> but it's not even annoying
keen___________1 has joined #ocaml
<whitequark> maybe it crashed like once? idk. certainly not all the time, though.
<mcc> i get crashes like, maybe once or twice a day.
<mcc> i'm running on a VM... maybe it's out of memory. hm.
keen___________0 has quit [Ping timeout: 250 seconds]
<whitequark> hmm
<whitequark> set gdb at it
<whitequark> it's not even stripped, so you'll actually see where it crashes.
<mcc> o rly
<mcc> that's useful to know
<whitequark> and with some minor debuggin skills, maybe fix it, if it's a bug
<mcc> i saw, that's why i knew what text editor you use :)
<whitequark> oh
<mcc> didn't read the whole thing tho yet
ggole has quit [Read error: Connection reset by peer]
ggole has joined #ocaml
robink has quit [Ping timeout: 255 seconds]
esden has quit [Ping timeout: 275 seconds]
sheijk has joined #ocaml
samuel02 has joined #ocaml
struk_at_work has quit [Ping timeout: 246 seconds]
sheijk has quit [Ping timeout: 240 seconds]
samuel02 has quit [Ping timeout: 258 seconds]
gustav___ has quit [Write error: Broken pipe]
milosn has quit [Write error: Broken pipe]
_whitelogger has joined #ocaml
samuel02 has joined #ocaml
sheijk has joined #ocaml
sheijk has quit [Ping timeout: 250 seconds]
cdidd has joined #ocaml
zpe has joined #ocaml
robink has joined #ocaml
cdidd has quit [Max SendQ exceeded]
cdidd has joined #ocaml
zpe has quit [Ping timeout: 265 seconds]
jonludlam has quit [Ping timeout: 258 seconds]
WhoNeedszZz has quit [Quit: Leaving]
govg has quit [Remote host closed the connection]
srcerer has quit [Ping timeout: 245 seconds]
ollehar has joined #ocaml
jgjl has joined #ocaml
luigy has joined #ocaml
hausdorff has quit [Remote host closed the connection]
hausdorff has joined #ocaml
sheijk has joined #ocaml
sheijk has quit [Ping timeout: 250 seconds]
vogler has joined #ocaml
zpe has joined #ocaml
srcerer has joined #ocaml
dav has quit [Ping timeout: 250 seconds]
Guest14117 has joined #ocaml
darkf_ has joined #ocaml
psy_ has quit [Ping timeout: 244 seconds]
darkf has quit [Ping timeout: 244 seconds]
govg has joined #ocaml
samrat has quit [Quit: Computer has gone to sleep.]
samrat has joined #ocaml
hausdorff has quit [Remote host closed the connection]
Guest14117 has quit [Remote host closed the connection]
dav_ has joined #ocaml
Simn has joined #ocaml
hausdorff has joined #ocaml
hausdorff has quit [Remote host closed the connection]
darkf_ is now known as darkf
dav_ has quit [Ping timeout: 272 seconds]
ggole has joined #ocaml
dav_ has joined #ocaml
ingsoc has joined #ocaml
demonimin has joined #ocaml
demonimin_ has quit [Ping timeout: 264 seconds]
AlexRussia has joined #ocaml
_andre has joined #ocaml
sheijk has joined #ocaml
zpe_ has joined #ocaml
Arsenik has joined #ocaml
zpe has quit [Ping timeout: 272 seconds]
sheijk has quit [Ping timeout: 250 seconds]
bezirg has joined #ocaml
samrat has quit [Quit: Computer has gone to sleep.]
samrat has joined #ocaml
dav_ has quit [Ping timeout: 272 seconds]
Guest82877 has joined #ocaml
ebzzry has quit [Remote host closed the connection]
jpdeplaix has quit [Ping timeout: 256 seconds]
ebzzry has joined #ocaml
jpdeplaix has joined #ocaml
zpe_ has quit [Remote host closed the connection]
nojb has joined #ocaml
zpe has joined #ocaml
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
thizanne has joined #ocaml
<Drup> (07:07:57) struktured: holy crap. Core.Std.Option.map, where have you been all my life? <-- everytime I start a project. I start without any additional library, and then I need this function (or Option.iter, bind, etc). Then I say "Oh fuck you" and then I use an extanded standard library.
sheijk has joined #ocaml
<Drup> it's ... systematic.
appd has joined #ocaml
sheijk has quit [Ping timeout: 245 seconds]
lordkryss has joined #ocaml
dsheets has joined #ocaml
sgnb has quit [Ping timeout: 265 seconds]
<MercurialAlchemi> Drup: hehe
<MercurialAlchemi> BatOptions is convenient too
<Drup> yes, that's the one I used, until recently, CCOpt
Thooms has joined #ocaml
nojb has quit [Quit: nojb]
Kakadu has joined #ocaml
<ggole> I usually nih an option.ml
<ggole> Takes about thirty seconds to write the three most common operations
Simn has quit [Read error: Connection reset by peer]
<companion_cube> map, flat_map, and ... ?
<ggole> map, iter, get_default
<companion_cube> ok
<ggole> I guess "most common" is a bit variable :)
<Drup> ggole: it takes also thrity seconds to add containers and get the non common ones :D
<ggole> I'm just dependency shy.
<companion_cube> it also takes 30 seconds to copy/past CCOpt.ml{,i} into your project ;)
* companion_cube wants Drup to cry
<Drup> /me draws out a shotgun.
Thooms has quit [Quit: WeeChat 1.0.1]
<Drup> ಠ_ಠ
<companion_cube> yay for unknown unicode symbols
<ggole> "PINK KITTEN EATING NOODLES"
siddharthv is now known as siddharthv_away
siddharthv_away has quit [Remote host closed the connection]
<companion_cube> "WILD DRUP EATING HEART"
<Drup> x)
<ggole> Goddamn it, the hard part of GADTs was supposed to be done once I had that table.
<ggole> But no.
<Drup> ggole: which version are you using in the end ?
<ggole> My functor + reimplement one
<Drup> :/
<ggole> Mostly because I wanted to do it without cheating
<Drup> you saw yallop solution, did you ?
<ggole> Yeah
nojb has joined #ocaml
<ggole> Drup: this isn't production code, I'm not going to be rolling out my own hand-rolled hash table to some poor bastard
<companion_cube> you miss all the fun
<ggole> It's mostly about me finally figuring out existential types properly
<Drup> ok ^^
<Drup> yallop's solution precisely avoid rolling out a hash table, though :p
<ggole> Right, but I wanted to figure out how you'd do it without the wrapper
<Drup> k
<ggole> Now I've progressed to arsing about with equality witnesses. -_-
avsm has joined #ocaml
appd has quit [Remote host closed the connection]
samrat has quit [Quit: Computer has gone to sleep.]
jgjl has quit [Ping timeout: 245 seconds]
appd has joined #ocaml
appd_ has joined #ocaml
appd has quit [Ping timeout: 244 seconds]
appd_ has quit [Quit: Leaving...]
sheijk has joined #ocaml
sheijk has quit [Ping timeout: 264 seconds]
ygrek has quit [Ping timeout: 264 seconds]
jonludlam has joined #ocaml
badon has joined #ocaml
arj has quit [Remote host closed the connection]
arj has joined #ocaml
<reynir> is there something like Module.(...) when matching on records?
govg has quit [Ping timeout: 264 seconds]
<nojb> reynir: what do you mean ?
govg has joined #ocaml
<reynir> match foo with { Module.field1; Module.field2 } -> ...
<nojb> reynir: you only need to qualify one of the fields: match foo with {Module.field1; field2 } -> ...
<reynir> a way to "open" Module inside the match clause so to speak
<reynir> Oh, I didn't know. Thanks!
<nojb> reynir: or you can enclose everything in a: let open Module in …
<nojb> let opan Module in match foo with {field1; field2} -> ...
<nojb> *open
AlexRussia has quit [Ping timeout: 250 seconds]
<reynir> Yea, that's what I was doing before
<companion_cube> nojb: nice
avsm has quit [Quit: Leaving.]
Guest82877 has quit [Remote host closed the connection]
sheijk has joined #ocaml
<hcarty> Module.(match ...) works too. And if you have a recent enough version dropping the 'open' entirely should work, though you'll get warnings by default.
<hcarty> Recent enough version of OCaml that is
<ggole> Hmm, let Foo.{ ... } = ... in ... doesn't work
<ggole> I expected it to.
<hcarty> Drup: Why the move from Batteries to CC if I may ask?
<Drup> hcarty: js_of_ocaml + the fact that batteries is slightly stuck for now
<nojb> ggole: Foo.{… } is syntactic sugar for let open Foo in {…}.
dudu is now known as kandu
<Drup> ggole: let {Foo. ...} = in ...
<hcarty> Drup: But not in pattern matches apparently
Guest96636 has joined #ocaml
<Drup> yes, in pattern matches
<hcarty> nojb: Sorry ^^
<ggole> nojb: ah, so it applies to the expressions as well.
<hcarty> Drup: Sorry, meant that for nojb
<Drup> right :p
<Drup> well "let open Foo in .." is not a pattern ...
<ggole> It's slightly odd for Foo.{ x = 1 } to construct a record but Foo.{ x } not to destruct it.
<Drup> ggole: but {Foo. x = 1} and {Foo. x} works
<ggole> Right.
<nojb> Foo{ x } also constructs a record if a variable x is in scope
<nojb> *Foo.{x}
BitPuffin has joined #ocaml
<Drup> ggole: also, Foo.{ x = <e> } and {Foo. x = <e> } are different
<Drup> for the first one, Foo is open in e, not for the second one
<ggole> Yep, got that
<hcarty> It's probably worth filing a Mantis bug about that mismatch
<hcarty> It could be nice to have, for example, match x with M.[{field1; field2}; _] -> field1, field2
<Unhammer> is there any way to use merlin with eliom? (perhaps by avoiding/minimising use of the syntax extensions somehow?)
<Drup> Unhammer: merlin doesn't work with the eliom syntax extension
<Drup> there is no workaround, except not using the syntax extension :/
<Drup> (so, isolate the part that are only client/only server/only both)
Guest96636 has quit [Remote host closed the connection]
dav_ has joined #ocaml
<Unhammer> hmm, is it possible to write the equivalent of {client{ blah }} using some more verbose code though?
<Unhammer>
<Unhammer> or would that require changes all over the file …
<Drup> yeah, err, no, don't.
<Unhammer> hehe ok :)
<ggole> Hmm, when taking a polymorphic function as argument is it still necessary to go through a record/object?
<Drup> by polymorphic, you mean with a forall ?
<ggole> Yeah
<nojb> ggole: depends what you do with it …
<Drup> then yes
<hcarty> http://caml.inria.fr/mantis/view.php?id=6656 for the feature request
<ggole> nojb: if I want to apply the function to GADT values of unknown indices?
<nojb> ggole: then yes
<ggole> Right.
shinnya has joined #ocaml
<nojb> hcarty: you can already do some of that with match foo with {Complex.re} -> re as several people mentioned
AltGr has left #ocaml [#ocaml]
<ggole> By way of context, this is what I'm doing: https://gist.github.com/936d74c3fbc1f75ad623
<nojb> And using M.[] as a pattern does not make much sense, I think …
travisbrady has joined #ocaml
avsm has joined #ocaml
avsm1 has joined #ocaml
AlexRussia has joined #ocaml
<hcarty> nojb: 'Complex.[{re; _}; {im; _] -> re, im' as one contrived use
<nojb> hcarty: I see, but you can do that today with match foo with [{Complex.re; _}; {Complex.im; _}] -> re, im …
avsm has quit [Ping timeout: 255 seconds]
<hcarty> nojb: Indeed
<hcarty> The symmetry would be nice to have though
<nojb> ggole: does your code compile ?
<ggole> Sure
<ggole> I'm just trying to make the usage a bit more pleasant.
<ggole> ...which hardly seems to matter given the hoops I'm going to have to jump through to produce an eq_assoc, sigh
travisbrady has quit [Quit: travisbrady]
<nojb> ggole: pretty nice!
<ggole> Thanks.
<ggole> Not sure what it's going to be like to use though.
<nojb> ggole: it works nicely, e.g., module G = struct type _ key = I : int key | S : string key type ‘a value = ‘a let eq_assoc : type a b. a key -> b key -> b value -> a value option = fun k1 k2 v -> match k1, k2 with I, I -> Some v | S, S -> Some v | _ -> None let hash = Hashtbl.hash end
<ggole> Right, for simple cases like that its OK
<ggole> The difficulty turns up when I have a constructor like | Cmp : cmp_op * 'a ty * 'a insn * 'a insn : a t
<Drup> what is the issue with that ?
<companion_cube> reminds me of : type ('a,'b) eq = Equal : ('a,'a) eq;; val equal : 'a key -> 'b key -> ('a,'b) eq option
<ggole> The 'a ty provides a way to produce an equality witness, which I need to compare the 'a insn on each side
<Drup> As long as you have a function "'a t -> 'b t -> bool" it's fine
<Drup> which is not too difficult, for gadt
<ggole> bool is not enough
<Drup> (even if excessively verbose)
<ggole> It doesn't demonstrate type equality to the type checker, which you need to compare an a t and a b t
Hannibal_Smith has joined #ocaml
<ggole> So you need something like eq_assoc for 'a ty too
<ggole> Then I need *another* one for comparing arrays of operands (eg, for a phi)
<ggole> It's all possible, just very heavy.
<Drup> ggole: you should just use one of the cheating approach that don't need this eq_assoc function
Simn has joined #ocaml
<ggole> The whole point is to do it without needing Obj.magic
<companion_cube> cheating approaches don't always need Obj
<Drup> yallop's approach doesn't Obj.magic
<ggole> Yallop's approach doesn't map from GADT index to the same index though
<companion_cube> if we're talking about heterogeneous maps, https://github.com/c-cube/mixtbl doesn't Obj
<Drup> it doesn't ?
<ggole> I don't think so, it was just 'a t -> value
<ggole> For polymorphic 'a
<ggole> (If I'm wrong, then maybe I should do it that way.)
<companion_cube> val get : inj:('a, 'b) injection -> 'a t -> 'a -> 'b option
<Drup> ggole: 'a t -> 'a
<companion_cube> whre the 'injection' is a type-specific key
<Drup> well, 'a key -> 'a
<ggole> Drup: right
<ggole> I want 'a key -> 'a value
psy_ has joined #ocaml
<Drup> which is enough for gadt
<Drup> 'a key -> 'a is more powerful, so you can adapt it to what you want
<ggole> How so? If I have uninhabited type info and then info t, a table mapping info t -> info is useless (necessarily empty)
<ggole> I don't want that, I want info t -> info something_else
<ggole> Unless I'm missing something.
<Drup> I mean that the technique used can be adapted
<ggole> I'll take another look.
<Drup> at least I think
<ggole> I think type equality is a necessary part of getting it to work without Obj. But I'd be pleased to learn that's wrong.
<Drup> oh, you need equality too, just "_ key -> _ key -> bool" is enough
Arsenik has quit [Remote host closed the connection]
<ggole> No, *type* equality
<Drup> the cheating part is in the unpack function
<ggole> The thing that lets you tell the type checker that if you have an entry containing an 'a key and an 'a value, and the key is equal to a 'b key, the value is also a 'b value
<ggole> *the search key
<ggole> Providing this is the whole point of the eq_assoc nonsense.
<Drup> well, if you use the pair type, it works better
<Drup> type pair = Pair : 'a key * 'a -> pair
<Drup> then, given a 'b key, you open the Pair type, you pattern match, and you get the equality
<hcarty> companion_cube: Is there a (planned) containers equivalent to BatResult/(whatever Core has for this purpose)?
<hcarty> companion_cube: Something with a similar ('good, 'bad) t type
<ggole> Drup: pattern matching to get the equality is the hard part, though
<Drup> ggole: is it ?
<ggole> Yeah. You have a Pair ('a key, 'a value), and an 'b key.
<ggole> How do you tell the type checker that the 'a value is actually a 'b value?
<nojb> ggole: on a related note, as companion_cube observed, it is enough to define a function ‘a key -> ‘b key -> (‘a, ‘b) eq option where type (‘a, ‘b) eq = Eq : (‘a, ‘a) eq so no need to involve the _ value type
<ggole> You need to demonstrate type equality.
<Drup> ggole: did you looked at yallop's whole implementation ?
<companion_cube> hcarty: there is CCError -- although it is less general
<Drup> ggole: because for me, it answers the question
<arj> is it guaranteed that List.foldi of Core calls the elements in list order, that is from head to tail?
<arj> doc only says that it's tail-recursive
dav_ has quit [Remote host closed the connection]
<ggole> nojb: how do you use that, exactly?
dav_ has joined #ocaml
<ggole> No wait, I think I understand.
<nojb> ggole: see the last example in the manual http://caml.inria.fr/pub/docs/manual-ocaml-400/manual021.html#toc85
axiles has joined #ocaml
<nojb> ggole: constructing a (‘a, ‘b) Eq guarantees that ‘a and ‘b are the same types
<ggole> nojb: in my case I'm trying to coerce an 'a value into an 'b value, given type equality of 'a and 'b
govg has quit [Ping timeout: 250 seconds]
<nojb> ggole: except that is not really a coercion right ? because if ‘a and ‘b are equivalent types then you can just use the value directly …
badkins has joined #ocaml
<ggole> Without a coercion? I don't understand how I'd do that.
<nojb> ggole: let me see if I can make it work in your code …
govg has joined #ocaml
<hcarty> companion_cube: smondet's pvem is actually exactly what I'm looking for, or close to it. So no need perhaps for something directly in containers.
<hcarty> Hooray for opam :-)
<companion_cube> ohhh
<companion_cube> it's compatible with CCError if 'bad = string
<companion_cube> hurray for polymorphic variants ;)
<hcarty> companion_cube: Indeed!
<Drup> the "With_deferred" is nice
<Drup> smondet: the link to implementation notes is dead
<companion_cube> with_deferred combines the future monad with the error monad?
<Drup> yes
<companion_cube> Drup: if you need it I can probably implement it
<Drup> I don't
<Drup> and if did, I would just use pvem
<Drup> I'm not dependency shy as you are
<Drup> I was looking for a much stronger word than "shy", but couldn't find one :/
<hcarty> Drup: averse
<Drup> averse is still too gentle for what I have in mind
<Drup> =')
govg has quit [Ping timeout: 245 seconds]
<johnelse> allergic? :)
<Drup> I mean, companion_cube is avoiding dependencies *between modules of the same library* while they are all small pure ocaml without side effects :|
<ggole> nojb: actually I think the coercion approach will work and be considerably more pleasant than the current mess. Instead of chaining various things through eq_assoc I can provide an 'a t -> 'b t -> ('a, 'b) Eq.t option for comparison and a cast : ('a, 'b) Eq.t -> 'a t -> 'b t for each type (which is trivial).
govg has joined #ocaml
<companion_cube> Drup: come on, next version of containers will have *two* dependencies!!
<companion_cube> cppo and bytes
<ggole> Then given the result of the comparison I can (hopefully) coerce whatever I need without further arsing about.
<companion_cube> that's like, a lot
<companion_cube> :D
<Drup> companion_cube: ಠ_ಠ
<companion_cube> "FAMILY OF PSYCHEDELIC DUCKLINGS" ?
* companion_cube trying to guess unicode chars
ingsoc has quit [Ping timeout: 265 seconds]
<Drup> you don't have the right font ?
<Drup> peh.
<nojb> ggole: right that dounds right
Asmadeus has quit [Ping timeout: 265 seconds]
<Drup> ggole: indeed, it seems much easier
<ggole> I'll do that then.
<companion_cube> not sure which font I should use...
<Drup> companion_cube: dejavu
<Drup> nice to the eyes, open source, handle a good part of unicode
Asmadeus has joined #ocaml
<Drup> and exist in monspace version
<Drup> mono*
ingsoc has joined #ocaml
sepp2k has joined #ocaml
<Drup> whitequark: do you thing you could provide "gadt_eq : 'a t -> 'b t -> ('a, 'b) Eq.t option" with ppx_deriving ?
<Drup> think* ~~
<companion_cube> deja vu sans mono, doesn't look better in this case
<Drup> hum, that's weird
<hcarty> companion_cube: "COCONUT WITH DRY ICE"
malc_ has joined #ocaml
<hcarty> Drup: Agreed regarding dejavu mono - it's a very nice font to work with
<companion_cube> i should try inconsolata again
<Drup> (your terminal is utf8 aware, right ?)
<companion_cube> of course
dav_ has quit [Remote host closed the connection]
dav has joined #ocaml
<Drup> companion_cube: regarding the result type, I think you should just use the more general version
jonludlam has quit [Ping timeout: 244 seconds]
shinnya has quit [Ping timeout: 244 seconds]
Hannibal_Smith has quit [Quit: Sto andando via]
bytbox has quit [Remote host closed the connection]
hhugo has joined #ocaml
<companion_cube> you think so? like, type ('a,'b) error = [`Ok of 'a | `Error of 'b] ?
<Drup> yes
<companion_cube> that should be more or less retrocompatible
<Drup> except for the various "polymorphic types in functors" and other "I put the error type in my signature
<companion_cube> well, no pb, some modules will just use a partially specialized version
<MercurialAlchemi> out of curiosity, what's the advantage of using a polymorphic type in this case, as opposed to a classic ADT?
<Drup> I wonder if we could put somewhere a general monad library
<companion_cube> MercurialAlchemi: intercompatibility
jonludlam has joined #ocaml
<Drup> MercurialAlchemi: mostly, it's satisfying companion_cube's anti-dependency neurosis :p
<MercurialAlchemi> ah, I see
<companion_cube> and by a side effect, made CCError usable with pven and bünzli's libraries
<MercurialAlchemi> I see how that's convenient
<Drup> it wouldn't be a problem if the ocaml community was less prone to NIH and more unified around a set of core simple types
<Drup> unfortunately ...
<MercurialAlchemi> Until you use `NuclearMissileLaunch in the wrong context
<MercurialAlchemi> oh, you mean, if we didn't have, what, 4 standard libraries?
<companion_cube> well we all wish ocaml had a single, good, standard library (and build system fwiw)
<companion_cube> but in the current state of things...
<companion_cube> MercurialAlchemi: yeah, exactly
<Drup> MercurialAlchemi: "4", so optimistic :D
<MercurialAlchemi> I think the problem is not so much the number, but rather that standard is more "standard"
<MercurialAlchemi> XKCD #927-style standard
<companion_cube> just imagine how awful things would be if 'a option would not be in stdlib
dav has quit [Remote host closed the connection]
<Drup> T__T
<Drup> I don't have to imagine, actually
<Drup> UChar.
<companion_cube> heh.
Guest85361 has joined #ocaml
<MercurialAlchemi> bah, didn't the world stop at ASCII anyway?
<Drup> MercurialAlchemi: (╯°□°)╯︵ ┻━┻
bobpoekert has joined #ocaml
<MercurialAlchemi> nobody needs more than 7 bits to represent characters
<MercurialAlchemi> :D
<Drup> does that answer you ? :D
<companion_cube> "DRUP THROWING HIS DESK ON COMPANION_CUBE"
<Drup> hey, for once, it was not on you !
<companion_cube> "DRUP THROWING HIS DESK AT WORLD"
<Drup> x)
<MercurialAlchemi> well, as somebody whose contact with Python 2.x has resulted in constant paranoia about encoding, working with strings in ocaml feels like running in a minefield
<Drup> so, I was saying
darkf has quit [Quit: Leaving]
<Drup> companion_cube: a small self contained library with all the various monad and other things like that signatures ?
<Drup> so that everybody can agree on, let's say, the shape of the fucking fmap function.
<Drup> (>>|) (>|=) (>|>)
<MercurialAlchemi> this sounds awfully like a standard
travisbrady has joined #ocaml
<Drup> MercurialAlchemi: I proudly proposed a name to companion_cube's last library, It's a structured Log library. It's called neperien. :D
<Drup> /me knows how to make MercurialAlchemi cringe.
* MercurialAlchemi raise his anti-pun shield too late
* MercurialAlchemi is logarithmically flattened
<Drup> success ! :D
<MercurialAlchemi> I'd have gone for 'logorrhea', myself
<Drup> oh, that one is good too !
serge has quit [Remote host closed the connection]
serge has joined #ocaml
<companion_cube> Drup: that's already too late for fmap
<MercurialAlchemi> more on topic, unless your suggestion is an encouragement to put the logging call at the wrong place
<companion_cube> lwt won't change, core won't change
<MercurialAlchemi> though it sounds a bit like gonorrhea
hhugo has quit [Quit: Leaving.]
yomimono has joined #ocaml
<MercurialAlchemi> companion_cube: maybe, but you could alias things...
<Drup> companion_cube: well, you don't really need to make them change, really, you just need to make them add a new operator that is an alias :O
Guest85361 has quit [Remote host closed the connection]
<companion_cube> erf
dav_ has joined #ocaml
<MercurialAlchemi> one operator to rule them all, and in the monad bind them
samrat has joined #ocaml
lordkryss has quit [Quit: Connection closed for inactivity]
nojb has quit [Quit: nojb]
emery has quit [Ping timeout: 250 seconds]
malc_ has quit [Ping timeout: 250 seconds]
koderok has joined #ocaml
<ggole> Wow, type equality is a subtle thing. :/
<ggole> Got it working though.
<Drup> nice :)
<Drup> (for both companion_cube and ggole :D)
emery has joined #ocaml
hightower4 has quit [Ping timeout: 250 seconds]
avsm1 has quit [Quit: Leaving.]
arj has quit [Quit: Leaving.]
<MercurialAlchemi> what does the +' do?
<Drup> variance
<ggole> Basically "make sure this can be polymorphic"
<MercurialAlchemi> aha
<Drup> huum, no.
<Drup> in fact, I'm quite surprised it's useful here
<Drup> MercurialAlchemi: you know the concept of variance or not ?
<MercurialAlchemi> yes
<Drup> ok, then + is covariance and - is contravariance
<MercurialAlchemi> I hadn't considered that you had that in OCaml before now, though
<Drup> it also happens that value restriction can be avoided when a type is covariant, for abstract types
<MercurialAlchemi> probably because I haven't touched polymorphic variants so far
dav_ has quit [Ping timeout: 255 seconds]
<ggole> Isn't that effect on typing polymorphism the primary reason for the feature?
<companion_cube> Drup: I'm not sure + is useful on the error type, but who knows?
dav_ has joined #ocaml
<Drup> ggole: no, the primary reason is subtyping :D
<Drup> you couldn't have subtyping without the variance things
* ggole mumbles something about subtyping going missing and nobody noticing
<ggole> Maybe you're right though.
<Drup> Let me disagree :d
<companion_cube> ggole: subtyping is actually useful with polymorphic variants
<flux> it's annoying when you have a place to use it, but then someone(TM) didn't note to put the + there
<flux> usually that someone(TM) is myself, so it's not a big problem ;)
badon_ has joined #ocaml
<Drup> ggole: in particular, without subtyping, tyxml and js_of_ocaml's API are basically impossible :)
<ggole> Mmm, ok
<flux> "I'll take your word for it, though I don't really believe it is the case" ;-)
badon has quit [Disconnected by services]
<Drup> =')
<ggole> It's more "I haven't used either of those
<ggole> With a bit of "every time I run into a subtyping problem I hate my life a little more" thrown in
<Drup> Work more on your variance-fu :D
badon_ is now known as badon
rand000 has joined #ocaml
<ggole> Gotta build up this gadt-fu a bit first
larhat1 has quit [Quit: Leaving.]
<Drup> unfortunatly, gadt and variance do not work happily with each other.
dav_ has quit [Remote host closed the connection]
govg has quit [Ping timeout: 264 seconds]
govg has joined #ocaml
ikaros has joined #ocaml
dav has joined #ocaml
manizzle has quit [Ping timeout: 255 seconds]
<Leonidas> what is the difference between these two functors: https://gist.github.com/1ad841cd0a7a79739610?
<Leonidas> with the one I get a B.id that is int -> int, with the other B.t -> B.t
malc_ has joined #ocaml
<Drup> Leonidas: in the second, you hide the implementation of t
<Drup> you make it abstract
slash^ has joined #ocaml
<Drup> (with ": I")
<ggole> The ascription : I restricts things to what is available in I
<Leonidas> ah, okay.
<Leonidas> so by leaving out the ": I" I can make it concrete. But how do I make the other, the functor (M: I)-variant abstract?
<ggole> Ascribe a signature
<Drup> (struct ... end : sig ... end)
<Drup> or, in this case, (struct .. end : I)
<ggole> You can also use "with t = ..." to keep the ascription, but allow the type to be visible
<ggole> module F (M: I): I with type t = M.t = struct ... end
<Leonidas> whoa, ocaml has a lot of syntax
<Leonidas> thanks, that worked.
<Leonidas> is there any preference which one to use? They seem to be equivalent, after all.
* Leonidas needs to play with this more to grok it properly
dsheets has quit [Ping timeout: 244 seconds]
<ggole> They aren't really the same (unless you meant the various places you can do ascription).
<Leonidas> are there more differences besides the places where I do the ascription?
<ggole> Well, I meant that the "with type" stuff isn't the same as not providing a signature.
<Leonidas> hmm, indeed
serge has quit [Remote host closed the connection]
serge has joined #ocaml
kdef has joined #ocaml
dav has quit [Ping timeout: 255 seconds]
dav has joined #ocaml
ollehar has quit [Ping timeout: 245 seconds]
dsheets has joined #ocaml
sheijk_ has joined #ocaml
WhoNeedszZz has joined #ocaml
<WhoNeedszZz> Hey guys
sheijk has quit [Ping timeout: 258 seconds]
<WhoNeedszZz> Trying to implement a basic exception for a missing input. I'm getting a syntax error on line 12. What is the issue? https://gist.github.com/anonymous/9bc021646f530005d5a1
<ggole> WhoNeedszZz: val is only for signatures, and that's the body of a .ml
<ggole> If this is intended to be a signature, make the file a .mli
<WhoNeedszZz> Sorry i'm new to OCaml so I'm not sure what you mean by that.
ygrek has joined #ocaml
<ggole> A signature is... I'll keep it simple, it's basically a bunch of type declarations. That is, not running code.
jprakash has joined #ocaml
<ggole> If you are writing function definitions and the like, then you can't use val - it's only valid in signatures.
<WhoNeedszZz> Ok. What's the proper way of declaring an exception?
<ggole> exception Foo
<ggole> ...with arguments, if you like
<pippijn> would be nice to have a type system powerful enough to express the actual effect of a function, so that the implementation is written in types, and the entire implementation becomes part of the signature
<WhoNeedszZz> Should that be in a separate file or in the file or part of an existing implementation?
<ggole> WhoNeedszZz: you can choose. If you keep it local to the file (and provide a signature), then it will be "hidden" and other people won't be able to catch it.
<Drup> pippijn: you mean, like dependent types ? :p
<ggole> If you want people to be able to catch, then you need to place it in the signature (if any)
<pippijn> Drup: yes :)
<WhoNeedszZz> Ok so i'm using ocamllex and menhir to write a lexer + parser. The exception is referred to by two of the files. So it should be in its own file?
<ggole> Finally, you can skip the .mli and everything in your file will be available (including any exception definitions).
<ggole> Not necessarily, if one of the files depends on the other its reasonable to put the definition there.
<Leonidas> how to get gprof/ocamlc to generate profiles which include timing information?
<Leonidas> I already built ocaml with frame-pointers, but it doesn't seem to track any times.
<WhoNeedszZz> I'm having a hard time finding a tutorial on how to handle exceptions
koderok has quit [Quit: koderok]
<Drup> Leonidas: gprof needs -p
<Drup> frame pointers is for perf
<Drup> (which is better)
struk_at_work has joined #ocaml
willy_ has joined #ocaml
wwilly has quit [Ping timeout: 265 seconds]
zpe has quit [Remote host closed the connection]
ygrek has quit [Ping timeout: 240 seconds]
koderok has joined #ocaml
nojb has joined #ocaml
<WhoNeedszZz> what's the form for setting a variable equal to a specific string?
koderok has quit [Quit: koderok]
<WhoNeedszZz> let tok = 'Foo' ?
<malc_> WhoNeedszZz: let tok = "Foo"?
manizzle has joined #ocaml
pyon has quit [Ping timeout: 264 seconds]
mcc has joined #ocaml
dav has quit [Ping timeout: 264 seconds]
jonludlam has quit [Ping timeout: 272 seconds]
<WhoNeedszZz> malc_: yeah thanks that was it. Brain fart haha
dav has joined #ocaml
AlexRussia has quit [Ping timeout: 256 seconds]
<WhoNeedszZz> Thanks for the help
WhoNeedszZz has quit [Quit: Page closed]
psy__ has joined #ocaml
jonludlam has joined #ocaml
dav has quit [Ping timeout: 255 seconds]
dav has joined #ocaml
<mcc> hellos, I am trying to think about how to do a thing
hausdorff has joined #ocaml
<mcc> i have an object like type value = | Null | FloatValue of float | StringValue of string. I want to have a dictionary or map or something that maps value -> value
<mcc> However Map.Make can store only "OrderedType"
zpe has joined #ocaml
<mcc> So I am trying to decide... my first thought was to have multiple maps, but it seems like a sensible way to do this would be to make value an OrderedType?
bytbox has joined #ocaml
nojb has quit [Quit: nojb]
<struk_at_work> mcc: if you are using ppx this is nice: https://github.com/whitequark/ppx_deriving#plugins-eq-and-ord
<mcc> Like, I'm assuming I could somehow define an orderedtype where like, all nulls are less than all floats, all floats are less than all strings, order within
<mcc> i'm soo using ppx
<mcc> so, um... i need to be honest
<mcc> whitequark has shown me ppx_deriving already
<mcc> i still do not understand what it does
<Drup> it looks at the type definition
<mcc> does it transform an existing type, or let me declare a new type, or let me declare a modification of a type I made?
<Drup> more precisely, the ast
<Drup> look at it very hard
<mcc> so hard
<Drup> and produce additional functions out of it.
<Drup> and that's pretty much all of it.
<Drup> it will not modify code, only produce new code
<Drup> and it works by looking at the syntax
dav has quit [Ping timeout: 244 seconds]
<mcc> ok
<mcc> sooo ord is a thing that would allow me to generate the "compare" that could upgrade my "value" type to an OrderedType?
dav has joined #ocaml
<Drup> yes
<struk_at_work> mcc, yeah all the ppx_deriving_* plugins do that
<ggole> Do you actually need the ordering to be meaningful? If not, you can probably just use Pervasives.compare
<struk_at_work> ggole: that's not ideal
<ggole> No, but it is easy.
travisbrady has quit [Quit: travisbrady]
<ggole> ...not to mention the intended use case of the stdlib.
<mcc> I am currently only interested in making it ordered for purposes of having access to Map
<mcc> if there is an alternative to Map that does not require ordering, I will use that instead
<struk_at_work> ggole: fair enough
<ggole> mcc: try module ValueMap = Map.Make (struct type t = value let compare = compare end);;
ikaros has quit [Quit: Ex-Chat]
<ggole> mcc: there's also Hashtbl, which is a mutable unordered table.
<mcc> oooo, that sounds... kinda more like what i need.
<mcc> cuz right now all my subtypes are inherently ordered but that won't be true later
malc_ has quit [Ping timeout: 264 seconds]
<ggole> Well, you can almost always make up a (meaningless) ordering easily
<ggole> So don't worry about that too much
<mcc> no, not necessarily-- this is a langauge interpreter, and at a later point i may want the keys to legally be user defined types
<mcc> and in that case, i cannot have an ordering unless i force the user to think of one
bezirg has quit [Ping timeout: 272 seconds]
koderok has joined #ocaml
bytbox has quit [Remote host closed the connection]
<ggole> Uh, I don't see how that follows. If the structures representing their types are well defined and have a reasonable (although meaningless) ordering, you're in business.
<mcc> well... i mean, think about java. in java you can have two unequal-in-memory-representation objects which are treated by a map as the same key
<mcc> because java maps only look at the object-relative hash() and equals() functions
<ggole> That problem would exist for a lexicographic comparison and a hash/equals operation alike, surely.
<mcc> if that is a feature i wish to support at some later point, then i'm boxing myself into a corner by using a map
<mcc> ggole: well-- yeah. so either i have to require them to implement an ord, or i have to require them to implement equals+hash
<ggole> So... they are going to be writing these things in OCaml?
<mcc> ggole: however, i'm expecting i'd prefer the latter, because it's possible (just... not smart) to implement hash as return 0, or based on internal object id or something
q66 has joined #ocaml
<Drup> mcc : wait, which user are you talking about ?
<mcc> This is... not really that important.
<Drup> aren't you working on your value types ?
<ggole> If they are defining things at the level of your language, and you are the level below that, then there's no problem
<Drup> the user of the language shouldn't see that
<ggole> The user would be providing data that would comprise the contents of a data structure, and you would be defining operations that operate over that data structure.
<ggole> Eg, the ordering is your concern and not your users'.
<mcc> so at the moment value is Null | Float | String, but very soon it will be something like Null | Float | String | UserDefinedObject. It is not necessarily the case that I will allow UserDefinedObject to be a key anytime remotely soon, but I might. The basic objects are maps that the language user can interact with.
<mcc> Because I'm providing something like a hash type as part of the core language, it's my job to implement that hash type, and i'll likely be doing it in ocaml
<Drup> how would the user defined the "UserDefinedObject" ?
<Drup> I mean, an object would be mostly a dictionnary ? then it's perfectly hashable and comparable.
<pippijn> does ocsigen support streaming services?
<pippijn> non-blocking for other clients
<Drup> hum, not with services
<Drup> but you have that for comet and this kind of things
<pippijn> I'm thinking of music streaming
hugomg has joined #ocaml
<mcc> So yes, an user object is fundamentally a dictionary. But I am implementing an object-oriented language where certain language-level behaviors can be overridden by user functions implemented inside the object, like equality.
<Drup> mcc: optional field with the equality ? :)
AlexRussia has joined #ocaml
<pippijn> what about large file downloads?
<Drup> mcc: anyway, you are confusing two things
<ggole> So you need ordering to operate over user functions: that's not the same thing as ordering being *provided* by the user, though
<mcc> Maybe say if you don't have a .eq field in your object , then there is a default traverse-all-data-members equality, but you could put a function in that field that tests two objects
<Drup> the equality used by ocaml
<Drup> and the equality used by the language
<Drup> it's not exactly the same thing
<mcc> It seems to me that if i have two inside-emily objects a and b, and a.eq(b) is true, then "a" and "b" should be treated as equivalent keys by the language-provided dictionary type.
<Drup> the equality used by the language is part of the execution of the interpreter
oriba has joined #ocaml
<ggole> mcc: ah, I see. Using an ordered table on the OCaml side to provide an unordered table to the Emily side would be a bit strange.
<mcc> I'm not sure really where that... comes in. From my perspective this is just that, if I implement the language-provided dictionary type (at the ocaml layer because that's where i'm working) in such a way that something can only be used as a key if it is fundamentally orderable, then if later i decide i want to let my language's user overload the notion of "key equality" for their own defined types, that will require me to rewrite t
<mcc> he underlying implementation of the dictionary type I expose to my language's user.
Arsenik has joined #ocaml
jwatzman|work has joined #ocaml
<mcc> ggole: i'm ok with strange as long as it works ^_^
<Drup> but .. you shouldn't expose this to the language user ...
<mcc> shouldn't expose *what*?
<Drup> anything x)
<Drup> the fact that you are hashing the objects, for example.
<mcc> the underlying implementation should not be exposed to the user, however, there are certain kinds of functionality i do want to expose.
jonludlam has quit [Ping timeout: 244 seconds]
tg has quit [Ping timeout: 245 seconds]
<mcc> okay. do you agree that if i use user-defined types as keys, and i want key-equivalence to be based on "== and not ===" to use PHP terminology, then I must require the user to implement *either* a .ord *or* a .hash+.eq for her types?
<mcc> i mean-- this is not necessarily important right now, because it deals with a feature which is kind of far in the future and maybe on the other side of at least one total rewrite.
<mcc> but if HashTbl and Map are equivalent in all other respects, then it might be enough to make me lean toward HashTbl
<ggole> You can provide custom equality/ordering for either Hashtbl or Map
<mcc> Which raises the question of whether Map has any advantages over HashTbl?
<mcc> ggole: You mean, I can provide custom equality/ordering regardless of which I use in the underlying implementation?
<Drup> (if I may, mcc, you are over engineering much more than even I would :D)
<mcc> drup: this is all speculative.
tg has joined #ocaml
<Drup> anyway, any ocaml object is comparable with Pervasive.compare
<mcc> thanks.
<Drup> as much as any object is hashable with Hashtbl.hash
<ggole> I mean that both data structures allow the custom discriminators that you're asking for
<ggole> As for advantages, well, they are quite different.
<ggole> Map is ordered and immutable
<Drup> it's just that, as opposed to Map, Hashtbl use the default hash by default
<Drup> while Map always ask for a comparaison function.
<mcc> Assume I understand the general differences between an ordered map and a hash table.
yomimono has quit [Ping timeout: 265 seconds]
<mcc> and that ultimately that map is going to be marked mutable in whatever record it's kept in.
<Drup> if you want mutability, don't use a map
<mcc> I'm more curious if there's anything i should know about how ocaml treats those types, i.e., is hashtbl inefficient. Sounds like no.
<Drup> Hashtbl is not inefficient
<mcc> 'k
<Drup> hum
<Drup> now that I think about it
<ggole> It's a pretty straightforward chaining table
<Drup> why do you even need the values as keys ?
<ggole> Old mappings are kept, which can be nice
<Drup> mcc: I mean, Map is parameterized by the keys, which should be internal names, for most use cases I can think of.
<Drup> so, basically ids, aka ints.
<ggole> I think mcc is thinking of an Emily-level map, eg, from EmilyValue.t => EmilyValue.t
<rom1504> Drup: that's not more efficent than using "values"
<ggole> Like objects in javascript or something
<rom1504> you are basically going to need to redo the whole thing again when you look for the right id (the same thing that happens in map)
<Drup> redo the whole thing ?
<mcc> drup: again, unless i wish to offer to the user a feature where two implementation-nonequal objects are key-equal. which at present i don't, but...
<rom1504> Drup: for example build an AVL tree
<Drup> mcc: no, even in this case
<rom1504> (you need to find the id efficiently)
<mcc> among other things, because currently i have neither a user-accessible dictionary type or a user. i have a parser :P
<Drup> rom1504: yes, that's a map, and ?
<rom1504> no you don't get it
<rom1504> if you use id as keys, then you need to have a function to transform key to id
<rom1504> efficiently
<mcc> Drup: I'm... *really* not sure it matters. But the alternate methods you have given me is hash/ord on "unique object id", or hash/ord on memory representation.
<rom1504> a way for that is AVL tree
<Drup> keys and id are equal and are ints :p
<rom1504> ....
<Drup> yeah, I don't think I get your point :)
<rom1504> what's the point of ids ?
<rom1504> of ints ids I mean ?
<Drup> easy to generate and to make them unique
<ggole> To reify identity (which isn't otherwise available in ocaml)
<rom1504> but users never know ids
<Drup> indeed
<ggole> If you have a (mutable) object, and change the parts, a structurally based thing will lose
<ggole> So you make up a unique int, stick in in the object, and use that
<mcc> Again it depends on whether we're talking about "== or ==="
<rom1504> well if you don't need a map, use an array ?
<ggole> (In C you would use the address, but that doesn't work with relocation unless there is special support, which in OCaml there is not.)
<Drup> mcc: I think you are again confusing the equality in the host language and the defined language :]
<rom1504> I mean if you have int id, and that's all you are ever going to use, just use an array
<rom1504> well actually map work for id too
<Drup> rom1504: an Hashtbl of ints is a backtrackable sparse array.
<rom1504> *int
<Drup> indeed.
<ggole> Only suitable for dense tables
<ggole> But great for those, of course.
<rom1504> yeah but if you decide the values of ids, it's not sparse
<Drup> huum, no, it depends a lot.
<mcc> No, I don't think I am, I think there are three equally reasonable ways for the language to define the behavior of a map with regard to keys of user-defined type, and we are equivocating between the three :P
<ggole> If you have 10 million Foo.t, and you want a table mapping three Foo.t to something by identity, do you want an array of length 10 million?
<Drup> mcc: what would you use your tables for ?
<rom1504> whatever, anyway there are lot of cases when you need to have other-stuff-than-int keys
<Drup> rom1504: obviously
<rom1504> for example strings, but not only that
<Drup> rom1504: we are talking about an interpreter here, though
<ggole> No, you use a sparse table keyed by an int in the Foo.t
<rom1504> right, ok I got there in the middle of the discussion
sepp2k has quit [Quit: Konversation terminated!]
pyon has joined #ocaml
<Drup> and in an interpreter, you have a set of bindings, that's it an association id -> value of the language, and the ids are probably ints :]
<rom1504> oh yeah ok, sure
<Drup> (hopefully hidden behind a nice abstraction)
jprakash has quit [Ping timeout: 264 seconds]
<Drup> mcc: I'm still curious about what the table would be used for :p
<mcc> has anyone used this ocaml-containers library? it implements a CCHashTable and a CCFlatHashTable and doesn't seem to indicate what the difference is against plain Hashtable.
<mcc> ...wait.
<mcc> "Hashtbl.add tbl x y adds a binding of x to y in table tbl. Previous bindings for x are not removed, but simply hidden. That is, after performing Hashtbl.remove tbl x, the previous binding for x, if any, is restored."
tane has joined #ocaml
<mcc> is that... a thing people actually want
<Drup> yes.
<mcc> okay
<Drup> mcc: the very good part of containers
<Drup> shared with ppx_deriving
<ggole> There's usually a replace operation if you don't want that
<Drup> is that you can yell on the maintaner on irc.
<mcc> ggole: i see, but thanks
<Drup> /me points at companion_cube.
<mcc> drup: … … … okay that sounds appearling…
<mcc> … possibly less appealing from companion_cube's perspective…
<Drup> :p
<Drup> well, you can praise him too!
Kakadu has quit [Ping timeout: 246 seconds]
<ggole> mcc: a possible use case: mapping identifier to variable in a compiler. When you reach the end of a scope, you remove what was introduced and the old bindings are still there.
<mcc> Okay, that makes sense
<Drup> I would probably rather use map for that.
<Drup> mcc: anyway, you should rather use CCHashtbl
<Drup> it's compatible with the stdlib
<Drup> unless you have special needs, it will be enough
<mcc> if it is compatile with the stdlib that seems to suggest i could start with the stdlib and then upgrade later
<Drup> as you wish, it doesn't really matter
malc_ has joined #ocaml
<mcc> thank you for the advice
<Drup> (actually, I would use CCHashtbl directly, because get returns an option, instead of raising an exception)
dav has quit [Ping timeout: 255 seconds]
psy__ has quit [Quit: Leaving]
<Drup> having to catch the exception all the type is annoying.
<Drup> time*
dav has joined #ocaml
hugomg has quit [Ping timeout: 244 seconds]
hugomg has joined #ocaml
hausdorff has quit [Remote host closed the connection]
Hannibal_Smith has joined #ocaml
hugomg has quit [Ping timeout: 244 seconds]
hugomg has joined #ocaml
<Unhammer> these ocsigen tutorials are fun :)
<Unhammer> (though a bit annoying that all the <title>'s are "tuto" when I have 5 tabs open)
koderok has left #ocaml [#ocaml]
<Drup> this is a known issue of ocsimore, the wiki we are using :(
<Drup> happy to see you are enjoying the tutorials :)
<mcc> drup: oooooh that's very important to know
<Drup> the option vs exception ? yes
<Drup> that's one of the annoying feature of the stdlib, it uses exceptions for this things. containers replaces these by options.
<struk_at_work> Drup: containers sound nice, looking forward to trying them out
<Drup> /me never not doing companion_cube's PR.
<mcc> drup: any idea what the difference is in containers between hashtable and flathashtable
<Drup> none whatsoever.
<mcc> great
axiles has quit [Quit: Quitte]
<ggole> It's an implementation detail afaik
jprakash_ has joined #ocaml
jprakash_ has quit [Client Quit]
<companion_cube> CCFlathasthtbl is more an experimental thing, actually
<companion_cube> it's a different implementation (so I can have access to the internals and, for instance, provide iterators)
jprakash has joined #ocaml
<companion_cube> it's an open addressing table, but it's not that easy to beat the standard table's performance for now
<companion_cube> it's probably better to use CCHashtbl which is compatible with the standard hashtable
<ggole> Open addressed tables are best when you can set aside some bits to indicate tombstones and empty values
<ggole> Hard to do that polymorphically
<ggole> (Without introducing performance-leaching indirection, anyway.)
<companion_cube> yeah, I'd love to be able to specify a flat memory layout
malc_ has quit [Quit: leaving]
<ggole> I have a C implementation of int tables that does this by keeping the mark indices (0 and 1) in a little lookaside array
<ggole> And it outperforms the C++ stdlib hash table nicely
<ggole> Specialisation ftw
<companion_cube> heh.
<companion_cube> I think it will work very nicely in rust
hausdorff has joined #ocaml
Kakadu has joined #ocaml
avsm1 has joined #ocaml
avsm1 has quit [Client Quit]
hausdorff has quit [Ping timeout: 255 seconds]
bytbox has joined #ocaml
avsm has joined #ocaml
travisbrady has joined #ocaml
dav has quit [Ping timeout: 244 seconds]
jprakash has quit [Ping timeout: 272 seconds]
Kakadu has quit [Quit: Konversation terminated!]
<ousado> ggole: the C++0x hashtable?
<ousado> or C++11, rather
<ggole> std::unordered_map, yeah
<mcc> type value = Null | Function of value->value;; (* I am so sorry to keep asking these elementary questions, but what am I doing wrong here, it says the -> is a syntax error
<ggole> Of course unordered_map isn't poorly implemented, but cobbled by its interface: elements have their addresses exposed and the semantics require those addresses to be stable
<ggole> So there is no option other than a chaining table with individually allocated nodes
<ggole> No real achievement beating that.
<ggole> (Stable addresses are useful, too, so it isn't *necessarily* a poor idea.)
<Drup> mcc: add parentheses :)
<ousado> I see, interesting
<mcc> bah! i thought i'd tried that. thanks
dav has joined #ocaml
<Drup> /me apply lisp on mcc's syntax issues.
<Drup> everything is solved with more parentheses.
hugomg has quit [Ping timeout: 244 seconds]
<mcc> so the old hash_map used an explicit hash function rather than addresses, is unordered_map different? or are you talking about storing pointers in an unordered_map
<ggole> I mean that unordered_map pretty much has to use chaining to meet the semantics chosen for it by the standard.
<mcc> *oh*, i see
<mcc> interesting
<ggole> If you tried to use open addressing, when you relocated the table to grow it all the addresses of elements would change.
<ggole> unordered_map guarantees this does not happen, precluding this implementation.
sheijk_ has quit [Ping timeout: 264 seconds]
<mcc> Yeah, i misinterpreted what you meant by exposed addresses. That's interesting.
bytbox has quit [Remote host closed the connection]
<ggole> std::map and set have the same "problem"
<companion_cube> ggole: oh, interesting
<companion_cube> is it a matter of avoiding iterator invalidation?
<Unhammer> ggole, does your fast hashtable have an ocaml interface? ;)
<ggole> Not just iterators, but the address of elements
<companion_cube> hmm, when the table owns the elements?
<companion_cube> sounds like a pretty dangerous design, but I see the point
<ggole> Well, in C++ that's always.
rand000 has quit [Quit: leaving]
<ggole> Unhammer: no, it's just an experiment really
<ggole> I don't think you could store caml values in it anyway.
thomasga has joined #ocaml
<ggole> I could port it to OCaml, I suppose
<Unhammer> (my first attempt at porting some pypy to ocaml ended up performing about the same, with the bottleneck seemingly in the int→int hashtbl; though I did get 1/2 mem usage which is nice.)
<ggole> Mmm, an int specialised table could be an interesting project
<companion_cube> Hashtbl.Make(Int) is pretty ok
hausdorff has joined #ocaml
avsm has quit [Quit: Leaving.]
hugomg has joined #ocaml
<mcc> silly question, Hashtbl.Make x or CCHashtbl.Make x create a map of x keys to x values, right? What if i want the value and key types to be different?
<mcc> I don't need this rn i'm just curious
<mcc> i'm also surprised i think it just let me use a function value as a key
<ggole> They create an 'a Table.t, eg, you can choose the type of values.
<companion_cube> it's still polymorphic in the values, because you don't have to know anything about the values in a hash table
<mcc> huh, ok
samuel02 has quit []
<Drup> mcc: for both Map and Hashtbl functors, it's only for the keys
<Drup> you can put whatever values in it.
<Unhammer> yeah, did get a slight speedup with .Make
dav has quit [Ping timeout: 265 seconds]
<mcc> Oh, because "Make" creates a module with a specified key type, and then "create" creates a single instance of a map with specified value type.
<Drup> yes
<ggole> mcc: yep (although the value type will usually be inferred, you don't have to spell it out).
<mcc> 'k
<mcc> so... here's something that seems like it ought to be doable. http://pastie.org/9712522
<mcc> but i'm not sure how to express it. it says the "of valueMap.t" or something near it is outright a syntax error.
<mcc> and it seems like i can't write it like that anyway, because valueMap.t only gives it enough information to tell what "the key type" is.
<mcc> and valueMap is... .... is a "first-class module"? is that right? but in order for it to use "value" as a concrete type it would have to know both the type i passed to CCHashtbl.make and the type that i passed to MapValue.create
<Drup> yeah, ok, so
<Drup> it's technically possible, but believe me, you don't want to do that.
<ggole> The "and" means that another type definition should follow
<mcc> (Also: ocaml-containers has no docs aside from the README and the MLIs, right?)
<companion_cube> there's the ocamldoc on the web, but it's just extracted from the .mli
<mcc> thanks
<ggole> If you want to define a module, you have to use the module keyword: module Tbl = CCHashtbl.Make (Arg)
<mcc> ggole: yeah! but... it does seem like this is a case where you'd *want* a functored-module and a type to be mutually recursive?
<ggole> Well, no: the functor takes the thing as argument rather than referring to it directly.
<Drup> the issue is that it's a pandora box, from the type inference point of view.
<struk_at_work> companion_cube: multimaps? I'm sold
<companion_cube> mcc: that is painful
<companion_cube> struk_at_work: :D
<companion_cube> be careful that multimaps require comparison of both keys and values, though
<mcc> okay
<struk_at_work> companion_cube: so its a tree set of values basically?
<mcc> so the top-level thing i want to do is i want to have a hashtable, and one of the things i want to be able to do is store a reference to another hashtable in it
<mcc> at the high level it seems like that is not an unusual thing to want?
<mcc> like if instead i said "| ListValue of value list" then it has no problem with that at all
slash^ has quit [Read error: Connection reset by peer]
<mcc> so it seems like there must be *some* way to express that with functored / user-defined types also…?
<companion_cube> struk_at_work: it's Map (key, Map (value, arity))
<Drup> mcc: there is something
<companion_cube> so yes
<Drup> give me a sec.
<companion_cube> oh, wait, confusion with MultiSet, you're right
<companion_cube> Map (key, Set value)
<companion_cube> anyway, in both case it's the same requirement
<ggole> mcc: something like type foo = Int of int | Tbl of (int, foo) Hashtbl.t?
<ggole> Only with the table type the result of a functor.
<companion_cube> mcc: you can do it with recursive modules
<companion_cube> ugly, but it should work
seggy has quit [Ping timeout: 264 seconds]
<Drup> companion_cube: that's what I'm doing
<companion_cube> I'm not totally sure, but you might do it too with type 'a foo = Int of int | Tbl of 'a
<companion_cube> and then specialize 'a only in the functor application
<companion_cube> but I'm not sure
<Drup> I think you would also need a recursive module to tight the knot :/
<Drup> tie* :>
<Drup> so
<Drup> it works.
<Drup> but you should avoid it :]
<struk_at_work> companion_cube: thanks, got it. the lazy trees also look cool but not sure If I have a good use case for them any time soon :)
<mcc> ...okay...
<companion_cube> Drup: possibly :(
<Drup> mcc: we agree that you want a table from value -> value
<mcc> so first off, why should i avoid it
<Drup> ?
<mcc> i agree it is unattractive
<companion_cube> struk_at_work: oh, that's mostly a lightweight way of printing trees
<companion_cube> if you're interested in trees there's funnier stuff in containers.misc (printBox and the likes)
<mcc> second off, if this is bad, then is there a superior way to get the same high-level effect?
<Drup> there is no superior way in OCaml, afaik
<mcc> this seems odd. so like again, i can like... make my MapValue of (t*t) list
<Drup> the issue is that you use a specialize datastructure
<mcc> sorry i mean make like a type value = Null | MapValue of (t*t) list, and then i could implement a couple of accessor functions to write a dreadful dictionary class that works by linear scan...
<Drup> I mean, you could write (t*t) Hashtbl.t
<Drup> it would work just fine
<mcc> oh! well
oriba has quit [Quit: Verlassend]
<mcc> … okay, well why not just do that then ? i'm not 100% sure how to interpret what you just wrote there unfortunately
<Drup> mcc: the issue is that 1) recursive modules are impossible to infer 2) when you do a functor the runtime manipulate function pointers to make them point to the right things
<companion_cube> it's a relatively common problem when you want to define a type with one case that contains a set of values of this same type
<Drup> imagine you want to define the equality over value
<Drup> you need the equality over hash tables of values
<mcc> i'm also still, um... i have been staring at this line in the MLI for about the last half hour not sure how to intepret it: val keys : ('a,'b) Hashtbl.t -> 'a sequence
<companion_cube> what's the matter? :D
<mcc> companion_cube: the matter is i have been writing objective caml for slightly over one week, and there are so many syntax variants i'm having a lot of trouble looking new quirks up in the documentation * _ *
<mcc> ...and i have no idea what the ('a','b') means there
<companion_cube> oh k
<mcc> ^_^
<companion_cube> it's just two type parameters
<ggole> Those are the type arguments
<companion_cube> it's ('a, 'b) hashtbl
<mcc> drup: so you're saying using a hashtable as a hashtable is kind of terrible. i agree
<companion_cube> a hash table from 'a to 'b
<ggole> OCaml puts them on the left because of reasons.
<Drup> ggole: I would even say, ML reasons.
<ggole> Don't get me started on application syntaxes again :)
<mcc> ok. why is it you say ('a', 'b') hashtbl there, and drup said (t*t) hashtbl a moment ago
<companion_cube> ggole: indeed
BitPuffin has quit [Read error: Connection reset by peer]
<mcc> if this is a type specification, then saying 'a*'b would make more sense to me
<Drup> mcc: because I, unfortunatly, don't have a typechecker hardwired in my brain. :D
<ggole> mcc: the * is just a mistake
<mcc> oh, ok
<ggole> The ' indicates a type variable
<Drup> that would be convenient, though
* companion_cube casts Drup's brain into a x86_64 CPU
<Drup> mcc: also, I think representing functions as functions is not a good idea.
<mcc> uh, question stands tho. i thought a*b was how you say "the type of a tuple of these two values", but here you are seeming to describe an actual tuple a,b
<mcc> Drup: That's for builtins.
<Drup> oh, ok.
<mcc> There'll be a different type for user functions
badkins has quit [Remote host closed the connection]
<Drup> (you should call it "Primive" then, or something like that :p)
* reynir puts some wires into Drup's brain
<ggole> mcc: constructing a tuple and naming a tuple type look a bit different
<mcc> Yes, that's a good point
<ggole> a, b is a tuple: a * b is a tuple type
claudiuc has joined #ocaml
<Drup> also (a,b) or only for type arguments
<ggole> So a, b isn't a tuple at the type level
<Drup> are only*
<mcc> ggole: yeah. i guess what i'm asking is why it is that i am putting a tuple value, and not a tuple type, into this type declaration. it looks as if (t1, t2) is like a value which you are passing into Hashtbl.t and treating it as some sort of argument to some sort of [something]
<ggole> It looks that way, yes. But they are only arguments.
seggy has joined #ocaml
<ggole> So a function application is f a b, and a type constructor application is (a, b) f
<ggole> :(
<Drup> mcc: I don't think you will find anyone who thing the syntax for type application in (OCa)ML is a good idea.
<Drup> think*
<reynir> so I recently discovered multiline strings in OCaml. How does it handle whitespace? For example when indenting
<Drup> so hum, yes, it's bad and confusing é_è
<mcc> ok! i don't need a justification. i just need to know whether i understand it correctly * _ *
<companion_cube> ggole: and a constructor is F (a,b)
<mcc> like, if f is a type, could i also say a*b f
Kakadu has joined #ocaml
<mcc> and that would just... mean something different?
<ggole> Yes, yes, four application syntaxes -_-
<mcc> or is it just, no, in this context you use commas
<Drup> mcc "a*b f" or "(a*b) f" ?
<Drup> /me throws confusion-fu at mcc.
<ggole> mcc: you could say that (with some parens), and it would mean passing the tuple type a * b
<mcc> drup: i... think the second
<mcc> ok!
<ggole> Eg, (string * int) list
<ggole> Is the type of values like ["foo", 1]
dav_ has joined #ocaml
<Drup> "string * int list" on the other hand, is something like that : ("foo",[ 1;2])
<ggole> But (string, int) Hashtbl.t is the type of tables mapping "foo" => 1
<reynir> ah, it does ignore identation http://caml.inria.fr/pub/docs/manual-ocaml/lex.html#sec69
<mcc> one more question. so if when i say (Keytype, Valuetype) CCHashTbl.t ... i am passing the "argument" of KeyType, Valuetype to a "type constructor", it sounds like you're saying
govg has quit [Remote host closed the connection]
<reynir> sorry, I should have looked it up there in the first place
<mcc> … what, exactly, am i passing it *to*? if i am looking at CCHashtbl.mli on github right now. where can i find the function or functionlike-whatever that receives that "argument"?
<companion_cube> it's not really giving an argument
larhat has joined #ocaml
<companion_cube> it's just using an instance of the type ('a, 'b) hashtbl
<companion_cube> (where 'a and 'b are type variables)
sheijk has joined #ocaml
manud has joined #ocaml
<companion_cube> mcc: also note that CCHashtbl is designed to *complement* Hashtbl (the standard module)
<companion_cube> hence you're probably looking for Hashtbl.create
<mcc> … *oh*
<ggole> mcc: "type constructor" is pretty simply something that constructs a type, eg, when you define type t = Foo, you are defining the nullary type constructor t
<companion_cube> mcc: :D
<ggole> (Nullary meaning "no arguments")
samrat has quit [Quit: Computer has gone to sleep.]
<mcc> i saw that in the docs and then was confused "wait but this looks like it has new types in it" * _ *
<companion_cube> heh
<ggole> mcc: sorry for the jargon -_-
<companion_cube> CCHashtbl functions work on (Hashtbl.t values
<companion_cube> ('a,'b) Hashtbl.t values*
<mcc> so i think the reason i'm poking at this is... i want to be able to open an MLI and predict how to use the type defined therein. *if* CCHashtbl had been a replacement for Hashtbl rather than a set of complimentary functions... there would have been a line near up top saying "type ('a,'b') t"?
<ggole> Yeah.
<Drup> yes
<mcc> Cool.
<mcc> …uh. ONE more question.
<mcc> poking around, i see CCFQueue.mli begins with "type +'a t"
<mcc> … … … plus?
<Drup> mcc: do you know what variance is ?
<companion_cube> mcc: you can safely ignore the + for now
<Drup> yes, I think it's a good idea :D
<mcc> haha ok
<mcc> google tells me variance refers to type covariance/contravariance and the answer is: ok, i'm aware, and you are right i don't want to think about that right now
<mcc> ok thank you all so much for the help! i expect it will be at least twenty minutes before i get stuck again, now
<companion_cube> good luck ^^
<companion_cube> (if you're willing to improve tooling, I'd suggest using merlin and utop, btw)
<mcc> i'm using utop, and i'm interested very much in merlin but i have a set of weird software limitations around my computer being very old and this, uh *cough* preventing me from running sublime text 3.
jprakash has joined #ocaml
<mcc> so, uh, i'll check out merlin in about a month when i get my new laptop * _ * which i really hope i follow through on.
<companion_cube> hmm I see
<companion_cube> if only you'd use vm or emacs ;)
<Drup> ^
<mcc> wait, merlin supports vim?
<companion_cube> sure
<mcc> …okay, i'll think abou tit
<mcc> do you know if anyone has made an effort to integrate merlin with "Atom"?
ggole has quit []
<Drup> No, and tbh, I thinnk it would be a waste of time
sheijk has quit [Ping timeout: 272 seconds]
<mcc> ok.
<Drup> I can't imagine why anyone would ever want to use Atom except for the hype :>
<Drup> it's strictly inferior to all the other options.
<mcc> What I want is open source sublime text.
<Drup> that's a sad reason x)
<mcc> put a different way: i want to be able to create language tools (for the language i am going to attempt to write) and i would like them to integrate well with a gui editor.
<mcc> and writing a bunch of sublime extensions that then people cannot use without paying sixty dollars or whatever to someone who is not me sounds frustrating.
<Drup> and writing elisp or vim scripts is infuriating.
<companion_cube> I'm pretty willing to believe that sublime text is more intuitive than vim or emacs
<companion_cube> Drup: you can script vim in python now
<companion_cube> but still
<Drup> companion_cube: still infuriating :<
sheijk has joined #ocaml
<companion_cube> oh, you'd wish ocaml?
<Drup> obviously.
<mcc> I'm not sure i intend to really be targeting the kinds of users who are satisfied using vim/emacs.
<mcc> In particular, at SOME point i want to make something that can be used by windows users :P
<companion_cube> merlin shows it is somehow possible
<companion_cube> mcc: I understand, yes
<Drup> mcc: I see your point. what is your target audience ? game scripting ?
<mcc> game scripting, yeah
dav_ has quit [Ping timeout: 240 seconds]
<Drup> Because, personally, if someone tells me "You can use my language only in an editor that runs only in a browser and is powered by the most crappy technology stack ever"
<mcc> my starting point for this project is "i wish Lua had these two extra features"
<Drup> I'm not sure what my reaction would be :D
<companion_cube> mcc: compile ocaml to lua :>
<mcc> i'm definitely highly alarmed by atom's architecture choices.
<mcc> companion_cube: i'd… consider it.
<Drup> that would be great !
<mcc> companion_cube: however, one of my two features i want is "c++ interop" :(
<companion_cube> I was half-kidding, but well
<mcc> you can already compile ocaml to js, right?
<companion_cube> yes
<Drup> yes
<mcc> i think there are some js-in-process platforms that will allow you analagous c interop to lua
<companion_cube> and I won't name which standard libraries do work with js_of_ocaml :>
<Drup> companion_cube: I did it already.
<Drup> at least several time this week.
<companion_cube> :>
<Drup> mcc: but ok, I understand your position
sheijk_ has joined #ocaml
hausdorff has quit [Remote host closed the connection]
sheijk has quit [Ping timeout: 255 seconds]
<mcc> also, frankly, i'd … i dunno if this is weird, but i don't really like using vim for code dev. i did it for a while, i went back to GUI IDEs.
<mcc> i'm happy bopping around in configuration files or doing a small fix to one source file or whatever but it just never really felt nice working on larger programs
bezirg has joined #ocaml
<hcarty> companion_cube: Thank you for the CCError update
<mcc> so here's a question. Merlin seems to have somehow pulled a thing of being 1 system (?) that works with at least three major editors
<Drup> I was going to say "use the same approach than merlin"
<mcc> does this just mean everyone likes merlin so much they all wanted to write bridges, or did merlin make some specific design decision that made it really easy to add support for new editors
<companion_cube> hcarty: not released yet
<companion_cube> this week, I think
<Drup> basically, merlin is a small server
<Drup> and you write client for each editor to communicate with it.
<mcc> mm
<mcc> how's it interact with the outside world?
<Drup> the client being mostly "gives me (some part) of this source file and what has been modified
<mcc> like, sockets or what
<Drup> I don't know the details
<Drup> some authors hang there, you can ask them
<mcc> ok! you mean hang here?
<Drup> yes :p
<hcarty> companion_cube: Bah, releases.
<Drup> there are lots of cool things to do with editors and statically checked languages
<Drup> especially when you have rich types
sheijk_ has quit [Ping timeout: 265 seconds]
hausdorff has joined #ocaml
<MercurialAlchemi> merlin + vim is mostly enough
<MercurialAlchemi> I'd like to see a bit more warnings, I guess (like 'unused variable' or 'useless open')
<mcc> does merlin in emacs do those things, then?
<Drup> MercurialAlchemi: you can add them
<Drup> mcc: it does the same in both
<MercurialAlchemi> Drup: how?
<Drup> in merlin or in the compiler ?
<mcc> 'k
<MercurialAlchemi> merlin
<Drup> Oh.
<mcc> so, uh... my understanding is, if I want to use the CCHashtbl functions with (key, value) Hashtbl.t, i need to say something like: module cc = CCHashtbl.Make key
<Drup> they can't handle "unused" things, by construction
<mcc> i'm having... two weird probelms. one, it says beginning a line with "module cc =" is a syntax error, although i have done this in other places?
Submarine has joined #ocaml
<MercurialAlchemi> who's 'they'?
<Drup> the guys who do merlin :D
<Drup> MercurialAlchemi: but, it would be annoying to have the unused warnings in the middle of typing, I think it's for the best
<mcc> err.. wait, no.
<Drup> mcc: Modules start with a capital letters
<Drup> -s
<MercurialAlchemi> last time I could have used something like this, I had a function taking a foo and a bar of the same type... and I was obviously comparing foo to itself instead of foo to bar
<mcc> ahh.
<MercurialAlchemi> having the list of call sites for a given function would be useful in large projects
dav_ has joined #ocaml
<Drup> there is a function in merlin doing that, but it's not (yet) cross-file
<MercurialAlchemi> ah, that kind of limits its usefulness
<MercurialAlchemi> for the most part, Merlin could be subtitled "the IDE experience: the good parts"
<Drup> in a library.
<mcc> ...okay. so. i try this in utop:
<mcc> module M = Hashtbl.Make(Int);;
<mcc> it says: Error: Unbound module Int
<Drup> CCInt ;)
<Drup> no module Int in the stdlib, unfortunatly
ivan\ has quit [Read error: Connection reset by peer]
<mcc> utop # module M = Hashtbl.Make(CCInt);; \n Error: Unbound module CCInt
ivan\ has joined #ocaml
<Drup> you need to load containers, obviously :)
_andre has quit [Quit: leaving]
bytbox has joined #ocaml
<mcc> so um. utop # #load "containers";; \n Cannot find file containers.
<Drup> it's require
dav_ has quit [Ping timeout: 250 seconds]
<mcc> ok.
dav_ has joined #ocaml
artagnon has joined #ocaml
Denommus has quit [Quit: ZNC - http://znc.in]
<artagnon> whitequark: When I try more than one function with get_pointer_to_global, I get the result of the first function as the result of the second function too.
<artagnon> Something weird is going on, because I dumped the value of f before passing it to gtpg, and it's fine.
<artagnon> How is the second gtpg call matching the same function as the first call?
hugomg has quit [Ping timeout: 244 seconds]
<mcc> ...okay. i'm confusing myself again. I have this awareness I can say module IntHash = Hashtbl.Make( CCInt );; . However, I'm also realizing I can just say, like... let x = Hashtbl.create(1);; Hashtbl.replace x 1 3; ... and it just figures out Hashtbl is a map of ints to ints.
<mcc> ..... what, exactly, is the use of making that specialized Hashtbl.Make or CCHashtbl.Make module?
hsuh has quit [Ping timeout: 244 seconds]
hsuh has joined #ocaml
<Drup> it's to give a custom equality and hash function
<Drup> otherwise, it will just use the default ones
<mcc> Oh. … … so i just spent an hour figuring out how to do something that was already being set up for me automatically.
<mcc> … okay! good to know! ^_^
yomimono has joined #ocaml
Denommus has joined #ocaml
hugomg has joined #ocaml
rand000 has joined #ocaml
dav_ has quit [Ping timeout: 244 seconds]
dav has joined #ocaml
tane has quit [Quit: Verlassend]
BitPuffin has joined #ocaml
malc_ has joined #ocaml
<malc_> # let t = 1000001. in t, float_of_string (Printf.sprintf "%F" t);;
<malc_> - : float * float = (1000001., 1000000.)
<malc_> can someone explain this?
<mrvn> different rounding
manizzle has quit [Remote host closed the connection]
chris2 has quit [Ping timeout: 265 seconds]
willy_ has left #ocaml ["Leaving"]
BitPuffin has quit [Read error: Connection reset by peer]
Thooms has joined #ocaml
<Drup> let t = 1000001. in t, float_of_string (Printf.sprintf "%f" t);;
<Drup> - : float * float = (1000001., 1000001.)
<Drup> :D
<Drup> it might deserve a bug report ;)
kakadu_ has joined #ocaml
Kakadu has quit [Read error: Connection reset by peer]
hugomg has quit [Ping timeout: 250 seconds]
Simn has quit [Quit: Leaving]
malc_ has quit [Ping timeout: 265 seconds]
hugomg has joined #ocaml
sheijk has joined #ocaml
hausdorff has quit [Remote host closed the connection]
manud has quit [Quit: Be back later ...]
ingsoc has quit [Quit: Leaving.]
MercurialAlchemi has quit [Ping timeout: 258 seconds]
Arsenik has quit [Quit: Quitte]
<nicoo> “float_of_string: Convert the given string to a float”
malc_ has joined #ocaml
<nicoo> This actually says *nothing* about x |> string_of_float |> float_of_string being x (or any variant thereof) :þ
oscar_toro has joined #ocaml
<hugomg> The real problem is that (Printf.sprintf "%F" 1000001.0) evaluates to "1e+06"
<Drup> yes
<hugomg> That integer should be small enough to be correctly represented by a float so it does look strange
<whitequark> wow, so much backlog
<whitequark> Drup: yes, I think gadt_eq is possible
<companion_cube> o/ whitequark
<whitequark> please file a bug report and explain what code should it generate
<whitequark> hi companion_cube
<whitequark> artagnon: that's weird as hell
oriba has joined #ocaml
<whitequark> can you make some sample code to reproduce?
<companion_cube> so, CCError.t will now be polymorphic in the error type
thomasga has quit [Quit: Leaving.]
Hannibal_Smith has quit [Quit: Sto andando via]
malc_ has quit [Ping timeout: 245 seconds]
lordkryss has joined #ocaml
<adrien> if you know someone on the search engine team at google
<adrien> please
<adrien> ask them what the fuck they're doing with the excerpts they chose from the pages
malc_ has joined #ocaml
<adrien> for the "mingw-w64" query it seems to take a random sentence from the page and of course it's not the intro and it's completely out of context
<adrien> (at first I was going to ask to bang that person's head on the keyboard but that's not very friendly)
dav has quit [Ping timeout: 255 seconds]
manud has joined #ocaml
dav has joined #ocaml
sheijk has quit [Ping timeout: 265 seconds]
hugomg has quit [Ping timeout: 250 seconds]
yomimono has quit [Ping timeout: 264 seconds]
rand000 has quit [Quit: leaving]
sheijk has joined #ocaml
cespinoza has quit [Ping timeout: 244 seconds]
<struk_at_work> printf "%.7F" 1000001.0 works fine.
hyperboreean has quit [Remote host closed the connection]
<artagnon> whitequark: I'm trying. It's what I'm working on right now.
hyperboreean has joined #ocaml
<artagnon> I don't know if it's the pointer deref either.
Submarine has quit [Remote host closed the connection]
sheijk has quit [Ping timeout: 250 seconds]
sheijk has joined #ocaml
hausdorff has joined #ocaml
hausdorff has quit [Remote host closed the connection]
malc_ has quit [Ping timeout: 255 seconds]
flx has joined #ocaml
flux has quit [Remote host closed the connection]
flx is now known as flux
cespinoza has joined #ocaml
pyon has quit [Ping timeout: 258 seconds]
hausdorff has joined #ocaml
malc_ has joined #ocaml
malc_ has quit [Ping timeout: 244 seconds]
badon_ has joined #ocaml
badon has quit [Disconnected by services]
pyon has joined #ocaml
hausdorff has quit [Remote host closed the connection]
badon_ is now known as badon
kakadu_ has quit [Quit: Konversation terminated!]
chris2_ has joined #ocaml
oscar_toro has quit [Quit: Leaving.]
oscar_toro has joined #ocaml
shinnya has joined #ocaml
travisbrady has quit [Quit: travisbrady]
<artagnon> whitequark: If a test fails, how do I get full output?
<whitequark> what do you mean by "full output"?
<artagnon> There's just stderr.
<artagnon> Isn't there more when executionengine.ml executes?
<whitequark> lit would post both
<artagnon> Just a "plus failed"?
<whitequark> as you can see, llvm ocaml tests don't really have a proper testing harness
<artagnon> Oh :|
chris2_ is now known as chris2
<artagnon> It's very ad-hoc.
<companion_cube> whitequark: next release of containers soon
<whitequark> artagnon: it totally is
<whitequark> which is why I brought in the ability to depend on ounit recently
<artagnon> What is the advantage of ounit?
<whitequark> um. it's a testing harness.
<whitequark> it would, at least, print the values which do not match
<artagnon> Hm.
tg has quit [Ping timeout: 258 seconds]
<artagnon> So how do I debug this? http://pastie.org/
<whitequark> >define_function "plus"
<whitequark> two times