gildor changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 3.12.1 http://bit.ly/nNVIVH
dsheets has quit [Quit: Leaving.]
dsheets has joined #ocaml
Tobu has quit [Ping timeout: 272 seconds]
oriba has quit [Quit: oriba]
albacker has quit [Ping timeout: 246 seconds]
ftrvxmtrx has quit [Ping timeout: 248 seconds]
hyperboreean has joined #ocaml
testcocoon has quit [Ping timeout: 245 seconds]
testcocoon has joined #ocaml
hyperboreean has quit [Ping timeout: 240 seconds]
Tobu has joined #ocaml
ftrvxmtrx has joined #ocaml
KDr2 has joined #ocaml
Znudzon has quit [Ping timeout: 246 seconds]
hyperboreean has joined #ocaml
`Jake` has quit [Remote host closed the connection]
datkin has quit [Read error: Connection reset by peer]
iago has quit [Quit: Leaving]
lucesco has joined #ocaml
lucesco has left #ocaml []
lucesco has joined #ocaml
lucesco has left #ocaml []
Tobu has quit [Ping timeout: 272 seconds]
Tobu has joined #ocaml
michael_alex has quit [Ping timeout: 246 seconds]
Tobu has quit [Remote host closed the connection]
Tobu has joined #ocaml
Xizor has quit []
Tobu has quit [Remote host closed the connection]
Tobu has joined #ocaml
yezariaely has quit [Quit: leaving]
cdidd has joined #ocaml
yroeht has quit [Ping timeout: 244 seconds]
yroeht has joined #ocaml
jimmyrcom has quit [Ping timeout: 260 seconds]
ulfdoz has joined #ocaml
Tobu has quit [Ping timeout: 260 seconds]
Tobu has joined #ocaml
ulfdoz has quit [Ping timeout: 264 seconds]
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
andreypo_ has quit [Quit: Quit]
Tobu has quit [Ping timeout: 260 seconds]
pango is now known as pangoafk
Tobu has joined #ocaml
silver has joined #ocaml
albacker has joined #ocaml
albacker has quit [Changing host]
albacker has joined #ocaml
albacker has quit [Quit: Leaving]
ftrvxmtrx has quit [Quit: Leaving]
tomprince has quit [Read error: Operation timed out]
<adrien> hi
tomprince has joined #ocaml
Tobu has quit [Ping timeout: 260 seconds]
ftrvxmtrx has joined #ocaml
osa1 has joined #ocaml
osa1 has left #ocaml []
djcoin has joined #ocaml
jonathandav has quit [Read error: Connection reset by peer]
mcclurmc_ has quit [Read error: Connection reset by peer]
jonathandav has joined #ocaml
cago has joined #ocaml
rixed has quit [Quit: "box crashed"]
rby has quit [Read error: Connection reset by peer]
rby has joined #ocaml
Kakadu has joined #ocaml
protz has joined #ocaml
Tobu has joined #ocaml
<larsrh> I have a 'module type' which requires some values in the signature. Now I want to implement a function using a module of such a type, and this function can be used by implementing modules. Is this possible?
<larsrh> the problem is that I have multiple modules implementing a module type which require a certain utility function which is exactly the same for all modules
zcero has joined #ocaml
zcero has left #ocaml []
KDr2 has quit [Remote host closed the connection]
avsm has joined #ocaml
Tobu has quit [Ping timeout: 260 seconds]
Cyanure has joined #ocaml
<Kakadu> larsrh: I think ot is possible but I can't generate good syntax now
<Kakadu> try to look at the manual about first-class modules
|Lupin| has joined #ocaml
<|Lupin|> Goodmorning, everybody.
<|Lupin|> I have to write stub code to call from Caml a C function that takes as an argument a wchar_t *.
<|Lupin|> I'm wondering which type could be used for encapsulaing this in Caml ?
<|Lupin|> I realise that perhaps a tpe from Batteries would be good, but I'd like to know whether a type provided with the language could be used, so that the bindings do not depend on Batteries... ?
Tobu has joined #ocaml
|Lupin| has quit [Quit: leaving]
benozol has joined #ocaml
<Kakadu> I don't think that wchar_t is supported
<Kakadu> I think better to start from this part of manual: http://caml.inria.fr/pub/docs/manual-ocaml/manual032.html
<adrien> you can put anything you want in an ocaml string
<adrien> (he left)
<adrien> but you'll have to take some care because some functions expect null-terminated strngs
thomasga has joined #ocaml
_andre has joined #ocaml
avsm has quit [Quit: Leaving.]
avsm has joined #ocaml
<rwmjones> anyone else using native dynlink and reloading the same module in a program?
Xizor has joined #ocaml
<avsm> nope, just a single load in my uses
avsm has quit [Quit: Leaving.]
Submarine has quit [Ping timeout: 252 seconds]
emmanuelux has quit [Ping timeout: 250 seconds]
* f[x] expects a story about some funny problems with such usecase :)
beckerb has joined #ocaml
husten has joined #ocaml
beckerb has quit [Read error: Operation timed out]
benozol has quit [Ping timeout: 260 seconds]
snearch has joined #ocaml
emmanuelux has joined #ocaml
zcero has joined #ocaml
zcero has left #ocaml []
jimmyrcom has joined #ocaml
emmanuelux has quit [Remote host closed the connection]
husten has quit [Remote host closed the connection]
husten has joined #ocaml
osa1 has joined #ocaml
osa1 has left #ocaml []
Submarine has joined #ocaml
Xizor has quit []
avsm has joined #ocaml
emmanuelux has joined #ocaml
Kakadu has quit [Quit: Page closed]
bjorkintosh has joined #ocaml
Submarine has quit [Ping timeout: 246 seconds]
<thelema_> larsrh: module Utility = struct let common_f = ... end module M1 : T = struct include Util (* other stuff *) end
snearch has quit [Quit: Verlassend]
wicko has joined #ocaml
<wicko> Hi all. Why can't constructors have labelled parameters, like functions can? I want to write something like: "type blah = Foo of ~a:int * ~b:int * ~c:int * ~d:int".
<thelema_> wicko: type blah_foo = {a:int; b:int; c:int; d:int}
<thelema_> wicko: type blah = Foo of blah_foo
<wicko> hm. But then I can't use a,b,c or d anywhere else in my program, right?
<thelema_> you can't use them as record names
<thelema_> you can use them as identifiers
<wicko> i see.
<wicko> ok, thanks for your help.
wicko has quit [Quit: Page closed]
ftrvxmtrx has quit [Remote host closed the connection]
ftrvxmtrx has joined #ocaml
avsm has quit [Quit: Leaving.]
avsm has joined #ocaml
avsm has quit [Client Quit]
Tobu has quit [Ping timeout: 272 seconds]
avsm has joined #ocaml
cago has quit [Ping timeout: 272 seconds]
iago has joined #ocaml
Tobu has joined #ocaml
husten has quit [Quit: Konversation terminated!]
husten has joined #ocaml
Tobu has quit [Ping timeout: 272 seconds]
<pippijn> http://mth.github.com/yeti/ <- I almost like this language
<pippijn> if its syntax wore more ocaml-like
<bjorkintosh> is there a testing framework for ocaml?
<pippijn> ounit
protz has quit [Quit: Leaving]
<bjorkintosh> sounds painful.
<pippijn> why?
<bjorkintosh> 'cause of the 'ou' part of it.
<pippijn> ah :)
Tobu has joined #ocaml
<jonafan> played with js_of_ocaml a bit yesterday. I am simultaneously intrigued and grossed out
<pippijn> why?
andreypopp has quit [Quit: Computer has gone to sleep.]
<pippijn> jonafan: why grossed out?
<mrvn> type ('a, 'b, 'c) cfl = NilF
<mrvn> | ConsF of ('a -> 'e) * (('e, 'f, 'c) cfl) constraint 'b = 'e -> 'f;;
<mrvn> Error: Constraints are not satisfied in this type.
<mrvn> Type ('a, 'b, 'c) cfl should be an instance of ('d, 'e -> 'f, 'g) cfl
<mrvn> Why doesn't that work?
lclark has joined #ocaml
<jonafan> Well, I'm grossed out because debugging a complex js_of_ocaml script seems like it could be impossible
snearch has joined #ocaml
<pippijn> jonafan: which is why you develop your application logic outside JS and just use JS for the frontend
<jonafan> When I have to write javascript, I strive to make it readable, and this gives you 10k of crazy
<pippijn> you could use -pretty
<pippijn> but I doubt it helps
<jonafan> But, I also think javascript is basically the worst thing ever and this seems like a good way to get away from it
<jonafan> I'm not sure if javascript intentionally tries to pretend your broken code is fine or if that's just a consequence of poor design
<jonafan> I think a language/interpreter should try to report problems as close to where they are in code as possible, and javascript utterly fails at this
<jonafan> and ocaml does very well, which is really probably the main reason I like it
snearch has quit [Quit: Verlassend]
silver has quit [Remote host closed the connection]
Submarine has joined #ocaml
<hcarty> Is it possible to replace ocamlbuild's -use-ocamlfind flag with something in _tags?
<pippijn> you can make a myocamlbuild.ml and call ocamlfind in it
ftrvxmtrx has quit [Quit: Leaving]
<avsm> which is what OASIS does
<hcarty> pippijn: I was hoping to avoid a custom myocamlbuild.ml file. I can do everything else I need from _tags.
<hcarty> Oh well, I suppose a few extra typed characters isn't that bad. Or a few extra characters in a Makefile
<pippijn> hcarty: try oasis
krktz has quit [Ping timeout: 272 seconds]
krktz has joined #ocaml
cdidd has quit [Remote host closed the connection]
andreypopp has joined #ocaml
djcoin has quit [Quit: WeeChat 0.3.2]
ulfdoz has joined #ocaml
iago has quit [Ping timeout: 245 seconds]
Snark has joined #ocaml
mcclurmc_ has joined #ocaml
husten has quit [Quit: Konversation terminated!]
<thomasga> anyone got a pure OCaml implementation of wget ?
albacker has joined #ocaml
albacker has quit [Changing host]
albacker has joined #ocaml
pangoafk is now known as pango
djcoin has joined #ocaml
ftrvxmtrx has joined #ocaml
<hcarty> pippijn: This project is simple enough that a one-line _tags file is otherwise sufficient
Tobu has quit [Ping timeout: 272 seconds]
<hcarty> Given that, I would like to avoid the added (admittedly minor) complication oasis adds until it would offer a sifnificant benefit
<pippijn> I would add a makefile containing all: ; ocamlbuild -use-findlib foo.native
<pippijn> because I'M used to typing "make"
metasyntax has quit [Quit: WeeChat [quit]]
<hcarty> pippijn: That's likely what I will do, along with a clean target
<pippijn> yes
<hcarty> I could get away with a Makefile and no _tags if ocamlbuild supported findlib'd syntax extensions on the command line
<pippijn> how does that look?
<hcarty> In _tags: syntax(camlp4o), package(some-syntax)
<pippijn> interesting
<pippijn> you can do ocamlbuild -pp 'camlp4o some-syntax'
<pippijn> which is what I did before I used _tags files
<pippijn> hcarty: how does that syntax() package() stuff work?
<pippijn> for sexplib?
<pippijn> I tried this: <{ast,attributes,constant,platform}.ml>: syntax(camlp4o), package(type-conv/pa_type_conv.cma sexplib/pa_sexp_conv.cma)
<pippijn> Warning: tag "syntax" does not expect a parameter, but is used with parameter "camlp4o"
<pippijn> Warning: tag "package" does not expect a parameter, but is used with parameter "sexplib/pa_sexp_conv.cma"
<_andre> is there anything special i need to do in _oasis to correctly create a package that has functions implemented in C?
<_andre> i can use my uint library fine from the toplevel
<_andre> # Uint64.to_int (Uint64.of_int 10);;
<_andre> - : int = 10
<_andre> but if i try to use a library that uses it i get "The external function `uint64_to_int' is not available"
<pippijn> _andre: you just need to put the C files in CSources
<_andre> i have that
<pippijn> oh, and maybe you need to load the .dll or .so into the interpreter
<pippijn> I don't know much about bytecode, I usually use native code
<pippijn> hcarty: I found it
<pippijn> <{ast,attributes,constant,platform}.ml>: syntax_camlp4o, pkg_sexplib.syntax
<hcarty> pippijn: The syntax I used requires the -use-ocamlfind flag, and possibly OCaml 3.12.1
<hcarty> pippijn: The package() pieces are for findlib packages, not modules being referenced directly
<pippijn> right
<pippijn> in my ocamlbuild, that's pkg_*
<pippijn> instead of package(*)
<hcarty> pippijn: I think that syntax requires a custom myocamlbuild.ml
<hcarty> It's what is/was commonly used before ocamlfind support was added to ocamlbuild
<pippijn> ok
<hcarty> pippijn: I have pkg_* all over :-)
<hcarty> I'm finally trying out some of the ocamlbuild newness on a new project
<pippijn> I'm new :)
<pippijn> so I only know newness
<hcarty> Lack of historic baggage can be a fun thing to have :-)
<pippijn> I'm trying to figure out how to use the META plugin for oasis
<pippijn> I added all the XMETA fields
<pippijn> it doesn't generate a META file
<pippijn> oh
<pippijn> got it
<_andre> $ nm -D -C /usr/local/lib/ocaml/3.12.0/stublibs/dlluint64.so|grep uint64_to_int
<_andre> 0000000000001621 T uint64_to_int
<_andre> weird, the function is there
Tobu has joined #ocaml
<hcarty> _andre: I run into this sometimes and I can never remember the specifics of how to fix it... but I can use ZeroMQ + bitbucket's branch of uint from the toplevel.
<_andre> hcarty: i can use uint fine from the toplevel too
<_andre> this only happens when trying to use some other library that uses uint
<hcarty> _andre: But I can use ZeroMQ directly, without referencing uint
<hcarty> And the ZeroMQ bindings use uint
<_andre> but it has a copy of the uint .c files in its sources
<_andre> if i remove them and recompile i ge this:
<_andre> Cannot load required shared library dllZMQB.
<_andre> Reason: /usr/local/lib/ocaml/3.12.0/stublibs/dllZMQB.so: /usr/local/lib/ocaml/3.12.0/stublibs/dllZMQB.so: undefined symbol: caml_uint_copy_uint64.
<hcarty> That answers that question.
<_andre> oh wait, their uint64.c is modified
<_andre> so disconsider that error, caml_uint_copy_uint64 doesn't actually exist in my uint library
<_andre> if i have a file with this content: let () = Printf.printf "%d\n%!" (Uint64.to_int (Uint64.of_int 10))
<_andre> and run "ocamlfind ocamlc -package uint.uint64 a.ml", i get The external function `uint64_of_int' is not available
<_andre> but the function is there in uint64_stubs.c :)
<_andre> that code works on the toplevel, though
<_andre> ok, adding -linkpkg fixed it
iago has joined #ocaml
hyperboreean has quit [Ping timeout: 248 seconds]
hyperboreean has joined #ocaml
Snark has quit [Quit: Quitte]
err404 has joined #ocaml
iago has quit [Read error: Operation timed out]
<_andre> so i added this to myocamlbuild.ml:
<_andre> flag ["link"; "library"; "ocaml"; "byte"; "use_libuint64"] (S[A"-dllib"; A"-luint64"; A"-cclib"; A"-luint64"]);
cfa has joined #ocaml
<_andre> now i get Reference to undefined global `Uint64', which can be solved by a #require "uint.uint64"
<_andre> is the correct fix to add "requires" field in the META file?
andreypopp has quit [Quit: Computer has gone to sleep.]
<hcarty> _andre: Yes, assuming you're asking about another library that uses uint
NaCl has quit [Ping timeout: 260 seconds]
<_andre> looks like just the "requires" line is enough
<_andre> no need for those ocamlbuild lines
<hcarty> That should be correct. findlib should handle the details.
<_andre> i've just wasted two hours on this and didn't think of the obvious :s
ulfdoz has quit [Ping timeout: 245 seconds]
twittard has joined #ocaml
_andre has quit [Quit: leaving]
Submarine has quit [Quit: Leaving]
benozol has joined #ocaml
<cfa> hi guys
<cfa> i just noticed that the 3.12 documentation doesn't mention the with type := t syntax (as far as i can tell)
<_habnabit> sure it does
<cfa> aha, that explains it
<cfa> _habnabit: thanks
<cfa> is there a general rule of thumb for if/when documentation in this section percolates into the ocaml reference manual?
MilLions has quit [Read error: Connection reset by peer]
MilLions has joined #ocaml
NaCl has joined #ocaml
NaCl has quit [Changing host]
NaCl has joined #ocaml
iago has joined #ocaml
benozol has quit [Ping timeout: 246 seconds]
benozol has joined #ocaml
srcerer has quit [Quit: ChatZilla 0.9.88 [Firefox 10.0.2/20120215223356]]
albacker has quit [Ping timeout: 265 seconds]
srcerer has joined #ocaml
<mrvn> I've written a little GADT example for an universal container (a universal list): http://paste.debian.net/160709/
<xenocons> mrvn: cool
<xenocons> i havent seen code like that before (@ line 13)
<mrvn> Actualy that can be simplified a bit: http://paste.debian.net/160711/
<xenocons> is there a '.' in there?
<mrvn> xenocons: yes. That is the new GADT syntax in 4.0
<xenocons> is that an operator you have defined for composition or something
<xenocons> oh
<xenocons> cool
* xenocons hrmms
<xenocons> what exactly is it lol
<mrvn> That is like "it exists a type 'a' with 'list -> a kind -> a value'"
<xenocons> ah
<xenocons> for me (and im crazy) i would extract that type signature from the recursive bind
<xenocons> like type rec_list = type a . list -> a kind -> a value
<xenocons> let rec get : rec_list = fun l k ->
<xenocons> its interesting though ive never heard of GADT :)
<xenocons> this is... hrmm
<mrvn> Error: Syntax error
<xenocons> it doesn't like that?
<xenocons> why!
<mrvn> "type ..." isn't allowed in a type definition
<xenocons> :\
<xenocons> thats erm
thomasga has quit [Quit: Leaving.]
<xenocons> i wont judge
<mrvn> One problem I have with GADTs is that the type isn't interfered right a lot of the time. You have to write a type for get but print can be interfered.
<xenocons> ah
<xenocons> hmmm
<mrvn> The thing is that the type of l depends on the type of k and that can't be interefred.
<xenocons> what is the reason the type system sturggles to infer its type?
<xenocons> ah
<mrvn> don#t know why
<xenocons> it seems (to me) to be something that should be infered
<mrvn> one should at least be able to just type the variable, e.g. let rec get l (k : _ kind) = ...
<Drakken> The constructors should be something like IntList of (int list) and FloatList of (float list)
<mrvn> or (k : 'a . 'a kind) or something
<mrvn> Drakken: That wouldn't be a GADT
<mrvn> and not universal
<mrvn> Drakken: The list is a list of ints and floats mixed together.
<xenocons> . is an interesting choice for the operator
<mrvn> xenocons: just like in 'a . 'a -> int
<mrvn> # type r = { fn : 'a . 'a -> int; };;
<mrvn> type r = { fn : 'a. 'a -> int; }
<mrvn> Used to declare a polymorphic function in a record and a few other places.
<xenocons> so not ('b -> 'c) -> ('a -> 'b) -> 'a -> 'c heh
<Drakken> What's 4.0?
<mrvn> Drakken: the next ocaml version that will come out
<xenocons> actually, it should probably be more like (('a -> 'b) -> ('b -> 'c) -> 'a -> 'c) i guess
<Drakken> is there a doc somewhere?
<xenocons> wheehee
<Drakken> -ument
<xenocons> thats the 4.00 branch it seems
<xenocons> exciting
djcoin has quit [Quit: WeeChat 0.3.2]
<mrvn> Drakken: One thing is odd. Float 1.0 is represented as block with tag 1 containing an int: # Obj.is_int (Obj.field (Obj.repr (Float 1.0)) 1);;
<mrvn> - : bool = true
<Drakken> mrvn wouldn't that be some kind of type id?
<Drakken> I don't know enough about the compiler to read the source.