gildor changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 3.12.0 http://bit.ly/aNZBUp
emmanuelux has quit [Remote host closed the connection]
emmanuelux has joined #ocaml
emmanuelux has quit [Remote host closed the connection]
emmanuelux has joined #ocaml
penryu has quit [Ping timeout: 260 seconds]
penryu has joined #ocaml
oriba has left #ocaml []
emmanuelux has quit [Quit: =>[]]
smerz has quit [Quit: Ex-Chat]
jld has quit [Ping timeout: 248 seconds]
Tianon has quit [Ping timeout: 260 seconds]
jld has joined #ocaml
Tianon has joined #ocaml
Tianon has quit [Changing host]
Tianon has joined #ocaml
f[x] has quit [Ping timeout: 258 seconds]
f[x] has joined #ocaml
boscop_ has joined #ocaml
boscop has quit [Ping timeout: 248 seconds]
hto_ has joined #ocaml
hto has quit [Ping timeout: 252 seconds]
vivanov has quit [Ping timeout: 240 seconds]
vivanov has joined #ocaml
sepp2k has quit [Quit: Leaving.]
ulfdoz has joined #ocaml
dnolen has quit [Quit: dnolen]
larhat has joined #ocaml
mjonsson has quit [Remote host closed the connection]
wtetzner has joined #ocaml
Rolands has joined #ocaml
wtetzner has quit [Quit: Leaving]
wtetzner has joined #ocaml
ulfdoz has quit [Read error: Operation timed out]
jderque has joined #ocaml
Snark has joined #ocaml
philtor has quit [Ping timeout: 252 seconds]
ikaros has joined #ocaml
joelr has joined #ocaml
<joelr> good day folks!
<joelr> how can i have different mli files for a single ml file?
<rproust> joelr: a.ml b.ml c.mli
<rproust> a.mli contains "include C.COMMOM_INTERFACE"
<joelr> rproust: more like a.ml and then b.mli, c.mli for different "interfaces"
<rproust> b.mli contains the same
<rproust> ok
<joelr> rproust: can that be done?
<rproust> b.ml contains "include A"
<rproust> and c.ml contains the same
<rproust> then you use B or C that share the same implementation but different interfaces
<rproust> there might be a more elegant way
<rproust> other solution: in A you do module Implem = struct .. end module type INTERFACE_B = sig .. end module type INTERFACE_C = sig .. end module B :INTERFACE_B = A module C : INTERFACE_C = A
<rproust> and then you export A.B and A.C in the interface a.mli
jamii has joined #ocaml
BcB_ has joined #ocaml
BcB_ has quit [Quit: Ex-Chat]
BcB_ has joined #ocaml
BcB_ has quit [Client Quit]
ftrvxmtrx has quit [Quit: This computer has gone to sleep]
jderque has quit [Quit: leaving]
ikaros has quit [Quit: Leave the magic to Houdini]
eikke has joined #ocaml
<vivanov> when runnning 'make install' for xen-api-libs from github -- i get an error: ocamlfind: *.sp?t: No such file or directory -- how to fix ?
hto has joined #ocaml
edwin has joined #ocaml
hto_ has quit [Ping timeout: 276 seconds]
Associat0r has joined #ocaml
hto has quit [Ping timeout: 276 seconds]
Cyanure has joined #ocaml
ftrvxmtrx has joined #ocaml
Associat0r has quit [Ping timeout: 250 seconds]
Associat0r has joined #ocaml
jderque has joined #ocaml
lopex has joined #ocaml
Rolands has quit [Ping timeout: 260 seconds]
Associat0r has quit [Ping timeout: 246 seconds]
hto has joined #ocaml
hto has quit [Ping timeout: 250 seconds]
boscop_ is now known as boscop
chambart has quit [Read error: Operation timed out]
chambart has joined #ocaml
Cyanure has quit [Ping timeout: 248 seconds]
hto has joined #ocaml
ftrvxmtrx has quit [Read error: Connection timed out]
ftrvxmtrx has joined #ocaml
Cyanure has joined #ocaml
jamii has quit [Ping timeout: 246 seconds]
avsm has joined #ocaml
_andre has joined #ocaml
oriba has joined #ocaml
joelr has quit [Quit: joelr]
emmanuelux has joined #ocaml
ymasory has quit [Ping timeout: 250 seconds]
ymasory has joined #ocaml
jderque has quit [Quit: leaving]
smerz has joined #ocaml
dnolen has joined #ocaml
lopex has quit []
dnolen has quit [Quit: dnolen]
notk0 has joined #ocaml
<notk0> hello, let's say I have a list of tuplets in ocaml, let's say [ ("a",1_
<notk0> [ ("a",1),("b",2)..] etc, what is the easiest way to return [1,2] ?
<flux> List.map snd
emmanuel_ has joined #ocaml
<notk0> flux, err, that returns ("b",2)
<flux> heh
<flux> I think you mean [ ("a", 1); ("b", 2) ] instead
<notk0> oh yes
<notk0> flux, thank you, I love you, you are my hero
<notk0> <3
<flux> \o/
<flux> happy hacking
emmanuel_ has quit [Client Quit]
fraggle_ has quit [Ping timeout: 260 seconds]
fraggle_ has joined #ocaml
lopex has joined #ocaml
hto has quit [Ping timeout: 248 seconds]
Associat0r has joined #ocaml
ymasory has quit [Quit: Leaving]
hto has joined #ocaml
thieusoai has joined #ocaml
ftrvxmtrx has quit [Quit: Leaving]
oriba has quit [Quit: oriba]
krktz has joined #ocaml
krktz has left #ocaml []
eikke has quit [Ping timeout: 248 seconds]
<notk0> hello, I can't seem to find how to use the match with when syntax (if it exists)
ikaros has joined #ocaml
<_habnabit> 'when' exists, sure.
notk0 has quit [Quit: bye bye]
vivanov has quit [Read error: Connection reset by peer]
philtor has joined #ocaml
jderque has joined #ocaml
rixed_ has joined #ocaml
rixed has quit [Ping timeout: 248 seconds]
<NaCl> kk
<NaCl> adrien: any suggestions wiht using the toplevel with ocamlbuild?
<_habnabit> What's there to suggest?
<NaCl> ocamlbuild dumps all the output files to _build/
<NaCl> uh...
* NaCl probably is asking random questions
<NaCl> even better. Is there a way to make the toplevel recognice module deps on source files?
<larhat> NaCl: you can add directories to search path in toplevel using "#directory" http://caml.inria.fr/pub/docs/manual-ocaml/manual023.html#s:toplevel-directives and then #load modules
<NaCl> hmmm
Associat0r has quit [Quit: Associat0r]
<adrien> you won't be able to reload the modules automatically however
<adrien> I think there was some discussion (maybe very short) about an "integration" between the two but I can't find it anymore
<NaCl> yeah, it wants to load modules in a particular order
<NaCl> uh
ulfdoz has joined #ocaml
<NaCl> this is inconvenient. >_<
<NaCl> doesn't this kind of defy the point of a toplevel?
emmanuelux has quit [Remote host closed the connection]
emmanuelux has joined #ocaml
<NaCl> hm... the compiled object file doesn't contain some of my function definitions...
<adrien> ocamlfind's topfind has: "Topfind.reset();; to force that packages will be reloaded" but I don't know how well it works
<adrien> NaCl: are you using mli files?
<NaCl> no
<adrien> what's missing?
<NaCl> my struct constructor
<NaCl> "constructor"
<adrien> how do you see it's not there?
<NaCl> I call it, and the toplevel says that it doesn't exist
<adrien> NaCl: so: you have "struct constructor = { ... }" and you try to use "constructor" as a function?
<NaCl> init_ray = {} ...
<NaCl> let r = init_ray ;;
<NaCl> works if I load the file with #use, but not the .cmo with #load
<adrien> (hmmmm, I've been doing too much C lately =) )
<NaCl> if it makes a difference, I call the function nowhere in my code
<adrien> NaCl: can you pastebin your code?
<NaCl> adrien: if it makes a difference, I have another file that I build the executable from
<NaCl> hmmm
* NaCl is getting ideas
<adrien> NaCl: hmmm, when you don't #use "foo.ml", do you call "init_ray" or "Foo.init_ray"?
<NaCl> init_ray
<adrien> also, it should be possible to make the toplevel work with ocamlbuild quite well
<adrien> NaCl: has to be Foo.init_ray
<NaCl> get "Unbound module Foo"
<thelema> NaCl: what's the module you're #load-ing?
<adrien> NaCl: run ocaml with: ocaml -I _build foo.cma
<adrien> I think it doesn't find the .cmi file that comes with the cm(x)a
<NaCl> modules are just files, right?
<thelema> NaCl: well, files make modules. It's possible to make modules other ways
<thelema> NaCl: what's the exact #load command you're running?
<NaCl> adrien: using #directory "_build/" works fine
Associat0r has joined #ocaml
<NaCl> bleh
<NaCl> this is more complicated than, say, python. xD
<thelema> thelema@norige-desktop:~/test$ ocamlbuild point.native
<thelema> # #directory "_build/";;
<thelema> # #load "point.cmo";;
<thelema> # Point.init_ray;;
<thelema> - : Point.ray =
<thelema> {Point.origin = {Point.x = 0.; Point.y = 0.; Point.z = 0.}; Point.direction = {Point.x = 0.; Point.y = 0.; Point.z = 0.}}
<thelema> (I downloaded your pastebin as point.ml)
<NaCl> thelema: exactly what I ended up doing
<NaCl> but... would there be a way to autoload modules?
<thelema> i.e. if you ask for a symbol "Foo.bar", and there's no Foo module available, it should look for a "foo.cmo" file and load that and try again?
<adrien> I think you can use inotify to wait for ocamlbuild to update libs and then load them but you need a way to communicate with the toplevel while still allowing user input
<NaCl> thelema: no dice
<NaCl> thelema: if it makes a difference, my files are capitalized
<thelema> NaCl: well, despite the requirement for module names to start with a capital letter, their filenames are commonly first-letter lowercase.
<NaCl> should capitalizing the filename make a difference?
<thelema> no, it's just a style thing.
<NaCl> I start the other file with open Geometry ll
<NaCl> s/ll/;;/
<thelema> ok
<NaCl> should I just reference elements in the Geometry module with Geometry.<whatever> instead of using that statement?
<thelema> If you reference values in the Geometry module a lot, then [open] it. If rarely, then use Geometry.foo
pdhborges has joined #ocaml
<NaCl> yeah, often
<NaCl> uh...
<adrien> you can also use "module Geo = Geometry" to get a shorter name
<NaCl> mmm cool
<NaCl> this still doesn't solve my whole "(re)load everything from the toplevel" problem
avsm has quit [Quit: Leaving.]
<thelema> you want to use the toplevel for interacting with source code you're in the process of writing?
<NaCl> yes
<thelema> write the (toplevel) commands to reset the toplevel and reload all the modules you're working on into a text file and then #use this text file to reset
<NaCl> mm
<NaCl> fun
<thelema> i.e. file "reset" with contents "Toplevel.reset();; #use "Point.ml";; #use "Geometry.ml";; ..."
<NaCl> cool, thanks
<thelema> err, toplevel.reset doesn't exist
<thelema> and topfind.reset isn't what you want.
<thelema> so you'll have to exit and start again if you want to remove a value you've defined
<NaCl> shouldn't there be a way to do that?
* NaCl gets ideas
<thelema> there isn't one that I know of.
<NaCl> I may make one after I make this toy ray tracer
<NaCl> or see about it
vivanov has joined #ocaml
Associat0r has quit [Quit: Associat0r]
thieusoai has quit [Remote host closed the connection]
rixed_ has quit [Ping timeout: 240 seconds]
eye-scuzzy has quit [Quit: leaving]
jderque has quit [Quit: leaving]
<NaCl> how would I go about specifying a negative floating point value?
<thelema> (-2.0)
<thelema> or (~-. x) if you need to get really specific about applying the float unary negation operator to a value
larhat has quit [Quit: Leaving.]
<NaCl> thelema: I don't, thanks
pdhborges has quit [Quit: Leaving.]
jderque has joined #ocaml
hto has quit [Ping timeout: 240 seconds]
wieczyk has quit [Ping timeout: 240 seconds]
wieczyk has joined #ocaml
vivanov has quit [Ping timeout: 260 seconds]
pdhborges has joined #ocaml
yezariaely has joined #ocaml
Associat0r has joined #ocaml
ymasory has joined #ocaml
ftrvxmtrx has joined #ocaml
ftrvxmtrx has quit [Client Quit]
yezariaely has left #ocaml []
impy has quit [Ping timeout: 246 seconds]
ftrvxmtrx has joined #ocaml
impy has joined #ocaml
impy has quit [Client Quit]
impy has joined #ocaml
ftrvxmtrx has quit [Remote host closed the connection]
<sheets1> thelema: upon further inspection, I don't think just lifting out of the object fixed that polymorphism problem yesterday. I have the sinking feeling that I can't write a common ancestor map function :-(
<thelema> sheets1: :(
<sheets1> It's really disappointing. Is there no way to get this sort of polymorphism in OCaml? Is the edict against coercion this deep?
<sheets1> The return type of the function keep getting inferred to some specific argument of the polymorphic variant constructors
<sheets1> It seems like the function's object arg cannot be expanded and closed differently in different match branches
<thelema> the function must have a single type... if you expect it to have different types in different match branches...
<sheets1> it is (#ob as 'o) -> 'o but as soon as the argument to the tag is known, that 'o gets bound across the entire match
<sheets1> even though the tag constructors have a homogeneous return type
<thelema> I think you're expecting GADT-like behavior, having different types in different branches
<sheets1> :'-(
<thelema> (#ob as 'o) -> 'o isn't an inferrable type.
<sheets1> thanks for the tip, i'll go read what oleg has to say
<thelema> you may be able to work around this by putting your function into a record
<sheets1> i annotated the map function's function parameter with that type
<sheets1> (oleg re: gadt in ocaml)
<thelema> try 'a r = {f: 'a -> 'a} constraint 'a = [> ob]
<sheets1> hmm ok
<thelema> sheets1: annotating function parameters is *not* the same as getting a value out of a record
<thelema> annotating function parameters just adds more constraints
<sheets1> yes, sorry, i meant in reference to inferrability
<thelema> getting a value from a record guarantees that the type of that value is the type of that record field.
<thelema> I'm not sure I've got the record type correct either...
<sheets1> at least it's a lead :-)
<thelema> maybe type r = {f : 'a . 'a -> 'a} constraint 'a ...
<sheets1> i'll let you know what i find. thank you again
<thelema> good luck
<sheets1> thanks :-/
<sheets1> thelema: ok… it looks like the universal quantification approach in the record works
<sheets1> it's weird that it doesn't work for the polymorphic methods, though
<thelema> great!
<thelema> putting the function in a record doesn't let you use a polymorphic method?
<sheets1> it's not a polymorphic method any more because the polymorphism is all inside the record
<sheets1> i guess i expected to be able to put that polymorphism at the object level instead of introducing another box
<thelema> ah, well that's all because records are nominally typed, and objects are structurally, so declarations of polymorphism have different weight.
<sheets1> so i should just be using first-class modules is what you are saying? :-P
<sheets1> aren't they nominal records of functions?
<thelema> yes, you could use first class modules instead of records here. I don't think you should.
<sheets1> ok. when does the pain become great enough to legitimize first class modules? swappable interpreters? linked polymorphic functions?
<thelema> if you need nested records, you use modules.
<thelema> records with the same field names, but different groups of them
<sheets1> so something like the inner boxes of my two layer object nonsense, then? do you think first-class modules deprecate ocaml's objects?
<thelema> not quite - objects still have their uses.
<thelema> But yes, less requirements for objects with 1st class modules around
<thelema> You may be able to do your two-layer object nonsense using modules, I'm no expert on them - I'm still using 3.11
<sheets1> hmm ok. thanks :-)
_habnabit has left #ocaml []
pdhborges has quit [Quit: Leaving.]
mjonsson has joined #ocaml
lamawithonel has quit [Ping timeout: 240 seconds]
Cyanure has quit [Remote host closed the connection]
lamawithonel has joined #ocaml
jderque has quit [Quit: leaving]
impy has quit [Quit: impy]
lpereira has joined #ocaml
* adrien spent one hour trying to debug a bug related to ocamlmakefile/ocamldsort/make which appeared on its own and went away on its own
emmanuelux has quit [Read error: No route to host]
emmanuelux has joined #ocaml
impy has joined #ocaml
<thelema> adrien: ocamlbuild?
Associat0r has quit [Quit: Associat0r]
<adrien> thelema: ocamlbuild won't work on these sources, but oasis will
<thelema> interesting.
<adrien> I opened a bug on mantis about that: basically, ocamlbuild "sees" foo.ml as "foo", which means that is has issues when you have foo.c, foo.h and foo.ml
<adrien> it doesn't copy the files to _build so typically, .h aren't found
<adrien> can't remember the details, it was 8 or 9 months ago
<thelema> ah. can't you rename some of the files so the names don't conflict?
<adrien> oasis adds -I flags to the source folder (meaning not _build/)
<thelema> okay, if it won't save you trouble, it makes sense to use something else.
rixed has joined #ocaml
<adrien> I went for ocamlmakefile in this project a quite long time ago
<thelema> I have experience trying to switch build systems - building ocaml projects is just a pain.
<adrien> I'll add oasis support actually: I was waiting for 0.3.0 and the support for pkg-config stuff but I can use the workaround for now
<adrien> I have a >3000 chars line in ocamlmakefile's config and it'll only get worse, that only is a good reason to go for ocamlbuild through oasis ;-)
<thelema> 3KB line? that's too big
<adrien> many many files
<thelema> well, you could be doing things like git and have a separate line for each dep.
Snark has quit [Quit: Ex-Chat]
<adrien> I have 30 "modules" and each module has 10 files
<thelema> http://git.kernel.org/?p=git/git.git;a=blob_plain;f=Makefile;hb=2de58b398b5a1f81bf74a385e41cfc2fcd9cb427
<thelema> especially LIB_OBJS, BUILTIN_OBJS
<thelema> (I think it's done that way to merge better)
<adrien> at first I was putting everything inside a $(shell ocamldsort ....................)
<thelema> ewww
<adrien> now I don't do that anymore so I could probably do that
<adrien> I have no idea why ocamlmakefile does not manage to sort everything by itself
<adrien> it calls ocamldep and creates what it needs but this has no impact, or at least it doesn't work well enough (or I can't use it properly)
<adrien> but to be honest, I don't really feel like digging into make and a huge makefile
<thelema> yes, it is a really huge makefile, probably held together with lots of magic
<adrien> I had to dig into glib2 for that project, and I actually reverse-engineered it to some extent, but makefiles look far worse than glib2 :P
_andre has quit [Quit: leaving]
<adrien> well, bedtime for me, good night
<thelema> cheers
mattam has quit [Ping timeout: 276 seconds]
edwin has quit [Remote host closed the connection]
ymasory has quit [Ping timeout: 248 seconds]
dnolen has joined #ocaml
hto has joined #ocaml
ikaros has quit [Quit: Leave the magic to Houdini]
avsm has joined #ocaml
avsm has quit [Quit: Leaving.]
ymasory has joined #ocaml
Amorphous has quit [Ping timeout: 246 seconds]
Amorphous has joined #ocaml
smerz has quit [Quit: Ex-Chat]
ulfdoz_ has joined #ocaml