hongboz has quit [Remote host closed the connection]
ulfdoz_ has joined #ocaml
ulfdoz has quit [Ping timeout: 245 seconds]
ulfdoz_ is now known as ulfdoz
eni has quit [Ping timeout: 246 seconds]
Progster has joined #ocaml
SecretFire has joined #ocaml
dronf has joined #ocaml
sepp2k1 has quit [Remote host closed the connection]
lin has joined #ocaml
hongboz has joined #ocaml
mjonsson has quit [Read error: Connection reset by peer]
mjonsson has joined #ocaml
SecretFire has quit [Quit: Leaving]
emmanuelux has quit [Remote host closed the connection]
mjonsson has quit [Remote host closed the connection]
tactics_ has joined #ocaml
tac-tics has quit [Ping timeout: 246 seconds]
emmanuelux has joined #ocaml
Progster has quit [Ping timeout: 250 seconds]
emmanuelux has quit [Remote host closed the connection]
edwin has joined #ocaml
blinky- has joined #ocaml
eni has joined #ocaml
ftrvxmtrx has joined #ocaml
eni has quit [Ping timeout: 246 seconds]
yezariaely has joined #ocaml
lin has quit [Quit: Leaving]
<yezariaely>
I have a BatSet l, now I want to create a set containing all pairs of BatSet.elements, i.e. IntegerSet = {1,2,3} IntegerPairSet = {(1,1),(1,5),...}
<yezariaely>
I only need a TYPE not contents. Is there an easy way to do this or do I have to create the comparison for pairs, again?
<yezariaely>
e.g. something with BatPair?
<flux>
hmm, probably something like this works: module IntegerPairSet = BatSet.Make(struct type t = (int * int) let compare = compare end) ?
<yezariaely>
ah yeah :)
<yezariaely>
thx
<flux>
no problem :)
<yezariaely>
I forgot that there are inline module definitions :/
<yezariaely>
is there a BatSet.union_all [s1;s2;...] function I do not see? (of course I can implement it using fold)
<flux>
yeah I think you need to do that
<flux>
it's not a big function to write fortunately :)
avsm has joined #ocaml
<yezariaely>
flux: this might be usefull in batteries, right? maybe I should submit a patch?
avsm has quit [Ping timeout: 248 seconds]
<flux>
hmh, I don't think so. it's still quite rarely useful and it's easy to implement..
<yezariaely>
sure, but all who need it have to implement it?!
edwin has left #ocaml []
<flux>
well, I don't think it's worth to have all possibly useful functions in, if they are simple to implement. "something for everything" can quickly lead to huge APIs. I'm not saying this wouldn't be useful to some, but it's a slippery slope :P
Snark has joined #ocaml
eni has joined #ocaml
Framedragger has joined #ocaml
Kakadu has joined #ocaml
ulfdoz has quit [Ping timeout: 246 seconds]
ulfdoz has joined #ocaml
avsm has joined #ocaml
ulfdoz has quit [Ping timeout: 240 seconds]
ulfdoz has joined #ocaml
eni has quit [Ping timeout: 252 seconds]
ulfdoz has quit [Ping timeout: 248 seconds]
avsm has quit [Quit: Leaving.]
ulfdoz has joined #ocaml
avsm has joined #ocaml
blinky- has quit [Quit: /quit]
oriba has joined #ocaml
Sablier has joined #ocaml
Sablier has quit [Read error: Connection reset by peer]
Sablier has joined #ocaml
<Kakadu>
hi all!
<Kakadu>
It seems when I execute 'ocamlfind opt -output-obj' the option -linkpkg doesn't work, doesn't it?
<adrien>
sounds logical to me; which output would you want?
<Kakadu>
I expected that ocamlfind sorts dependencies and put them before my cmx files
<mrvn>
lin: The (type a) enforces polymophism where type inference would normaly pick a stricter type based on usage.
<mrvn>
Kakadu: From that article it sounds like one should rather use 'a . than (type a) except for first class modules.
<Kakadu>
mrvn: Yeah, it is not phantom types. I've failed
<kyod>
Hi, I'm trying to understand GADTs with ocaml 4.00beta and I have some problem with existential types. For instance the following code doesn't work saying that the existential type would escape : type ex = Ex : 'a -> ex ;; let f g = function Ex x -> g x;; Isn' there a way to explain to ocaml that the g function is "nice" enough to be safe to call in this context ?
<mrvn>
kyod: var g : 'a -> 'a?
<kyod>
of course not
<kyod>
more like something g : 'a -> int
<mrvn>
Then you need to connect it to the GADT so the types become dependent.
<kyod>
what do you mean by connect ?
osa1 has joined #ocaml
<mrvn>
type _ ex = Ex : 'a -> ex let f : type a . (g : a -> a) (x : a ex) = fun g (Ex x) -> g x
<mrvn>
+ -> a
<mrvn>
type _ ex = Ex : 'a -> ex let f : type a . (g : a -> a) -> (x : a ex) -> a = fun g (Ex x) -> g x
<mrvn>
Or you need to hide the arg and the function in a single constructor
<kyod>
in the first case the a type is not existential, isn't it ?
<mrvn>
yeah
<mrvn>
I hate that Debian doesn't have an ocaml-4.0 package that can be installed in parallel to the stable one.
<Kakadu>
mrvn: Compile it
<mrvn>
Kakadu: isn't that simple. Needs all the paths to be changed,
<adrien>
the line has been eaten but : '-laio' '-laio' 'lib/libaio.a'
<mrvn>
The first two should be the system libaio, the last the module
<adrien>
you should at least try renaming your file
<adrien>
or actually, you could cp the system lib to something with a different name since it might involve less work for you
dronf has quit [Ping timeout: 265 seconds]
<mrvn>
yeah, renaming the system lib to libaio2 makes it work. damn.
osa1 has quit [Quit: Konversation terminated!]
<mrvn>
Why is that? -laio lib/libaio.a should work
<mrvn>
ah, damn. the -Llib/ breaks that
<mrvn>
How can I change the name of the modules library?
kyod has quit [Quit: Page closed]
<adrien>
mrvn: -laio lib/libaio, that would give undefined references to the AIO C symbols in lib/libaio
<adrien>
linkers reads from the right to the left of its invocation
struktured has quit [Read error: Connection reset by peer]
<adrien>
and here, my libs are "lablwebkit" for instance
struktured has joined #ocaml
<mrvn>
adrien: That isn't the problem. -laio finds lib/libaio.a
<mfp>
hmm I want to install a libxxx.so along with the stub lib dllxxx.so, with the latter linking to the former. I'm getting at load time (in the toplevel) cannot open shared file: No such file... even though I used -dllpath . to try to set the rpath; any ideas?
<adrien>
mrvn: shouldn't that be the other way round?
<mrvn>
adrien: -laio2 lib/libaio.a works
<adrien>
mrvn: with /usr/lib*/libaio2.so ?
<mrvn>
I think I need oasis 0.3 where the stubs compile into lib/libaio_stubs.a
<mrvn>
adrien: yes
Kakadu has joined #ocaml
* mfp
notes that ocamlobjinfo says Extra dynamically-loaded libraries: -lcamlleveldb and guesses that getting -lleveldb there somehow should do
<adrien>
mrvn: I hadn't noticed it didn't append _stubs (since I prepend "labl" to the libname) but in my experience, things are impossible to fix if the stubs and the actual lib share the same name
<mrvn>
adrien: I have lib/aio_stubs.c but oasis seems to cut the _stubs
<mfp>
adrien: haven't followed all the conversation so I apologize if this makes no sense, but shouldn't -oc help there?
<adrien>
mfp: it's oasis which choses the filename
<adrien>
mfp: have you tried LD_DEBUG=all your_program.byte ?
<mfp>
adrien: it's the toplevel I'm interested in atm. (linking in custom mode is OK for programs), so trying it there now
<mfp>
great, it is actually looking for the file in the stublibs dir; it's just that I was installing a .so when the soname is .so.1
eni has quit [Ping timeout: 246 seconds]
<mfp>
ouch it was looking there because I had a LD_LIBRARY_PATH left, stublibs is not added the to the lib path
Yoric has quit [Ping timeout: 252 seconds]
mjonsson has joined #ocaml
mjonsson_ has joined #ocaml
emmanuelux has quit [Remote host closed the connection]
SpanishInqusitr is now known as NaCl
struktured has quit [Ping timeout: 248 seconds]
oriba has quit [Quit: oriba]
blinky- has joined #ocaml
eni has joined #ocaml
Yoric has joined #ocaml
Yoric has quit [Read error: Connection reset by peer]
Yoric has joined #ocaml
<hongboz>
does anyone know how to build documation using myocamlbuild.ml instead of foo.odocl?
<wmeyer>
hongboz: perhaps a custom script
<wmeyer>
we should have as mentioned lodabale database of rules for ocamlbuild
<hongboz>
wmeyer: Is it possible to just tag some files?
<wmeyer>
hongboz: of course, you can do anything in myocamlbuild.ml and _tags which doesn't violate basic ocamlbuild principles (e.g. single root)
lin has quit [Quit: Leaving]
<wmeyer>
i would need to look at the ocamlbuild sources
<hongboz>
wmeyer: sure. I may give a try. I don't want to scatter build files in _tags, foo.odocl...
blinky- has quit [Quit: /quit]
mjonsson has quit [Quit: Leaving]
Yoric has quit [Ping timeout: 264 seconds]
Yoric has joined #ocaml
fschwidom has joined #ocaml
Yoric has quit [Ping timeout: 244 seconds]
Yoric has joined #ocaml
<Kakadu>
I wrote some OCaml types http://pastebin.com/BEN2UEEL and now I have no idea how to write QML code which will paint ships
<Kakadu>
I think when I try to access OCaml fields in C stubs I'll die.
<mrvn>
Kakadu: s_action is tricky. I haven't yet found a good way to have an variant type that depends on the state of another type
<mrvn>
Using the planet_id_t sucks too but I guess you want to avoid recursions
<mrvn>
Kakadu: ever used sdl?
BiDOrD_ has joined #ocaml
<Kakadu>
mrvn: never. I've tried today and haven't guess why it doesn't draw anything
<thelema>
Kakadu: L, as in long, but lowercase to indicate int32
<thelema>
as opposed to L which is Int64
<thelema>
i.e. 1l = Int32.one, 1L = Int64.one
<mrvn>
It is best to use a font where I, l and 1 look different.
<mrvn>
Kakadu: you are missing: Sdlvideo.flip surface
<Kakadu>
N.B. about Lightning: it uses SDL2, SDL1.2 will not compile
Kakadu has quit [Quit: Konversation terminated!]
Kakadu has joined #ocaml
fschwidom has quit [Remote host closed the connection]
dronf has joined #ocaml
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
<Kakadu>
Btw, how C+Left works in your Emacs editor? It allows to jump word by word, AFAIR. For example in string "asdfa (* ooooooo" We can jump from asdfa to ooo and vice versa. How to configure Emacs to jump on (* too?
Framedragger has quit [Ping timeout: 245 seconds]
edwin has joined #ocaml
edwin has left #ocaml []
<flux>
I don't know, but I would start looking by using C-H k C-Left, when look at the source code of that function
<flux>
but
<flux>
this helps nothing, because forward-word in in C :)
<flux>
word-combining-categories seems to relate to this
<flux>
nah, too complicated, I give up :)
Yoric has quit [Ping timeout: 240 seconds]
Anarchos has joined #ocaml
<Kakadu>
maybe guys from #emacs know something
sepp2k has joined #ocaml
Yoric has joined #ocaml
<Kakadu>
flux: It seems that we should hack tuareg-mode-syntax-table to override this behaviour
<flux>
I don't mind the behavior that much. I would probably use C-r ( to go to the comment begin anyway.
tmaedaZ has quit [Ping timeout: 244 seconds]
sepp2k has quit [Ping timeout: 246 seconds]
tmaedaZ has joined #ocaml
Framedragger has joined #ocaml
Submarine has quit [Quit: Leaving]
sepp2k has joined #ocaml
<ssbr>
I wish that OCaml wouldn't give me exhaustiveness warnings for types with no -- what's the word, instances?
<ssbr>
type foo ;; (* totally empty *) type bar = Atom | Something of foo ;; (* Something cannot ever exist *) let thing = function Atom -> 1 ;; (* exhaustiveness warning because Something ... *)
<flux>
hmm, surely most warnings are possible to disable?
<flux>
I really like to have them, though
<ssbr>
I like warnings. I don't like warnings that are objectively nonsense
<mrvn>
who says it can't exist? There could be a function later that creates one
<adrien>
ssbr: foo is not inhabited
<ssbr>
mrvn: how can it create one?
<adrien>
just Obj.magic if you want the shorter
<adrien>
or
<flux>
I rarely write code that would cause such warnings
<adrien>
C stubs
<ssbr>
flux: Sure. I'm writing new code, and _for now_, while I'm changing the old code, this type isn't inhabited
<adrien>
ssbr: and if it's not doable, why add such a construct?
<ssbr>
adrien: because I'll be adding constructors later
<adrien>
then add them later ;-)
<ssbr>
I'm changing the syntax tree for prolog so that I can add operators
<adrien>
ocaml won't let you forget them
<flux>
ssbr, so if you want to plan for future, you have two options: | Something -> assert false or | _ -> assert false, depending what you want
<ssbr>
adrien: Sure. But the warning is still silly
<ssbr>
flux: bleh.
<mrvn>
ssbr: if there can't be a Something foo then why declare one in the type?
<adrien>
ssbr: no it's not =)
<mrvn>
ssbr: this is a classic case of garbage in -> garbage out
<ssbr>
mrvn: The input is not garbage...
<ssbr>
the input is perfectly well-defined and has -- presumably -- obvious semantics?
<mrvn>
ssbr: yes it is. type bar can only be Atom so declare it as type bar = Atom
<mrvn>
ssbr: i didn't say it was wrong input, just garbage.
<ssbr>
What does "garbage" mean to you?
<ssbr>
the original phrase implied that garbage meant "wrong"
<ssbr>
"wrong inputs cannot give correct outputs"
<ssbr>
however, here there is a correct output, and there is a nonsense output. OCaml is giving the nonsense output.
<mrvn>
ssbr: it is wrong but not syntactically or gramatically wrong
<ssbr>
mrvn: it is not semantically wrong either
<ssbr>
it does exactly what I meant for it to do, and has the semantics I wanted it to have, doesn't it?
<ssbr>
(Although the warning system doesn't)
<mrvn>
ssbr: no, it doesn't. It gives a non-exaustive warning
<ssbr>
I'm willing to deal with the non-exhaustive warning. It's only for another ten minutes or so anyway
<ssbr>
I'm not going to delete that case just to add it back later
<mrvn>
| Something _ -> raise FIXME
<ssbr>
That also seems silly. It's just to make the compiler be quiet.
<flux>
you could just comment it out. when you need the type again, the compiler is sure to tell you.
<ssbr>
I can deal with nonsense compiler output for ten minutes, too
<ssbr>
flux: I would do this if comments were less annoying in my editor :( (it doesn't have a "make the selection be a comment) keybind AFAIK)
<mrvn>
Just ignore it till you are ready to deal with the case
<ssbr>
mrvn: Right.
<flux>
well, use emacs :)
<ssbr>
flux: not happening
<ssbr>
heh, okay, ocaml doesn't like this way of doing things, that much is clear
<ssbr>
(can't match no cases)
<flux>
ssbr, btw, if the foo-type is accessible from other modules, they too would need not to have functions of form external mk_foo : unit -> foo
<flux>
seems quite a complicated analysis to make to elide this warning.
<flux>
basically impossible in presense of separate compilation
<ssbr>
flux: I don't understand the problem, sorry. Why is not not enough to say, "clearly this constructor cannot be invoked"?
<mrvn>
ssbr: because often you have types abstract in the signature only
<flux>
ssbr, you want to say that to the compiler or what?
<ssbr>
flux: are you saying that something can be of a type, despite no constructors existing?
<flux>
ssbr, yes. have you looked at ocaml/c interaction?
<flux>
ssbr, for example Unix.file_descr
<flux>
it's an integer
Snark has quit [Quit: Quitte]
<ssbr>
flux: Sure, I've looked at some.
<mrvn>
ssbr: module M : sig type t end = struct type t = int end
<flux>
there's no ocaml code to create that
<ssbr>
flux: ah, I see
<ssbr>
so it could be treated as an opaque value
<flux>
(well, there might be, not sure actually, but the point stands)
<mrvn>
ssbr: How is M.f different from your foo?
<mrvn>
M.t
ulfdoz has quit [Ping timeout: 252 seconds]
<ssbr>
I'm not too familiar with modules
<ssbr>
would that be for a C library like flux describes?
<ssbr>
or can type declarations in modules be extended, or...?
<mrvn>
ssbr: not only, abstract types are also often used to hide the implementation details of a type.
<flux>
in_channel is an opaque type in ocaml, it has no inhabitants
<flux>
it only has functions like: external open_descriptor_in : int -> in_channel = "caml_ml_open_descriptor_in"
<mrvn>
ssbr: point is that from the type definition you can't tell wether the type can be instanciated or not.
<ssbr>
mrvn: Okay, what is an "abstract type"?
<mrvn>
ssbr: type t
<flux>
ssbr, you can leave the type details out in an interface
<ssbr>
mrvn: Okay, so that is not just "a type without any constructors", but also actually a separate construct?
<ssbr>
or is "abstract type" synonymous with "no constructors"?
<flux>
module Foo : sig type t val get_t : t end = struct type t = () let get_t = () end
<mrvn>
ssbr: the type has constructor, I just don't tell the world about it.
<ssbr>
mrvn: Okay, then that is the difference.
<flux>
now you get Foo.get_t which returns an instance of the abstract type t
<flux>
it's only abstract to code outside Foo
<ssbr>
It seems like it would be feasible even in the face of separate compilation if OCaml modules had a way of declaring types transparently as having no constructors
<ssbr>
like, it shouldn't be a complicated analysis
<mrvn>
ssbr: "type foo" just says that there is a type foo of some sort and not to care what it is. It's a big black box.
<ssbr>
OTOH, this is such a non-issue that there's no point
<ssbr>
mrvn: but if it was type foo = Bar , then it would say "this is not a black box, it is a type with one and only one constructor"?
<ssbr>
or does that say, "this has at least one constructor, Bar"
<mrvn>
ssbr: one and only one
<ssbr>
so the problem is that type t doesn't mean what I thought it meant. I thought it meant "no constructors", but instead it means "I choose not to reveal what constructors exist"
<ssbr>
Where should I have read to learn this?
<mrvn>
ssbr: and as said, declaring a type that realy has no constructors makes no sense (with the exception of phantom types) in finished code. It only makes sense in your half done source.
<ssbr>
All I could find was the syntax definition, and I saw that the list of constructors was optional
<mrvn>
ssbr: look at modules and their signatures
<ssbr>
mrvn: I could just as easily have inferred that "modules are special"
<ssbr>
where do I read about this, in the actual documentation?
<mrvn>
ssbr: Chapter 2 in the manual
<mrvn>
ssbr: and remember that a file automatically is a module by the same name