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
<albacker> manveru: that's the only way to it ?
<albacker> manveru:
<albacker> Error: This expression has type int but an expression was expected of type
<albacker> Int64.t = int64
<albacker> this is what i got after compiling a code that haed Benchmark.make 0 in it.
<albacker> im sleeping, if someone wants to help me feel free to write me here and tell me what's wrong.
<albacker> thanks #ocaml :)
<albacker> good night.
<thelema> albacker: Sys.time() is useful too. as for the int64, try [.make 0L]
wuj has joined #ocaml
evud has joined #ocaml
evud has left #ocaml []
emmanuelux has quit [Remote host closed the connection]
CoryDambach has joined #ocaml
vk0 has quit [Read error: Operation timed out]
vk0 has joined #ocaml
metasyntax has quit [Quit: ♫ In our sky there is no limits, and masters we have none; heavy metal is the only one! ♫]
wuj has quit [Ping timeout: 265 seconds]
joewilliams is now known as joewilliams_away
wuj has joined #ocaml
wuj has quit [Ping timeout: 265 seconds]
gnuvince_ has joined #ocaml
zubeen has joined #ocaml
<zubeen> Error: This expression has type ('a -> float polynomial) list
<zubeen> but an expression was expected of type float polynomial list
<zubeen> derivlist: ('_l → float polynomial) list
<zubeen> can anyone help me with this error message?
<zubeen> what is the difference between 'a and '_l?
<thelema> it looks like you're missing an argument
<thelema> but the difference between 'a and '_a is subtle and has to do with not being completely polymorphic, but needing one specific type, unknown so far.
<zubeen> thelema: thank you, the explanation helps.. i ll try to probe further
<zubeen> thelema: resolved it
<zubeen> thank you
ikaros has joined #ocaml
wormphlegm has joined #ocaml
wormphlegm has quit [Client Quit]
hto has joined #ocaml
ikaros has quit [Quit: Leave the magic to Houdini]
hto has quit [Read error: Connection reset by peer]
hto has joined #ocaml
<albacker> thelema, thanks for answering my question, dont know why i was using Unix.time and not Sys.time :) thanks for the .make 0L too.
<thelema> albacker: no problem, glad to help
ttamttam has joined #ocaml
<thelema> noone recommends ocaml. Maybe polymorphic print is a critical feature
* ski notes that noone mentioned the module system, with functors
<albacker> :)
<albacker> thelema: what do you mean by polymorphic print ? (print_int, print_string, .. etc) ?
<albacker> separated print functions?
<flux> albacker, print 42; print "hello";
<albacker> ok, i was right.
<albacker> so it's not possible to write such function?
<thelema> no, at runtime, there's no type information to dispatch off of
<flux> well
<flux> there is the dumping library
<thelema> which is low on my list of TODO: put that type info back in
<flux> thelema, a big patch to the compiler?
<thelema> of course encoding it for arbitrary types isn't going to be easy
<thelema> flux: yes
<flux> I have a feeling such a patch would never go to tha main branch..
<albacker> all i thought was this : http://pastebin.com/qrJkZcFL and it's ugly.
<flux> the issue with that kind of stuff is that you need to keep repeating the type of the value you have
<thelema> yup, the compiler knows the types...
<albacker> yes. isn't there a way to 'hide' that :)
<albacker> i think it's meant to be like this in ocaml, strongly typed right? :)
<thelema> maybe an alternative is to provide a path for compiler internals to make their way into the compiled program
<thelema> something like foo'type
<thelema> (except for that being a valid variable name by itself)
<thelema> and this would get reified as the type of the given value (in some form)
<thelema> of course this runs into the expression problem - matching on the type becomes hard to extend
<flux> well, one could have type classes
<flux> it's still strongly typed
<flux> actually, perhaps not?
<ski> so would a reified type (a value) have more or less a GADT type ?
<flux> but actually what albacker probably meant was that ocaml is statically typed?
<thelema> I dunno, don't type classes need runtime representation? Once we're adding that...
<flux> yes, but it's still safe AFAIK
<flux> so you don't have a type-case that fails
<ski> (so that you have to say something like 'a type_rep -> 'a -> ... if you want to dynamically inspect 'a)
<flux> what you're suggesting is basically match type_of_value a with `Int -> print_int (Obj.magic int) ?
<thelema> flux: meaning that pattern matching could be complete? I don't think so...
<flux> (make that last int 'a')
<thelema> flux: something like that.
<flux> thelema, but you define the operations for the type, you don't have an actual 'case' on the type
<ski> flux : i think having it behave like an *open* GADT type would remove the need for `Obj.magic'
<thelema> ski: yes, that'd be one really nice thing to have. Or at least a way to take a variant with parameters and strip away the parameters
<thelema> (which could be done using existing tags)
<thelema> maybe that's a first step
<ski> i mean, if you match a value (namely, the reified type) of type 'a type_rep with `Int (or whatever), then the type variable 'a would get refined to be int
<ski> (and so you could use any 'a or 'a list or whatever, as int or int list &c, in that branch)
<albacker> doen't haskell has something like this. each time you define a type, you also define it's print function (you extend some other pre-defined class).
<thelema> flux: in type classes, yes, but how would the runtime find the right ... hmm
<thelema> ski: yes, that's it.
<ski> albacker : yeah, but type classes is different from run-time type inspection
<ski> (i mean, `Typable' in haskell implements run-time type inspection .. but it's more or less a hack, using `unsafeCoerce')
<flux> just make basic types in ocaml object orienteed and add method #to_string to them \o/
<ski> type classes, in themselves, do no type inspection
<thelema> flux: I don't think ocaml'll go there. most people (myself included) don't use the "o"
<flux> ski, well, the implementation of type classes requires runtime inspection of types, in the form of passing dictionaries? just the same was as foo#bar requires runtime inspection instead of a hard statically compiled call to the functino that does the job
hcube has quit [Ping timeout: 255 seconds]
<ski> thelema : hm, what do you mean by "take a variant with parameters and strip away the parameters" ?
<flux> thelema, well, true. and it would solve the problem only for to_string.
<flux> nevertheles, that kind of solution would be compile time safe (as would be type classes)
<ski> flux : run-time type inspection is not the same as passing dictionaries
<ski> with a dictionary, you just call the operation in the appropriate field, regardless of what closure it holds
<ski> with run-time type inspection, you actually do a matching process
<thelema> ski: current variants are a tag + pointers, I've wished to be able to use the tag only to parameterize something else
<ski> hm, example/elaborate ?
<thelema> It was a long time ago, I'll have to find the code again... Something to do with parsing of EBML
<ski> flux : the other thing about run-time type inspection is that we don't really want to be able to do it in every polymorphic function, since that would break parametricity, and probably abstraction boundaries as well (but maybe you already knew this)
<ski> a simplified example would probably suffice
<ski> hm
<ski> maybe you want tags, which are associated with types, but which carry no value of that type along ?
<ski> which could then e.g. me used as keys in maps, whose corresponding values would have a type depending of the parameter type of the key type ?
<ski> (at least i've been thinking a little about that, lately ..)
<ski> so if you have a map of type `(key,value) map' then given a key of type `int key', then that map would map that key to a value of type `int value'
<ski> something like
<thelema> not for maps, it was for matching...
<thelema> except it couldn't have been for matching... for parameterizing another something?
<ski> lookup : ('k,'v) map -> ('a 'k -> 'a 'v option)
<thelema> the "tags" question matches what I recall. But not your use...
<ski> (probably one needs some extra condition on 'k there, like that it has a "polymorphic equality (or ordering)" operation)
<ski> ok
<ski> if you find the code, i'd be interested to see what your use was
<thelema> ... or not. sorry, I re-read your question...
<ski> basically, in my case, the tag type would be a gadt type (and the value type would possibly be one as well, but not necessarily)
<ski> (anyway, if you find it, i'd like to take a look)
<thelema> well, here's what I wrote, maybe you can guess what I wanted...http://ocaml.pastebin.com/gXST3k2N
<thelema> probably something better for the ['a value] type
<thelema> or maybe so that I could have a `Container_v
<ski> hm, it looks gadt-like, i think
<ski> (i assume you have seen <https://sites.google.com/site/ocamlgadt/>, yes ?)
<thelema> there's definitely some gadt-y stuff there. It was written in 2008
Yoric has joined #ocaml
<ski> eb_val_of_seq : type t. seq -> t eb_value_type -> t value
<thelema> here's the full code, if anyone wants to play: https://github.com/thelema/ocaml-ebml
<ski> i think
<thelema> ski: yes, that's probably a major part of what I wanted to achieve
<thelema> although that wouldn't be helped by having a built-in eb_val -> eb_value_type conversion
<thelema> ebml.ml L708 is probably part of the puzzle
<ski> (s/seq/char Cf_seq.t/)
<thelema> type seq = char Cf_seq.t
<ski> ah, ok
* ski was trying to figure out exactly what `type .. = .. constraint ..' did
<thelema> some phantom typing going on there... dunno if I did it correctly, though
<thelema> probably was just copying off some unrelated example
<ski> afaiu
<ski> type 'a value = eb_val constraint 'a = eb_value_type
<ski> means that eb_val constraint is the same as eb_value_type value
<thelema> no, constraint is a keyword
<ski> yeah, i know
<thelema> type 'a value = eb_val
<thelema> and 'a must be eb_value_type
<ski> (i just looked it up in the manual, hadn't seen this before .. but i'm not quite sure yet of the exact semantics)
<ski> er, s/eb_val constraint/eb_val/, yes .. that was a copy-type
<ski> s/type/typo/ :)
<ski> (funny how "type" is so much easier to type, than "typo" :)
<thelema> I use it again in typ_props (L342 https://github.com/thelema/ocaml-ebml/blob/master/ebml.ml)
Snark has joined #ocaml
<thelema> yes, this was the motivation - each parameter has a type, and optionally a default value (of that type)
<thelema> I had to work too hard for this to match
* ski idly wonders why <https://github.com/thelema/ocaml-ebml/blob/master/ebml.ml> displays a completely blank page here ..
* ski tries firefox
<ski> yep .. works
<ski> (funny how `ebml.mli' displayed just fine in w3m, though ..)
th5 has joined #ocaml
<thelema> I can't explain that.
<julm> ski: scrolldown
<ski> pardon ?
<julm> github uses a <td> that may fail to be well rendered in browsers
<ski> (w3m displays a blank page. looking at the page source, it is also completely blank)
<julm> ski: the code is within a single HTML line
hcube has joined #ocaml
_andre has joined #ocaml
nejimban has quit [Ping timeout: 250 seconds]
avsm has joined #ocaml
boscop has joined #ocaml
<kerneis> hi
<kerneis> I guess there is no (simple) solution but just in case:
<kerneis> anybody knows a way to compare floats up to some precision (this is easy) *and* automatically do the same thing for sum types containing floats?
<kerneis> s/compare/test equality/
jonathandav has quit [Remote host closed the connection]
<f[x]> write custom compare-like function in C (i.e. 'a -> 'a -> int)
eldragon has quit [Ping timeout: 245 seconds]
Yoric has quit [Read error: Connection reset by peer]
Yoric has joined #ocaml
<kerneis> f[x]: I'll keep that in mind, thanks
<kerneis> (in the meantime, this is target for ocaml newbies, so I'll avoid external for my current issue ;-)
jonafan__ has joined #ocaml
jonafan_ has quit [Ping timeout: 252 seconds]
<hcube> hello. do you know that is there anybody who is interested in or did some work on an llvm ocaml codegen backend?
<hcube> current arm codegen is too hardwired i think
<avsm> the hard bit isnt the codegen, it's hooking the GC in
<hcube> yes i know, but the ghc developers had same problems with llvm, and they solved them
<hcube> now ghc 7 has a working llvm backend
<avsm> ocaml has quite a different gc. i'm just pointing out that if you have problems with the arm backend, leaping over to llvm to solve it might not be the quickest solution
<avsm> it's solvable, but it would be a few months effort to get it right i expect
<f[x]> why do you think that llvm is better on arm then ocaml?
<f[x]> btw ocaml compiles on armel out of the box
avsm has quit [Quit: Leaving.]
avsm has joined #ocaml
<hcube> i had setup an arm debian in qemu, and try to install ocaml, but it was not out of the box
<hcube> llvm is more flexible
<hcube> but i agree that making a stable llvm backend is much more work than modify the ocaml arm backend
Amorphous has quit [Ping timeout: 276 seconds]
<f[x]> what error do you get?
Amorphous has joined #ocaml
<hcube> bytecode interpreter builded succesfully but there was a glib double free exception error when ocamlc compiled parser.ml
<hcube> but this solved when removed -O option from gcc flags
<hcube> the main problem came out when i tried to run the testsuite
<hcube> there is pemanent linking error with softfloats
<hcube> e.g. undefined reference to __multdf3
<f[x]> what version of ocaml?
<hcube> now i have checked debian arm packages and they does not support ocamlopt on arm (but they use 3.10 and 3.11)
<hcube> i tried 3.12
<f[x]> iirc arm is deprecated and everybody uses armel nowadays with new abi and it doesn't have thos floating point issues
<hcube> ok, does iphone uses armel?
<hcube> *use
* f[x] doesn't know
<hcube> ok, now i'll try to setup an armel debian in qemu and install ocaml manually
avsm has quit [Quit: Leaving.]
avsm has joined #ocaml
wuj has joined #ocaml
emmanuelux has joined #ocaml
explodus has quit [Ping timeout: 272 seconds]
avsm has quit [Quit: Leaving.]
explodus has joined #ocaml
nejimban has joined #ocaml
schme has joined #ocaml
joewilliams_away is now known as joewilliams
ski has quit [Read error: Connection reset by peer]
Elench` is now known as Elench
ski has joined #ocaml
ztfw has joined #ocaml
fraggle_laptop has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
mikemc has quit [Read error: Connection reset by peer]
mikemc has joined #ocaml
mcclurmc has joined #ocaml
rmitt_ has joined #ocaml
thieusoai has quit [Quit: Leaving]
thieusoai has joined #ocaml
Modius has joined #ocaml
ikaros has joined #ocaml
schme is now known as schmrkc
rmitt_ has quit [Ping timeout: 265 seconds]
th5 has quit [Quit: th5]
hcube has quit [Ping timeout: 255 seconds]
eldragon has joined #ocaml
fraggle_laptop has quit [Ping timeout: 245 seconds]
init1 has joined #ocaml
Yoric has quit [Quit: Yoric]
drunK has joined #ocaml
wuj has quit [Ping timeout: 265 seconds]
ttamttam has quit [Remote host closed the connection]
<adrien> btw, I grepped /usr/bin/ yesterday and found out that roughly 50% of the executables hardcoded paths to a subdirectory of /usr/ and most of these hardcoded paths to things other than /usr/lib* (so not rpath or similars)
<adrien> was just thinking about the issue there was with camomille's data
hcube has joined #ocaml
_andre has quit [Quit: leaving]
ulfdoz has quit [Ping timeout: 265 seconds]
ulfdoz has joined #ocaml
wuj has joined #ocaml
ftrvxmtrx has quit [Quit: Leaving]
<hcube> hey
<hcube> now ocaml really works on iphone
<hcube> i've showed the ocaml generated arm asm code and arm runtime (arm.S) to my arm specialist colleague who suggested that we have to insert some additional asm directives into arm.S and arm codegen
<hcube> when i tried the modified version everything get worked (correct arithmetics, multithreading, etc)
<adrien> you probably want to open an issue on caml.inria.fr/mantis (well, check there isn't one first)
Snark has quit [Quit: Ex-Chat]
<hcube> it's new thing. the problem was alignment related
init1 has quit [Quit: Quitte]
<hcube> and we also replace some old arm jump instructions in arm.S
<hcube> *replaced
<hcube> i'll send a patch soon, now i'd like to finish the app and test it first
<hcube> it would be nice to write 3d games in ocaml for iphone and ipad
RLa has joined #ocaml
ulfdoz has quit [Ping timeout: 245 seconds]
ztfw has quit [Remote host closed the connection]
ftrvxmtrx has joined #ocaml
yezariaely has joined #ocaml
yezariaely has left #ocaml []
bzzbzz has quit [Quit: leaving]
hyperboreean has quit [Ping timeout: 276 seconds]
hyperboreean has joined #ocaml
ftrvxmtrx has quit [Quit: Leaving]
ftrvxmtrx has joined #ocaml
eelte has joined #ocaml
boscop has quit [Read error: Connection reset by peer]
boscop has joined #ocaml
coucou747 has quit [Ping timeout: 272 seconds]
bzzbzz has joined #ocaml
rmitt has joined #ocaml
<RLa> is there a tool to produce the call graph as an image?
hcube has quit [Ping timeout: 276 seconds]
wuj has quit [Ping timeout: 265 seconds]
drunK has quit [Ping timeout: 255 seconds]
ikaros has quit [Quit: Leave the magic to Houdini]