<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)
<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