ChanServ changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | http://www.ocaml.org | OCaml 4.01.0 announce at http://bit.ly/1851A3R | Logs at http://irclog.whitequark.org/ocaml
manizzle has quit [Ping timeout: 240 seconds]
tautologico has joined #ocaml
malo has quit [Remote host closed the connection]
zpe has joined #ocaml
BitPuffin has quit [Ping timeout: 255 seconds]
zpe has quit [Ping timeout: 250 seconds]
badon has quit [Ping timeout: 260 seconds]
badon has joined #ocaml
<tautologico> is camlp4 working with 4.02?
<whitequark> yes
<jpdeplaix> whitequark: I think there is a lot of parameter attributes missing :/
<whitequark> it compiles
<jpdeplaix> (like nonnull, inalloca, dereferencable)
<Drup> huh ? what are you talking about ?
<tautologico> how high is the probability that it will just be left to bitrot in the future? if ppx catches on I don't think there'll be a lot of incentives for maintaining it
<whitequark> Drup: llvm, apparently
<whitequark> jpdeplaix: that is possible
<Drup> whitequark: the transition was abrupt, to say the least :D
<whitequark> it will be easy to patch
<Drup> tautologico: It's going to stay in it's sate of only-maintenance for while I think
<Drup> so, no bitroting, but no innovation either
<Drup> (as today)
<whitequark> there are quite a few big codebases using camlp4 extensively
<whitequark> e.g. js
<Drup> I would have said jst, in fact.
<Drup> (jsoo is not going to be much of an issue)
<whitequark> jst, yes
<Drup> (oh, it was a typo for jst, no jsoo, my bad)
<flux> I wonder how long-lived will ppx turn out to be, ocaml language extension stories have not been very :P
<whitequark> ppx is in trunk
<flux> and I doubt for example coq is ever going to transfer from camlp4 to ppx..
<flux> I understand it's actually using it for creating a new language?
<Drup> well, it's easier to improve on ppx than on camlp4
<tautologico> coq uses camlp5 actually
<Drup> writing a ppx is *much* easier than writing a camlp4 extension
<flux> but ppx is not as powerful
<flux> the whole camlp4/5-thing was bad as well :(
<tautologico> yeah
<Drup> flux: well, a cuter is sometimes more useful than a shotgun.
<whitequark> hopefully camlp4 will die and camlp5 will remain only used by coq and the like
<tautologico> for full metaprogramming there's MetaOCaml
<Drup> flux: and don't forget about the revised syntax :D
<Drup> such a fabulous ideae
<Drup> idea*
<tautologico> it's a mess
<flux> I guess nobody uses that nowadays
<Drup> nobody ever used it, except to write camlp4 extensions
<flux> and you can't really port it to ppx in a useful fashion can you?-o
<whitequark> no
<whitequark> thankfully
<tautologico> someone should get the good parts and create a new OCaml, like X. Leroy did with "Heavy Caml" -> Caml light
<whitequark> Heavy Caml?
<tautologico> Caml "Heavy", the old CAML
<Drup> tautologico: bad idea
<Drup> tautologico: that's exactly what the guy behind the revised syntax had in mind, and it's a bad idea, because there are only two outcome to this kind of switch in a language already used
<Drup> 1) nobody switch, that's the good case
<Drup> 2) half the community switch, that's the very bad case
<Drup> <insert reference to python 3 here/>
<tautologico> F# managed to build a community, though probably because it's mainly comprised of Windows programmers
<Drup> do you know a lot of people in the F# community that are not frustrated C# programmers ?
<Drup> (except jon harrop but ....)
<Drup> basically, F# doesn't predate on ocaml programmers. also, I'm not sure how big it is.
<tautologico> yeah, that's what I was saying
<tautologico> Windows and OCaml don't mix well, so windows programmers wanting a ML will mostly use F#
<whitequark> fascinating, I'm reading on caml light
<whitequark> it seems ocamldebug hasn't changed since caml light.
<whitequark> at all
<Drup> indeed =')
<whitequark> ... or stdlib, for that matter
<whitequark> nearly
<tautologico> yes
<tautologico> that's something people complained about quite a lot... hence extlib, then batteries, core, etc
omqal has joined #ocaml
<tautologico> for quite a while INRIA's position on OCaml was "we're a research institution and OCaml is not research anymore, it's established technology, so we can't afford to spend too many resources on it"... which is understandable.
<whitequark> oh THAT is where Str comes
hhugo has quit [Quit: Leaving.]
<ruzu> ocaml was so exciting, then it fell off a cliff it seems like :p
<Drup> tautologico: I think inria made a huge mistake on this
<tautologico> yes, there was a time when Haskell hadn't yet got much traction and there was a lot of interest in OCaml... but OCaml was evolving glacially and INRIA couldn't really respond to the community's demands (that's not their role anyway)
<tautologico> Drup: I agree... although I understand their position, I think it was a lost opportunity
<tautologico> research is not only about creating new stuff, after all... impact is important
<Drup> that start to understand that, but they tend to do it through startups and stuff, which are equaly bad if you ask me
<ruzu> what about opam prevents it from working on windows?
<Drup> ruzu: nothing, it's just not done yet
<tautologico> according to the TIOBE index (I know, not a great indicator, but...) from last year to this year F# went up from #37 to #13... OCaml is in the 51-100 range (they say the difference between #51 and #100 is small so they just list the languages)
<tautologico> curiously, "ML" is #26 on the index :)
<Drup> proof that it's probably bullshit =°
<tautologico> and I don't believe OCaml is less used than D (#50), Modula-2 (#48) and Prolog (#46)
<whitequark> it's search engine popularity index
<whitequark> not usage index
<Drup> it doesn't prove something, however
<Drup> not enough buzz on ocaml =/
<Drup> it does*
penglingbo has joined #ocaml
<tautologico> I also don't think F# is more used than Ruby (#14)
<tautologico> yes
<tautologico> I follow some F# people on twitter and they create a lot of buzz about user groups, F# meetups, etc
<tautologico> whitequark: I know it's not about usage, but it's meant to be an indicator of that
<tautologico> from their site: "The TIOBE Programming Community index is an indicator of the popularity of programming languages."
omqal has quit [Quit: omqal]
<tautologico> there are 3x more github repos with OCaml as language than F#
<tautologico> but I guess Windows people still use that codeplex thing for open source software? I don't know
<Drup> urk, that horror
<Drup> tautologico: well, lot's of ocaml stuff are still on the inria forge too :p
<ruzu> i'm semi-windows, mostly due to work :3 if ocaml was a bit more beefy i could probably sneak it into the workplace
<ruzu> might be able to anyways
<tautologico> I'd like if OCaml had a better story on windows
<ruzu> hard to pry people from push-button-c# stuff if the other option's tooling is cranky
<tautologico> I've tried to push OCaml on students before and may do it again but not all of them use Unix/OS X
oriba has quit [Quit: oriba]
eikke__ has joined #ocaml
zpe has joined #ocaml
<flux> I can easily imagine how starting OCaml on Windows in is painful; if you are coming from Unix/Linux and you know OCaml, then you only have the environment to fight with, not Everything
<flux> and I think most OCaml-on-Windows-users are in the second category..
<Drup> (I started programming with ocaml, on windows :D)
<flux> you've since learned better?-)
<Drup> which part ? :p
<flux> still on windows?
<Drup> nope ;)
<tautologico> I used to program on Windows too, I just didn't know better
<ruzu> some people get paid to do it :P
<tautologico> it's a terrible OS for programming, unless you are paid money to do it
<tautologico> sure
<tautologico> well, it's still terrible for programming, but if your livelihood depends on it then you don't have a choice :)
<ruzu> i see they're using*nix build stuff like autoconf in opam
zpe has quit [Ping timeout: 240 seconds]
<ruzu> someone should make a portable camlconf :3
<tautologico> I think opam itself compiles on cygwin, but some important packages don't
<ruzu> hah, i just opened a cygwin term to try
<tautologico> even if you make opam completely portable lots of packages are not
<Drup> actually, a good amount of packages are portable
<tautologico> because most package authors live on unix, they use unix tools
<ruzu> does opam do any of the building logic or just run make?
<Drup> almost everything using oasis is
<tautologico> yes
<tautologico> but not everything uses oasis
<Drup> ruzu: a build script is given with the package
<tautologico> F# has this problem in reverse, it doesn't work so well on unix, but the F# people and the Mono people are working actively to improve this... they're also trying to convince library authors to build for cross-platform compatibility
<ruzu> $ ./configure
<ruzu> ./configure: line 16: $'\r': command not found
<ruzu> well, that was short :P
<Drup> ahah
<ruzu> interestingly line 16 is an empty line between two comments, i guess the cyg term may not be well configured
<Drup> (the portability over windows argument is the main reason why adrien is yelling some much about topkg :D)
<Drup> so* ~~
<tautologico> topkg?
<Drup> a packaging system
<Drup> (and if you know enough, you can guess the author just by the name)
<tautologico> right
<tautologico> I think I saw it a while a go but didn't understand well what it was trying to do, if it was just competing with oasis
<Drup> it's just competing with oasis
manizzle has joined #ocaml
<tautologico> yeah I don't see the point
englishm has joined #ocaml
eikke__ has quit [Ping timeout: 240 seconds]
englishm has quit [Remote host closed the connection]
zpe has joined #ocaml
tautologico has quit [Quit: Textual IRC Client: www.textualapp.com]
zpe has quit [Ping timeout: 255 seconds]
englishm has joined #ocaml
fold has joined #ocaml
jao has joined #ocaml
jao has quit [Changing host]
jao has joined #ocaml
izaak has joined #ocaml
zpe has joined #ocaml
zpe has quit [Ping timeout: 250 seconds]
q66 has quit [Quit: Leaving]
Algebr has joined #ocaml
<Algebr> What is the point of defining multiple rules in an ocamllex file?
jao has quit [Ping timeout: 264 seconds]
<Drup> this is roughly the same question as "why define multiple functions while you could inline everything ine one"
<Algebr> I don't see how that's similiar. Its not like you can like multiple rules running at the same time on a lex buffer
<Drup> no, but you can have one rule conditionally call another
ousado_ has joined #ocaml
ousado has quit [Ping timeout: 245 seconds]
izaak has quit [Ping timeout: 240 seconds]
thomasga has joined #ocaml
thomasga has quit [Client Quit]
zpe has joined #ocaml
Algebr has quit [Ping timeout: 272 seconds]
zpe has quit [Ping timeout: 250 seconds]
hhugo has joined #ocaml
hhugo has quit [Quit: Leaving.]
fraggle_laptop has joined #ocaml
izaak has joined #ocaml
<Drup> I must say, Zed is quite an underrated library in the ocaml ecosystem :O
<Drup> It lacks a manual to get in, but it's *very* nicely done
morphles has joined #ocaml
penglingbo has quit [Ping timeout: 245 seconds]
izaak has quit [Ping timeout: 250 seconds]
<rs0> "Zed is an abstract engine for text edition."
<rs0> just to be sure, i looked up "edition" in the dictionary to check for lesser-known uses
<rs0> but my best guess is that this is supposed to say "...for text editing"
<Drup> french false friend :p
<rs0> ah
axiles has joined #ocaml
badon has quit [Ping timeout: 272 seconds]
zpe has joined #ocaml
englishm has quit [Remote host closed the connection]
zpe has quit [Ping timeout: 255 seconds]
araujo has joined #ocaml
hhugo has joined #ocaml
izaak has joined #ocaml
angerman has joined #ocaml
izaak has quit [Ping timeout: 260 seconds]
_0xAX has joined #ocaml
hhugo has quit [Quit: Leaving.]
ggole has joined #ocaml
zpe has joined #ocaml
sandy1 has joined #ocaml
zpe has quit [Ping timeout: 240 seconds]
Hannibal_Smith has joined #ocaml
BitPuffin has joined #ocaml
keen___ has joined #ocaml
keen__ has quit [Ping timeout: 240 seconds]
BitPuffin has quit [Ping timeout: 240 seconds]
morphles has quit [Ping timeout: 240 seconds]
aymeric has joined #ocaml
aymeric has left #ocaml [#ocaml]
Kakadu has joined #ocaml
pyon has left #ocaml ["ERC Version 5.3 (IRC client for Emacs)"]
Simn has joined #ocaml
izaak has joined #ocaml
izaak has quit [Ping timeout: 240 seconds]
ygrek has joined #ocaml
_0xAX has quit [Remote host closed the connection]
zpe has joined #ocaml
zpe has quit [Ping timeout: 245 seconds]
ygrek has quit [Ping timeout: 240 seconds]
Hannibal_Smith has quit [Quit: Sto andando via]
morphles has joined #ocaml
zarul has quit [Ping timeout: 245 seconds]
BitPuffin has joined #ocaml
izaak has joined #ocaml
BitPuffin has quit [Ping timeout: 264 seconds]
ski has quit [Quit: Lost terminal]
BitPuffin has joined #ocaml
izaak has quit [Ping timeout: 272 seconds]
zpe has joined #ocaml
morphles has quit [Ping timeout: 245 seconds]
zpe has quit [Ping timeout: 256 seconds]
penglingbo has joined #ocaml
pminten has joined #ocaml
eikke__ has joined #ocaml
izaak has joined #ocaml
angerman has quit [Quit: Gone]
izaak has quit [Ping timeout: 240 seconds]
angerman has joined #ocaml
rand000 has joined #ocaml
hhugo has joined #ocaml
eikke__ has quit [Ping timeout: 264 seconds]
Anarchos has joined #ocaml
angerman has quit [Quit: Gone]
BitPuffin has quit [Ping timeout: 264 seconds]
morphles has joined #ocaml
zpe has joined #ocaml
morphles has quit [Ping timeout: 250 seconds]
tane has joined #ocaml
eikke__ has joined #ocaml
yacks has quit [Ping timeout: 255 seconds]
izaak has joined #ocaml
BitPuffin has joined #ocaml
izaak has quit [Ping timeout: 260 seconds]
ggole_ has joined #ocaml
ggole has quit [Ping timeout: 240 seconds]
morphles has joined #ocaml
sad0ur has quit [Quit: leaving]
ebzzry has quit [Remote host closed the connection]
pminten has quit [Remote host closed the connection]
ebzzry has joined #ocaml
al-maisan has joined #ocaml
Denommus has quit [Ping timeout: 250 seconds]
dsheets has joined #ocaml
<Leonidas> https://github.com/eatnumber1/goal fun challenge
<Leonidas> but kinda no idea how to solve it in ocaml
dawidtoton1 has joined #ocaml
<mrvn> you would need camlp4 for that
<dawidtoton1> I need a list of (exists 'a. (foo -> 'a) -> (
<dawidtoton1> I need a list of (exists 'a. (foo -> 'a) -> ('a list -> bar)) - how do I get this in ocaml?
<mrvn> replace () with an optional GADT argument so that it internally counts the "o" and returns itself
<mrvn> dawidtoton1: that makes no sense
izaak has joined #ocaml
<mrvn> you can make such a list but you can't use it other than counting its length.
<dawidtoton1> What about List.map (fun (f1, f2) -> f2 [f1 bar1; f2 bar2]) items ?
<dawidtoton1> Do I get my quantifier wrong?
<Leonidas> mrvn: yes, I think there is no other way, since it requires constructor calls :-/
<Leonidas> g (O ()) (O ()) (Finish "al") is the best I could come up with
<dawidtoton1> I'm sorry I mistyped the pair: what I want is (exists 'a. (foo -> 'a) * ('a list -> bar))
<Leonidas> mrvn: oh, ok, I haven't thought of that. interesting.
<mrvn> dawidtoton1: then 'a == bar in your abvove code
<mrvn> Leonidas: using cps?
<dawidtoton1> I hoped to get there with a record wrapper, but it seems that I can have only (forall 'a. (foo -> 'a) * ('a list -> bar)), which is not useful, I think
contempt has quit [Ping timeout: 250 seconds]
<mrvn> dawidtoton1: since the result of f2 is part of the list the 'a == bar
<Leonidas> mrvn: so far it doesn't work completely, so I was asking here if there was a really simple solution I may have missed :)
izaak has quit [Ping timeout: 240 seconds]
<mrvn> SO there exist an 'a, namely bar and only bar
<mrvn> Leonidas: what doesn't work? Should work fine with cps style
<dawidtoton1> I see, I made quite few mistakes, thanks
contempt has joined #ocaml
<dawidtoton1> So I need a list of ((foo -> 'a) * ('a list -> bar)) but each element has different 'a, and I need to compose ('a list) pieces of data in a function which doesn't know 'a - is this possible?
<Armael> hmm, i'm looking at ocaml-top
<dawidtoton1> So the [f1 bar1; f1 bar2] list shuold be ('a list) made of different pieces of bar, but for each pair (f1, f2) these 'a could be different things
<Armael> is there a way to achieve similar feature as the ~/.ocamlinit with it?
<Armael> for example to automatically have #require "topfind"
<Armael> #use "topfind" *
<Armael> (and thus be able to #require things)
George_ has joined #ocaml
BitPuffin has quit [Ping timeout: 255 seconds]
<dawidtoton1> For example I had "type fol = {a : 'a. (unit -> 'a) * ('a list -> unit)}" and hoped to assign (fun () -> 1), (fun [1] -> ()) to it, but the quantifier seems wrong
contempt has quit [Remote host closed the connection]
contempt has joined #ocaml
BitPuffin has joined #ocaml
BitPuffin has quit [Read error: Connection reset by peer]
<mrvn> dawidtoton1: so given a foo list you want to map that to 'a list and then bar?
<mrvn> You can make a list of tuples of such functions by nesting 2 records with existentials. But much simpler would be to combine the f1 and f2 to give (foo list -> bar) and make a list of those functions.
miko has joined #ocaml
<ggole_> Leonidas: you can do it nicely by changing the syntax a bit, or horribly with Obj.magic
pango has quit [Ping timeout: 264 seconds]
<miko> I don't know much about Ocaml; I however want to build a programm written in it. There are serveral instances where it depends on zlib, and this causes a error message. I get "Unbound module Zlib", how do i fix this?
<dawidtoton1> Yes, but at the point (foo -> 'a) are constructed, the function doesn't know how many elements the list will have, it is much later some foo are produced and combined fo 'a list
ggole_ is now known as ggole
<miko> The libz development package (for c) is installed
<Leonidas> ggole: maybe I should do that, but that would probably eat the rest of the day (nerdsniping) and I have exams :(
<Leonidas> miko: did you install ocamlzip?
<dawidtoton1> miko: then you need OCaml bindings for zlib installed
<ggole> I put a solution up on the reddit thread if you're interested
<Leonidas> ggole: Awesome. You could contribute it directly to the repo, for all to see :-)
<miko> am install libz?
pminten has joined #ocaml
<miko> opam install libz?
<Leonidas> miko: opam install camlzip
<Leonidas> or install it from your distributions package manager, it is pretty commonly packaged :)
eikke__ has quit [Ping timeout: 260 seconds]
<Leonidas> ggole: Reading your solution. WAT :-)
<ggole> Yeah, don't do that.
<ggole> I can't see any other way to match the solution char for char, though.
<Leonidas> "This kills the type"
eikke__ has joined #ocaml
<Leonidas> I wonder if this would be possible with ppx?
<ggole> Passing arguments of the wrong type would indeed be more fun than desired.
<miko> Ok, libz is installed by OPAM, that seems to have been successfull, the library however is still not found.
<Leonidas> I have to admit that I like the Haskell solution quite a bit :)
<miko> *camlzip
<Leonidas> miko: did you load it?
<dawidtoton1> miko: I would look for a file like zlib.mli first on your system, like e.g. /usr/lib/ocaml/zip/zlib.mli
<Leonidas> miko: un utop: #require "zip";; and then open Zlib works.
<Leonidas> (I just wish utop was a little less ugly looking)
<mrvn> Leonidas: you don't even need camlp4 with Obj.magic
<mrvn> (truely evil misuse of Obj.magic)
<ggole> That's pretty close to my evil solution.
<Leonidas> yep
<Leonidas> TIL: the Obj.repr of unit is int.
<ggole> All nullary constructors, really.
<mrvn> Leonidas: () is encoded as 0
<ggole> Check out the RWO chapter on representations sometime, it makes for very interesting reading.
<ggole> (Not today, if you have exams.)
<mrvn> Leonidas: I could have checked for is_block and string_tag instead
<Leonidas> ggole: I told my library to order a paper copy of RWO last week, they are on it :)
eikke__ has quit [Ping timeout: 272 seconds]
<Leonidas> supporting book authors and publishers with tax money :)
* ggole thumbs up
<ggole> It's online though, so you could just read it there.
<jerith> I have a problem I'm struggling with enough that I'm pretty sure I'm doing something wrong.
<Leonidas> I know, I also added some comments. But for reading front to back, I kinda like paper more.
<mrvn> ggole: obviosuly one reads it there too
<dawidtoton1> So could anybody tell me what quantifier sits in "{a : 'a. (unit -> 'a) * ('a list -> unit)}" ? I'm confused now.
<jerith> The background is that I'm writing an AMQP client, which will involve generaitng a bunch of code from an XML spec.
<Leonidas> found a (very minor) typo yesterday, turns out it seems to be in the print version as well.
<jerith> The generated code needs to include a type (record full of field values) and wire-format marshalling functions.
<jerith> I'm using a description module (which defines the type and field information) and a functor that builds a module containing the marshalling code.
<jerith> That's working for me so far, except I can't find a way to expose the type from the module.
<ggole> dawidtoton1: universal quantification, eg, 'a . <typeexpr> is basically forall a . <typeexpr>
<jerith> I have a polymorphic variant type (defined after all the generated modules) that includes an entry for each module.
<dawidtoton1> mrvn: could you possibly give me a hint what would be the second record wrapper for "type fol = {a : 'a. (foo -> 'a) * ('a list -> bar)}" you mentioned?
<jerith> I can't find a way to have each module return its own subset of that, though.
<ggole> jerith: so you have a module A "return" `A, B return `B, etc?
dsheets has quit [Ping timeout: 255 seconds]
fraggle_laptop has quit [Remote host closed the connection]
<ggole> And at the end, type module_tag = [`A | `B | ...]?
q66 has joined #ocaml
<jerith> ggole: [`A of A.t | `B of B.t | ...], but otherwise yes.
izaak has joined #ocaml
<ggole> That should work
<jerith> A.build_thing returns `A A.t or whatever.
<ggole> For a module A producing `A of int, give it a return type of [`A of int]
eikke__ has joined #ocaml
<ggole> And if you like can "glue" all the module types together to make the resulting variant: type module_tag = [A.t | B.t | ...]
<ggole> Er, if you name the variant types, that is.
yacks has joined #ocaml
shinnya has joined #ocaml
araujo has quit [Quit: Leaving]
araujo has joined #ocaml
izaak has quit [Ping timeout: 256 seconds]
eikke__ has quit [Ping timeout: 260 seconds]
<jerith> ggole: I can't seem to expose that polymorphic variant type through the module interfaces.
<miko> Ok, i installed utop (and with it plenty of other packages that i already installed via the os package manager). #require "zip";; seems to work in utop, the build still fails with "Unbound module Zlib".
<jerith> miko: How are you building?
<miko> I want to build Patoline, it as it's own make file.
<miko> *has
<ggole> jerith: I imagine you'll want to expose bits of it per module, like this https://gist.github.com/gsg/e9e5fcf45b755b7d6700
<Armael> miko: did you re-run the configure script?
<Armael> (it should say that he detected camlzip)
<Armael> it*
<jerith> ggole: I'm not sure how to expose that through the abstract interfaces I'm using with my functor.
<miko> Oops.
<Armael> :)
<miko> No, I didn't
<miko> thanks
* jerith ponders.
<ggole> Oh, a functor :/
rand000 has quit [Quit: leaving]
<ggole> Erm, good question
<jerith> I could probably skip the functor and just generate the modules I want directly, but I think it's cleaner to use a functor.
<mrvn> Can ctypes create a C callback for an ocaml function?
ygrek has joined #ocaml
<dawidtoton1> Thanks. I found a solution, it looks like I have to 'eliminate a translucent existential'
dawidtoton1 has quit [Quit: leaving]
<Leonidas> and now I am building 4.02 just to find a solution with ppx %)
hhugo has quit [Quit: Leaving.]
eikke__ has joined #ocaml
darkf has quit [Quit: Leaving]
angerman has joined #ocaml
hhugo has joined #ocaml
<Leonidas> whitequark: do I understand it correctly that ppx needs to have a proper typesafe input caml code?
<whitequark> Leonidas: no
<whitequark> ppx needs syntactically correct code, that is all
<Leonidas> oh, ok.
Algebr has joined #ocaml
<mrvn> whitequark, Drup: I'm stuck trying to pass a reference. Tips? http://paste.debian.net/111935/
<whitequark> mrvn: you need to allocate a pointer via ctypes
<mrvn> whitequark: I can't take the address of a ocaml value?
<whitequark> no
<whitequark> even if you could, it's pointless for integers
<whitequark> because of ocaml's integer representation
<mrvn> seems like something like that should be possible. At least for nativeint
<whitequark> that's not implemented
<whitequark> and I don't see a point anyway
pango has joined #ocaml
izaak has joined #ocaml
<mrvn> whitequark: That then gives me: http://paste.debian.net/111938/
<whitequark> sounds about right
<mrvn> ZMQ version 4.1.0
<mrvn> Passes the test. :)
<mrvn> thx
pango has quit [Ping timeout: 240 seconds]
<mrvn> In general shouldn't "ref" be usable as ptr?
<whitequark> no
pango has joined #ocaml
<whitequark> it can be moved
angerman has quit [Remote host closed the connection]
<mrvn> sure. but didn't you solve that problem for strings?
izaak has quit [Ping timeout: 250 seconds]
angerman has joined #ocaml
<whitequark> no
<whitequark> they still can be moved
pango has quit [Remote host closed the connection]
<whitequark> it's just that for strings, the added unsafety and complexity is overweighted by the benefit
<mrvn> From the pull request you pasted yesterday it sounded like now ctypes saves the ocaml value in an array and then only takes the address once it is on the C side and the GC can't get invoked anymore.
<whitequark> no, that's how the usual "string" works, not "ocaml_string"
<whitequark> "string", abstract types, allocations, etc, etc
<whitequark> but "ocaml_string" bypasses all that
mcclurmc has joined #ocaml
huza has joined #ocaml
Algebr has quit [Read error: Connection reset by peer]
pminten has quit [Quit: Leaving]
slash^ has joined #ocaml
angerman has quit [Ping timeout: 240 seconds]
morphles has quit [Ping timeout: 245 seconds]
topher has joined #ocaml
topher has left #ocaml [#ocaml]
angerman has joined #ocaml
eikke__ has quit [Ping timeout: 240 seconds]
* jerith gives up on the functor-based approach and starts figuring out how best to do the directly-generated modules.
angerman has quit [Remote host closed the connection]
angerman has joined #ocaml
izaak has joined #ocaml
<jerith> Actually...
huza has quit [Quit: WeeChat 0.3.8]
* jerith tries again, this time using the functor to build a module to include rather than a replacement.
George_ has quit [Ping timeout: 246 seconds]
<jerith> Actually, that's not going to help me.
manizzle has quit [Ping timeout: 260 seconds]
<jerith> I think I've figured out where I'm going wrong, but not how to go right.
<jerith> In the code that's calling the functions in my module, I don't know (or care, ideally) which module I have.
<jerith> So I have no way to get at type information specific to individual modules.
<whitequark> ... I just discovered this in hash.c
<whitequark> case Forward_tag: /* PR#6361: we can have a loop here, so limit the number of Forward_tag links being followed */
<whitequark> does this mean that depending on heap state, polymorphic hash can return different values? O_o
<jerith> whitequark: I implemented hashing over mutable data structures in Topaz.
<jerith> (Topaz being a Ruby implementation.)
<whitequark> yes, I know! it's neat
<jerith> It's probably the most terrifying code I've ever written.
<jerith> It never got merged because nobody could understand it. :-/
<whitequark> huh
<jerith> (That was about the time the project started losing momentum for various reasons, which is probably a contributing factor.)
<whitequark> ohh, no, Forward_tag and Lazy_tag are for lazy
<whitequark> jerith: why did it lose momentum?
<whitequark> it seemed promising
<jerith> whitequark: I think the maintainers were busy with other things, mostly.
<jerith> It seems to be picking up a little now.
<jerith> There are commit messages in the IRC channel, at least.
dsheets has joined #ocaml
<jerith> I was only working on it because it seemed interesting. I don't really have any need for Ruby.
thomasga has joined #ocaml
<jerith> Back to my AMQP code, I think I'm going to have to generate a big wrapper function that knows about all the different modules for each thing I want to do with the data. :-/
izaak has quit [Ping timeout: 250 seconds]
angerman has quit [Ping timeout: 272 seconds]
angerman has joined #ocaml
* jerith tries that.
ygrek has quit [Ping timeout: 245 seconds]
thomasga has quit [Quit: Leaving.]
Guest81403 has joined #ocaml
<jerith> Or maybe I want a locally abstract type, now that I've remembered that they exist.
Guest81403 is now known as lostman_
tane has quit [Quit: Verlassend]
slash^ has left #ocaml [#ocaml]
thomasga has joined #ocaml
leowzukw has joined #ocaml
leowzukw has quit [Quit: leaving]
thomasga has quit [Quit: Leaving.]
leowzukw has joined #ocaml
izaak has joined #ocaml
caseyjames has joined #ocaml
<caseyjames> hi. I'm struggling to get consistent OCaml coloring in gnu emacs. I can run Mx global-fontlock enable which will colorize most of the code but as I scroll things go back to black and white. Here is the init https://gist.github.com/caseybasichis/64ccf8eec991e5ff1cf5
angerman has quit [Ping timeout: 256 seconds]
angerman has joined #ocaml
<mrvn> whitequark: How do I pass an intnat to a function and how do I say the function returns a Bigarray.Array1.t?
shinnya has quit [Ping timeout: 264 seconds]
caseyjames has quit [Ping timeout: 246 seconds]
<mrvn> A lot of code just to get a the data of a message: http://paste.debian.net/112020/
hhugo has quit [Quit: Leaving.]
<whitequark> your point being?
<mrvn> Nothing. Just wanted to share since you (the channel) where interested in how to allocate a bigarray from existing data.
<whitequark> ah, I see
tane has joined #ocaml
angerman has quit [Remote host closed the connection]
madroach has quit [Quit: leaving]
angerman has joined #ocaml
angerman has quit [Ping timeout: 240 seconds]
dsheets has quit [Ping timeout: 272 seconds]
angerman has joined #ocaml
leowzukw has quit [Quit: leaving]
tautologico has joined #ocaml
thomasga has joined #ocaml
caseyjames has joined #ocaml
_0xAX has joined #ocaml
morphles has joined #ocaml
eikke__ has joined #ocaml
izaak has quit [Ping timeout: 240 seconds]
NoNNaN has quit [Remote host closed the connection]
tautologico has quit [Quit: Textual IRC Client: www.textualapp.com]
NoNNaN has joined #ocaml
<Drup> mrvn: I would avoid foreign inside a function call, if I were you
<whitequark> foreign is dlopen
<whitequark> mrvn: but, if you do it in a function call and not a module, you lose cstubs integration
tane has quit [Quit: Verlassend]
<Drup> and it redo the dlopen everytime the function is called, instead of doing it "statically" once
<whitequark> oh, right, that's stupud
<Drup> yes :p
<ggole> That sounds pretty cheap.
<ggole> ...
<Drup> caseyjames: http://bpaste.net/show/IDRSd3AnT3Pr2fb0ax7Y/ what I have in my .emacs
<ggole> I don't think recent emacsen need anything at all to get font-lock working fairly well.
<Drup> just loading tuareg correctly
eikke__ has quit [Ping timeout: 256 seconds]
<caseyjames> Drup: I get this error: File mode specification error: (file-error "Cannot open load file" "no such file or directory" "tuareg") Making completion list...
<caseyjames> also does anyone here use Merlin?
<Drup> caseyjames: you probably have a path issue
<Drup> you're on mac ?
<caseyjames> Yes
<caseyjames> Taureg mode was working with the other script, it just that the coloring was acting erractically
<Drup> that's ... weird.
<Drup> I don't know a thing about mac, and I think it's a path or instalation issue so, sorry :(
<caseyjames> toggling global-fontlock twice on a file seems to get the whole thing colorized
<caseyjames> thanks anyway
<caseyjames> do you know anything about Merline?
<caseyjames> Merlin rather
<Drup> sure
<Drup> there are instructions on their wiki
<ggole> caseyjames: start an emacs -Q and load (just) tuareg and see if the problem persists
<caseyjames> I know, I'm trying to figure out how I specify a root directory for the project. How do I load a specific .merlin
<ggole> merlin will search for it.
<jerith> caseyjames: I think it just walks up the path until it finds one.
<ggole> By walking up the... yea
<ggole> caseyjames: on an unrelated note, your auto-mode-alist entries should probably end with \\' (or at least $)
<mrvn> Urgs, what is this? Fatal error: exception Static.Unsupported("Unsupported return type")
<mrvn> Raised at file "string.ml", line 172, characters 25-34
<mrvn> Called from file "string.ml", line 195, characters 13-32
<caseyjames> -Q switches into Taureg but doesn't fix the color issue
<Drup> caseyjames: what is your emacs version ?
<caseyjames> 24.4.5
<mrvn> Seems like I can't have a function returning a bigarray.
<mrvn> Ideas how to rewrite http://paste.debian.net/112037/ so it works?
<ggole> caseyjames: hmm. :(
<ggole> Are you still getting the "cannot open" thing?
<whitequark> mrvn: how would you return a bigarray from C?
<whitequark> you can't return length and size at once.
morphles has quit [Ping timeout: 255 seconds]
<whitequark> oh, I see your paste
<whitequark> open a ctypes issue
<caseyjames> Well, I switched back to the init.el file so it working again. I gotta run back to my house be back in 5 min
caseyjames has quit [Ping timeout: 246 seconds]
<mrvn> whitequark: I want to return an ocaml value as is.
<whitequark> yep, ctypes doesn't have support for that
<ggole> So he has a working config after all? O_o
<whitequark> but, it's easily added
ygrek has joined #ocaml
penglingbo has quit [Ping timeout: 245 seconds]
caseyjames has joined #ocaml
BitPuffin has joined #ocaml
<mrvn> whitequark: For a quick hack what if I say it returns voidp and Obj.magic that to Bigarray?
<Drup> you love your Obj.magic way too much, mrvn x)
<ggole> Cmon, it's the best
<mrvn> Fatal error: exception Dl.DL_error("/home/mrvn/src/ocaml-zmq/ocaml-tzmq/_build/test/test.native: undefined symbol: caml_ba_alloc_dims")
<mrvn> :((
<mrvn> % objdump -t _build/test/test.native | grep caml_ba_alloc_dims
<mrvn> 00000000004469c9 g F .text 00000000000000a0 caml_ba_alloc_dims
<whitequark> mrvn: no, Obj.magic won't work there
<whitequark> hm
<whitequark> wrong args to dlopen
<mrvn> Why doesn't it find that symbol?
<whitequark> try playing with that
<whitequark> and determine which flags you need
gargaml has joined #ocaml
pyon has joined #ocaml
BitPuffin has quit [Ping timeout: 240 seconds]
oriba has joined #ocaml
BitPuffin has joined #ocaml
oriba_ has joined #ocaml
WraithM has joined #ocaml
oriba has quit [Ping timeout: 255 seconds]
eikke__ has joined #ocaml
squiggnet has quit [Ping timeout: 260 seconds]
hhugo has joined #ocaml
angerman_ has joined #ocaml
angerman_ has quit [Client Quit]
rand000 has joined #ocaml
angerman has quit [Ping timeout: 260 seconds]
englishm has joined #ocaml
George_ has joined #ocaml
<George_> I am trying to define an exeption in this way: exception e = mymodule.e' where "exception e'" is defined in mymodule
<George_> it looks that it is not possible, is there any way to do that?
<whitequark> it is not
<whitequark> what do you want to achieve?
maattdd has joined #ocaml
<George_> I have a functor with a module mymodule constructed from its parameter
<George_> I want to catch the exception that my module throws
<George_> mymodule
thomasga has quit [Quit: Leaving.]
<George_> any suggestion?
<whitequark> try .. with Mymodule.E' -> ... ?
<George_> let me make it more clear
troydm has quit [Ping timeout: 250 seconds]
<George_> assume that I have a functor "func", which accepts module "f" as its parameter, and builds "mymodule" using "f". That is, there is a definition "module mymodule = ...(f)" inside func
<George_> mymodule throws exception e'
dsheets has joined #ocaml
<George_> now, I create a module "m = func f", and I would like to catch the exception e'
tautologico has joined #ocaml
<whitequark> you'll either have to expose mymodule in the signature of func, or re-raise it inside the implementation of func
<gargaml> hi
<George_> let me see if the first suggestion works
<gargaml> does anyone know if it is possible to force the installation of a package with opam ?
<Drup> "opam install foo" ?
manizzle has joined #ocaml
hellome has joined #ocaml
<gargaml> yeah but for instance camlp5 is not ready for 4.02 trunk
<whitequark> then it will not install
jao has joined #ocaml
jao has quit [Changing host]
jao has joined #ocaml
<gargaml> and no way I can force it ?
<whitequark> it will not compile.
<gargaml> ok
<George_> how can I expose my module in the signature?
<Drup> George_: module F : ...
<George_> I may be doing it wrong
hellome has quit [Remote host closed the connection]
<Drup> gargaml: if you really want to, dl the source of camlp5 and pin it, opam should accept it
<Drup> but I'm pretty sure camlp5 will not compile on 4.02
hellome has joined #ocaml
<gargaml> Drup: ok, thanks
WraithM has quit [Ping timeout: 255 seconds]
<Drup> George_: there are two usual solution in this kind of situation, "module Func (F : S) = struct include F .... end
<Drup> or "module Func (F : S) = struct module F = F .... end"
<ggole> Or declare the exception outside the module (if types allow it)
maattdd has quit [Ping timeout: 245 seconds]
WraithM has joined #ocaml
englishm has quit [Remote host closed the connection]
<mrvn> In ocaml I have a "void ptr" returned from some function and in a C stub I need the address that points to. What's the best way to get that? I don't seem to grok the memory representation of a void ptr.
<orbitz> is it taht you have a C API that just hands void*'s around and you want to hold on to it?
<orbitz> does ctypes support this?
_0xAX has quit [Remote host closed the connection]
<George_> Thanks Drup, is what you wrote the module declaration in the signature?
<George_> I have the definition of the module, but would like to expose it into signature
sad0ur has joined #ocaml
<George_> so, I can refer to the exception
<mrvn> orbitz: I have a C API that gives me a void* and size to a block of data and I want to put that into a Bigarray
WraithM has quit [Ping timeout: 250 seconds]
maattdd has joined #ocaml
<mrvn> George_: compile the module with ocamlc -i and paste the output into module.mli
<Drup> George_: for the second choice, "module Func (F : S) : sig module F : S .... end with module F = F
<Drup> mrvn: no.
<orbitz> mrvn: do you know the type of the block of data?
<Drup> George_: for the first choice "module Func (F : S) : sig exception bla = Truc .... end"
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
<mrvn> orbitz: could be anything. I'm going for an uint8 arrays currently.
<Drup> be aware that with the seconde choice, the exceptions F.e and Func(F).e will be distinct
<Drup> (I think)
<orbitz> then onceptually you can just cast teh void* to a uint8_t*
<tautologico> if he just wants to expose an exception, why use a functor?
<George_> so, the first is a better choice for me, since I would like them to be the same
<Drup> probably
<Drup> hum
<Drup> with the first choice*
<mrvn> orbitz: and that helps me how?
<Drup> mrvn: https://github.com/Drup/ocaml-lmdb/blob/master/src/lmdb.ml#L208 here's how I do it, except I'm using a string, not a big array
<companion_cube> hmmm whitequark, you discovered the future of parsers?
<mrvn> Drup: you are copying the data. I need a Bigarray OF the data.
<Drup> oh, right
<mrvn> But I figured it out.
<whitequark> companion_cube: apparently
<Drup> companion_cube: ?
<companion_cube> whitequark: kudos if you make a small parser generator with it, that handles non-blocking input :)
<whitequark> maybe
<mrvn> Drup: void ptr is a "'a cptr = {reftype : 'a typ; raw_ptr : Ctypes_raw.voidp; ... } and Ctypes_raw.voidp is an Int32 or Int64 containing the actual address.
<Drup> "it seems to be efficient in practice; and that it should eventually be efficient in theory too" <3
jeroud has joined #ocaml
<mrvn> would have been nicer with Nativeint.
<whitequark> so much performance masturbation in here
<mrvn> ZMQ version 4.1.0
<mrvn> send 'Hello'
<mrvn> recv 'Hello'
<mrvn> jippey.
<orbitz> are you making your own zmq bindings?
<jerith> mrvn: \o/
<companion_cube> whitequark: well performance does matter for a parser :)
<whitequark> companion_cube: talking about mrvn's zmq thing
morphles has joined #ocaml
<Drup> to avoid a copy :p
<companion_cube> :D
<whitequark> well, not copying message data *is* the key to zmq performance, it matters significantly
<whitequark> the rest is what I said above
<whitequark> the primary objective for *any* binding is readability, because it's tricky non-memory-safe code
<whitequark> granted, ocaml-zmq doesn't score high on that too
<orbitz> does ocaml-zmq do a lot of copying?
<whitequark> it copies message daya
<whitequark> data*
<mrvn> orbitz: not if you tell it not to
<orbitz> mrvn: are you modifying ocaml-zmq or find it lacking somehow?
<mrvn> orbitz: I'm rewriting it
<Drup> err
<orbitz> is the API poor or is there some deeper flaw?
<mrvn> orbitz: I'm writing a thin binding with Ctypes and full bindings on top of that.
<whitequark> orbitz: the insides of ocaml-zmq are gnarly
<whitequark> rewriting it is not a bad idea
<mrvn> orbitz: seemed like a good example to learn Ctypes.
<orbitz> mrvn: sounds reasonable
<Drup> "gnarly" didn't know that word
<mrvn> I can now send and receive messages over a socket:
<mrvn> Totals grouped by language (dominant language first):
<mrvn> ml: 5839 (99.29%)
<mrvn> ansic: 42 (0.71%)
<mrvn> Not sure if that counts as success
<orbitz> what's the C code doing?
<whitequark> mrvn: HOW MUCH ml lines?!
<whitequark> six thousand?
<mrvn> orbitz: create a bigarray for a void* + size.
<whitequark> the whole ocaml compiler is smaller than that
<mrvn> Original ocaml-zmq is only ml: 6057 (90.92%) ansic: 605 (9.08%)
<whitequark> are you counting oasis in?
<mrvn> args, yes
oscar_ has joined #ocaml
<mrvn> it counds the myocamlbuild.ml and the _build dir too
<Drup> huh, how large is the compiler ?
<mrvn> Let me redo that in src/: ml: 437 (95.41%) ansic: 21 (4.59%) vs. original: ansic: 605 (61.48%) ml: 379 (38.52%)
<orbitz> those numbers sound nicer
maattdd has quit [Ping timeout: 255 seconds]
<whitequark> okay no, the compiler is bigger
<orbitz> My Raft implementation is almost ready for some testing
<whitequark> $ sloccount asmrun/ asmcomp/ byterun/ bytecomp/ stdlib/ otherlibs/ parsing/ typing/
<whitequark> ml: 74419 (68.10%)
<whitequark> ansic: 31460 (28.79%)
<whitequark> asm: 3385 (3.10%)
<Drup> yeah ...
<Drup> 6000 sounded really small
<mrvn> 1798 8638 64757 src/ZMQ.ml
<mrvn> Lots and lots of comments
<whitequark> Drup: I merged Enum and Bounded
<whitequark> they basically do same thing
<Drup> oh, cool
<Drup> not surprised
<whitequark> now doing Iter, Map and Fold
<mrvn> I need to split that file
<whitequark> because that's simple
<Drup> until you try to map/iter/fold over negative instances
<whitequark> and reading sexplib source causes heartburn to me
<whitequark> Drup: wtf is a negative instance?
<Drup> type 'a foo = 'a -> int
<whitequark> ...
<whitequark> I error out on functional values
<Drup> :D
<whitequark> who would want *that*?
<Drup> I've seen valid use cases.
<whitequark> -ENOTHASKELL
<Drup> ahah xD
<mrvn> whitequark: FYI my design should allow receiving messages, getting a bigarray of that data part, using zmq_msg_gets on the message, dropping the message from scope, running the GC and the bigarray should remain valid.
<Drup> I said valid, not simple :3
<whitequark> well, you're welcome to contribute support for that
<whitequark> mrvn: I figured
<whitequark> it'll play very well with my new sodium design
<whitequark> which is based around Bigstrings
<orbitz> what's sodium?
<whitequark> (Bigstring is a nicer name for a Bigarray.Array1 of char
<whitequark> nacl bindings
<orbitz> ah of course
<mrvn> whitequark: the zero-copy approach has one problem though. You can make a bigarray, create a msg for it, send it over inproc://, recv the msg, make a bigarray out of it and then modifying the original bigarray changes the other too.
<Drup> urk
<Drup> that's ugly
<mrvn> It's zero-copy.
<whitequark> mrvn: that's very bad
<whitequark> because when one of them is freed, the other is freed too, I think
<orbitz> so is the idea you just have a big pool of these Bigstring's taht the zmq bindins allocate on startup
<whitequark> the storage
<whitequark> orbitz: no
<whitequark> you make a bigstring around zmq's internal buffer
<whitequark> and pass it around
<orbitz> ok
madroach has joined #ocaml
<Drup> I think zero-copy would be terrible for lmdb anyway since : "Values returned from the database are valid only until a subsequent update operation, or the end of the transaction. Do not modify or free them, they commonly point into the database itself."
<mrvn> whitequark: No. that part needs to work.
* Drup is not interested anymore
<whitequark> mrvn: huh?
<whitequark> oh, on the other hand, zmq_msg_t are refcounted and own the buffer
<whitequark> so it will probably be fine
<mrvn> whitequark: sending a message takes over ownership of the buffer so the bigarray does not free it when it gets out of scope.
<orbitz> sounds like you need some linear types!
<oscar_> If any of you have a minute or two, can you offer some clarification on the following from 'OCaml from the Very Beginning': 'Clearly append (h :: t) b is equal to h :: append t b.' To me, the former will recurse infinitely, which is very different from the latter. For full context: http://pastebin.com/yM49rHyf
<mrvn> whitequark: you are half right. When the receving bigarray and msg and sending msg go out of scope the sending bigarray breaks I think. Need to check and fix that.
<companion_cube> Drup: by what?
<mrvn> I need to increment the refcount in the sending message for the bigarray and drop it in Gc.finalise
<whitequark> mrvn: check whether zmq increases the refcount itself
shinnya has joined #ocaml
<Drup> companion_cube: the zero-copy approach to get the value from a struct containg pointer to data + size
<tautologico> oscar_ why do you think append (h :: t) b will recurse infinitely?
<ygrek> flux, just git pushed the fix for ocurl bug exposed by webcamviewer, thanks for reporting
<mrvn> whitequark: It calls the ffn callback when it is done with the data.
<tautologico> it's the same as append a b where a = (h :: t)
<Drup> whitequark: actually, maybe I could expose an interface with that, instead of the ctypes stuff
<flux> ygrek, great!
<companion_cube> Drup: for lmdb you mean?
<Drup> yes
<companion_cube> aww
<oscar_> Yeah, that's why I'd think it'd recurse infinitely. I am sending the same input into the function as it received initially.
<ygrek> flux, please check %)
<orbitz> oscar_: why do you think that?
<ygrek> btw, is that your working place on the webcam?
<oscar_> If I call append a b, split a into h :: t and call append (h :: t) b, it is the same as append a b, isn't it?
<tautologico> oscar_ I see what you mean
<orbitz> oscar_: that isn't waht the thing you pasted says though
<tautologico> oscar_ the thing is to think of equational reasoning
<flux> ygrek, no, it's a computer club at the local university
<tautologico> oscar_ equationally, append (h :: t) b = h :: apend t b
<orbitz> oscar_: what you pasted says h :: (append t b) = append (h::t) b
<flux> ygrek, I suppose the new version is not yet available via opam?
<tautologico> oscar_ the book is not saying that you should call append (h :: t) b when passed append (h :: t) b
<ygrek> nope, will give it some testing before that
<Drup> companion_cube: why "aww" ? :D
<ygrek> pin for the rescue %)
<tautologico> oscar_ so because append (h :: t) b = h :: append t b, this is what the second arm of the match should do
<Drup> there are 4 lines of ruby in js_of_ocaml's sources
<Drup> wtf
<Drup> (and 41 lines of lisp)
gargaml has quit [Quit: WeeChat 0.4.3]
<flux> ygrek, bad makefile, make -j didn't work :)
<companion_cube> Drup: it sounds useful
<companion_cube> but well, you can provide a one-copy API
<Drup> companion_cube: that's what I have currently
<flux> hmm, did I find a bug in ocamlbuild?-o ocamlbuild -clean takes ages for a little project (infact so long I think it's in infinite loop)
<flux> aaah, no
<ygrek> flux, please report :)
<flux> it checks of course the files in the current directory hierarchy
<flux> I happen to have 5 million of them
<flux> in 'output' directory
<ygrek> and btw webcamviewer doesn't have a Makefile at all!
<flux> I suppose I could add one
<Anarchos> ygrek in NetHack, they just say : "hey, our machines are so fast, just do gcc *.c -o nethack , get rid of makefile !"
<oscar_> tautologico/orbitz: So it's saying to think of sort of the "destination" when thinking about the problem?
<tautologico> oscar_ kinda... do you agree that append (h :: t) b = h :: append t b ?
<flux> so I added <output>: -traverse to _tags and it still traverses output
<flux> I suppose it only prunes the files afterwards, quite annoying..
<oscar_> Yeah, according to the way the function is written.
<ygrek> Anarchos, seems I never gonna have machine that fast!
<tautologico> oscar_ not really about how it's written but how it should be written
* ygrek wishes ccache for ocaml
<tautologico> oscar_ think of concrete lists... append (1 :: [2; 3; 4]) [5; 6] = 1 :: (append [2; 3; 4] [5; 6]) ?
<Drup> if people are willing, I would like testers for that : https://github.com/OCamlPro/ocp-index/pull/43
<Drup> "opam pin add ocp-index https://github.com/Drup/ocp-index.git"
* ygrek off
<oscar_> Yeah, I get that fine.
<tautologico> oscar_ so, this equation append (h :: t) b = h :: append t b says what the function append must do when a = (h :: t)
<tautologico> oscar_ you're writing a function over a list so you must be able to say what's the result for an empty list, and for a cons of h and t
<tautologico> the empty list case is easy because append [] b = b (another equation)
<tautologico> and the h :: t case comes from the above equation
<oscar_> OK, I think I first just misunderstood this in thinking he meant the code could be swapped, then way overthought it.
<tautologico> oscar_ this part of the book is about looking at functional code in two ways: 1) as the specification of an algorithm (a sequence of steps); 2) as establishing equations between program expressions
oriba_ has quit [Quit: oriba_]
<flux> ygrek, works! without modifications to webcamviewer. also you got your Makefile to WebcaViewer ;)
<oscar_> OK, I got it now. Guess I'll read up a bit on equational reasoning.
maattdd has joined #ocaml
<oscar_> Thanks, tautologico/orbitz.
<tautologico> oscar_ most books on functional programming have something about this idea of transforming program expressions algebraically, but it's only valid for pure functional code
<oscar_> Yeah, I'm seeing a lot of Haskell results looking around on it, so that makes sense.
<mrvn> let fn _ _ = match free_fn with | None -> () | Some fn -> fn data in ... Does that keep data alive as long as fn lives when free_fn is None or could the compiler optimize that?
Algebr has joined #ocaml
<Algebr> Why does exit return a type variable rather than ()?
<mrvn> Algebr: because: if done then exit 0 else "foo"
<tautologico> same reason failwith does
<tautologico> or fail in Haskell
Sim_n has joined #ocaml
<tautologico> I mean error in Haskell
<Algebr> that's kind of a hack.
<Drup> not really
<tautologico> no. these functions never return, so what's their return type?
mcclurmc_ has joined #ocaml
<Algebr> why isn't it just ()
<Algebr> is it an action?
<Drup> Algebr: see the example mrvn posted
<tautologico> thinking the other way: how can exit/failwith break the assumption that it returns a value of type 'a for any 'a ?
ygrek has quit [Ping timeout: 240 seconds]
<Algebr> yes, and it side steps the type system, but I guess since no one gets their value, it doens't matter?
<flux> algebr, but is it really sidestepping?
<tautologico> let hd l = match l with [] -> failwith "hd: Empty list" | h :: _ -> h
<tautologico> Algebr: yes it does
thomasga has joined #ocaml
<tautologico> otherwise you can't write this List.hd function
no0y` has joined #ocaml
<flux> algebr, also, why it would rather be () than, say, number 5?
<flux> () is a value just as well 5 is
<tautologico> yes
<tautologico> it never returns, so it can potentially be anything... () is no more valid than anything else
isomorph1smes has joined #ocaml
<tautologico> but being a type variable makes it much more flexible to use in real functions
chris2_ has joined #ocaml
<tautologico> and it doesn't break type soundness in any way
<Drup> also, you want exit to return a type with no inhabitant
<Algebr> then is there any point to exit? Does any OS actually care about exit values?
orbitz_ has joined #ocaml
whitequa1k has joined #ocaml
<Drup> Algebr: of course OS cares about exit values O_o
acieroid` has joined #ocaml
<flux> what a function returns and what the operating system returns as the return code of the process are two different things :)
Youri_ has joined #ocaml
<tautologico> exit is from process to OS... the process doesn't see what exit returns, it sends the exit value to the OS
milosn_ has joined #ocaml
kerneis_ has joined #ocaml
numeo_ has joined #ocaml
lostman__ has joined #ocaml
<flux> you could of course have it like there's a single function, like C's main, and its return value would be the process return value
<flux> OCaml doesn't have such a single entry function
hnrgrgr_ has joined #ocaml
vbmithr_ has joined #ocaml
chris2 has quit [Disconnected by services]
chris2_ is now known as chris2
pjdelport_ has joined #ocaml
al-maisan_ has joined #ocaml
girrig_ has joined #ocaml
lostman_ has quit [*.net *.split]
mcclurmc has quit [*.net *.split]
Simn has quit [*.net *.split]
whitequark has quit [*.net *.split]
fraggle_ has quit [*.net *.split]
Youri has quit [*.net *.split]
pjdelport has quit [*.net *.split]
no0y has quit [*.net *.split]
girrig has quit [*.net *.split]
al-maisan has quit [*.net *.split]
hnrgrgr has quit [*.net *.split]
acieroid has quit [*.net *.split]
milosn has quit [*.net *.split]
vbmithr has quit [*.net *.split]
kerneis has quit [*.net *.split]
isomorphismes has quit [*.net *.split]
numeo has quit [*.net *.split]
orbitz has quit [*.net *.split]
algoriddle has quit [*.net *.split]
lostman__ is now known as lostman_
algoriddle has joined #ocaml
pjdelport_ is now known as pjdelport
fraggle_ has joined #ocaml
morphles has quit [Ping timeout: 255 seconds]
izaak has joined #ocaml
<mrvn> but even C has exit(). it just gets implicitly called when main returns.
oriba has joined #ocaml
tautologico has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
fold has quit [Ping timeout: 272 seconds]
maattdd has quit [Ping timeout: 255 seconds]
dsheets has quit [Ping timeout: 245 seconds]
<Drup> companion_cube: just read the article about derivative, didn't know about it, it's interesting
numeo_ is now known as numeo
tautologico has joined #ocaml
tobiasBora has joined #ocaml
izaak has quit [Ping timeout: 260 seconds]
axiles has quit [Remote host closed the connection]
tautologico has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
izaak has joined #ocaml
zpe has quit [Remote host closed the connection]
tautologico has joined #ocaml
al-maisan_ is now known as al-maisan
hhugo1 has joined #ocaml
hhugo has quit [Read error: Connection reset by peer]
orbitz_ has quit [Quit: Reconnecting]
orbitz has joined #ocaml
WraithM has joined #ocaml
maattdd has joined #ocaml
<Algebr> for the lexbuf in "let lexbuf = Lexing.from_channel stdin in <myRule> lexbuf, do I always have to name lexbuf, lexbuf? I read that all the rules in my .mll have a handle on lexbuf, but does the naming matter?
<companion_cube> you mean setting the file name?
<Algebr> I mean setting the name of the handle of what Lexing.from_channel returns, do I always have to name it lexbuf?
<whitequa1k> no
<whitequa1k> you pass it to Lexer.token
<whitequa1k> or however is your lexing function named
<companion_cube> right, it can even be an anonymous function
<Algebr> right, my main rule in my .mll
* companion_cube didn't understand the question
<Algebr> one moment.
<Algebr> I read that all rules in ocamllex have a handle on an implicit variable named lexbuf
<companion_cube> awwww, don't put a main() in a lexer :s
<jerith> Which XML parser do I want to use?
<companion_cube> yes, they do
<Algebr> its just a small example
<whitequa1k> jerith: Xmlm
<companion_cube> whitequa1k: your nick is fuzzed
<Algebr> yes, they do -> That's to each rule in a .mll has a handle on an implicit variable named lexbuf?
whitequa1k is now known as whitequark
<companion_cube> yes
<companion_cube> within the rules, not within the leading/trailing {}
<companion_cube> (where you put the main())
<Algebr> Ah, so the main entry rule gets passed what Lexing.from_channel returns, but the name doesn't matter as the rules all refer to it as lexbuf, regardless of what it was originally named
<companion_cube> once you'e in the "rule" it's always named lexbuf, yes
<Drup> Leonidas: I have g()()(F"al")
<Drup> (by abusing the fact that () is a constructor and overloading it)
tobiasBora has quit [Quit: Konversation terminated!]
<Leonidas> Drup: Neat. I was fiddling a bit with ppx but then it was taking too much time
<jerith> whitequark: Thanks.
sheijk has joined #ocaml
<Drup> Leonidas: it's going to be hard to do much better without string overloading
<whitequark> Leonidas: what are you doing?
<Drup> silly exercise :p
<Leonidas> whitequark: I was trying to replace () by o (a function application) and "at" (a string) by at (another function application)
<Leonidas> yes, super silly exercise :-)
WraithM has quit [Ping timeout: 245 seconds]
maattdd has quit [Ping timeout: 245 seconds]
<sheijk> anyone here running ocaml on arm? how stable is this stuff on a regular debian (when not using mirage), do things like c bindings, ctypes, gdb debugging, etc. work well?
<Leonidas> earlier today ggole and mrvn posted solutions with Obj.magic, so I was wondering for something more type safe :-)
<Leonidas> sheijk: I haven't seen any problems on raspberry pi, but admittedly, haven't used it all that much
<Drup> Leonidas: do you have a pastebin with the Obj.magic solution ?
<sheijk> Leonidas: did you use c bindings and gdb?
<sheijk> but actually raspberry pi is a good point, i have one sitting here so i can just try it myself now that you mention it :)
<whitequark> raspberry pi has a silly old arm though
<Leonidas> you mean "slow as molasses" ;-)
<whitequark> pretty much nothing else uses armv6
<Leonidas> sheijk: C bindings yes, gdb no.
<whitequark> Leonidas: molasses can be quite fast, https://en.wikipedia.org/wiki/Boston_Molasses_Disaster
<Leonidas> but only really trivial C bindings on ARM, the more involved stuff I did on x86, because it compiles faster
<Leonidas> whitequark: ok, noted. Heh.
<Leonidas> (things one can learn in #ocaml)
izaak has quit [Ping timeout: 250 seconds]
<def`> Ok, "al" is not a string, I could add a unary operator
<Drup> def`: yeah, my version is the same as your second
Kakadu has quit [Quit: Konversation terminated!]
Submarine has quit [Quit: Leaving]
<Drup> (except I use a constructor taking a string :p)
<def`> print_endline (g()()()()!"al")
<def`> with a constructor taking a string
<Drup> :p
ggole has quit []
<Drup> I have a version using -rectypes, but it doesn't work :(
<whitequark> what is the point of -rectypes
<Drup> subtlety in the typechecker :/
<whitequark> ... subtlety?
<def`> "it doesn't work"… that's not subtle
<whitequark> oh I see, you can have type a = A of a, but not type a = a
<Drup> def`: it doesn't work because of a subtlety :p
<whitequark> so when would one use -rectypes?
<whitequark> or recursive types?
<whitequark> of that form
<Drup> I'm not sure when to use rectype, expect when you want to blow your head off, actually
<whitequark> ...
* companion_cube never needed rectypes
<companion_cube> there are some places where it's used in batteries though
<whitequark> like in Queue?
<whitequark> or was that Obj.magic?
<companion_cube> it's just a Obj.magic
<Drup> (the goal with my solution with rectype was to use Obj.repr but no Obj.magic)
<Drup> def`: http://bpaste.net/show/wvj6pRCy9g48RaawzJ5d/ if you can figure out that :p
<def`> a solution with Obj is not a solution :P
<Drup> depends
<Drup> (arguably, there is Obj.magic hided in my code, so you are right x)
<Drup> hidden*
<whitequark> Drup: why does 'a. 'a in records not constitute an existential?
<whitequark> so like
<whitequark> type 'a foo = 'a * 'a -> int;; type bar = { foo : 'a. 'a foo }
<Drup> it's a forall, not an exist
<whitequark> oh.
<Drup> there are actually several (interesting) inhabitant for "forall 'a . 'a * 'a -> int"
<companion_cube> const 0 ?
<whitequark> you mean forall 'a . 'a * ('a -> int)
<whitequark> or no/
<Drup> companion_cube: "fun x y -> if x == y then 0 else 1", for example
<whitequark> oh, I typoed
BitPuffin has quit [Ping timeout: 255 seconds]
<Drup> (assuming purity and no poly comparison cheating)
<companion_cube> fun (x,y) -> ... you mean
<Drup> yes
<companion_cube> poly comparison sucks :D
hhugo1 has quit [Quit: Leaving.]
<companion_cube> this isn't a total function, it will fail on functions
<Drup> companion_cube: that's why I didn't use it as example :D
<Drup> whitequark: so, you meant forall 'a . 'a * ('a -> int) ?
<Drup> that's going to be harder to find an inhabitant for that :D
hhugo has joined #ocaml
<whitequark> yeah
<Drup> exist would be like that : type foo = Bla : 'a * ('a -> int) -> foo
<whitequark> yes, I know :S
<Drup> ok :)
<Leonidas> it would be cool having https://botbot.me/ in the channel
<Leonidas> their irc logs are incredibly neat
<whitequark> Leonidas: http://irclog.whitequark.org/ocaml
<Leonidas> ok
<Leonidas> that's not too bad either
<companion_cube> a proper log tool should be able to take logs in plain text and display them
<whitequark> "plain text" is a myth
<whitequark> however, irclog.wq.org exports in it: http://irclog.whitequark.org/ocaml/2014-07-27.txt
<Leonidas> the point is having live updates and a good search
<whitequark> irclog.wq.org has live updates, but search sucks
<whitequark> although it's fully indexed by google, so here's that
<Leonidas> yeah, it'd be nice to be able to jump to a hit
<Leonidas> oh, it works
<whitequark> :)
<whitequark> the search engine itself sucks
<whitequark> I use MySQL builtin search currently
<whitequark> it is horrible
<whitequark> it is just slightly better than rand()
<whitequark> I am not exaggerating
Sim_n has quit [Quit: Leaving]
BitPuffin has joined #ocaml
<miko> And I want to build another (Proably very old and bitrusted) ocaml software. Omake has this error. http://paste.ubuntu.com/7878669/
jao has quit [Ping timeout: 245 seconds]
<Leonidas> was looking at the network activity, you use the same technique as botbot :-)
<miko> But this looks like a error in a new package
<Leonidas> this looks like an incompatible campl4
<Leonidas> miko: what are you trying to build?
<miko> Incompatible with itself? For me it looks like the error is in /usr/lib/ocaml/camlp4/camlp4lib.cmxa, witch is brand new.
<miko> ANT
<miko> A very, very obsure, but very promissing TeX alternative with a haskell alike scripting language.
tautologico has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<miko> This is the whole output: http://paste.ubuntu.com/7878752/
<miko> Is it true pa_Num.cmx and pa_extensions.cmx are depending on outdated camlp4 ?
<miko> (or likely?)
izaak has joined #ocaml
rand000 has quit [Quit: leaving]
<Drup> whitequark: it would be nice to have global search on it, not only for the day
<Drup> ( miko : doesn't answer your question, but you might be interested by patoline)
<whitequark> Drup: it has global search
<Drup> oh, indeed
<Drup> for some reason, I only used the "filter" box, never the search one :>
<miko> Drup: Check out that earlier that day. It looks very nice and alread better then TeX (I really don't like it), but this looks even better.
<miko> Still, thanks for the hint.
tautologico has joined #ocaml
<Drup> it seems to be very similar to TeX, just less insane on the macro side
shinnya has quit [Ping timeout: 240 seconds]
BitPuffin has quit [Ping timeout: 264 seconds]
zpe has joined #ocaml
<tautologico> patoline is a system written in and scriptable in OCaml
<tautologico> patoline.org
<tautologico> seems interesting
<Drup> never took the time to actually try it
shinnya has joined #ocaml
<whitequark> it requires camlimages
zpe has quit [Ping timeout: 264 seconds]
<Drup> it's not an optional dependency ?
<whitequark> no
<Drup> well, there is a patch to make it work, so ...
<whitequark> someone should put it on opam
<whitequark> currently it doesn't install.
avsm has joined #ocaml
<Drup> Armael: is the fix compatible with older libgif versions ?
<tautologico> camlimages or patoline? I think patoline is on opam
<whitequark> camlimages
<tautologico> depends: ocamlfind & camomile & camlimages & dypgen & sqlite3-ocaml & camlzip
<tautologico> this is from opam info patoline
<tautologico> is the camlimages on opam broken?
<Drup> yes
<whitequark> oh, some genius decided to build it with -Werror
<whitequark> so it doesn't compile on 4.02
<companion_cube> classic
<whitequark> hm
<whitequark> I want to be able to do this:
<whitequark> assert_equal ~printer:[%derive.Show: int list] [1;2;3] !lst
<whitequark> should extend deriving to work like that
<companion_cube> doesn't look much better than simply applying printing combinators
<whitequark> hm?
<companion_cube> ~printer:(List.print Int.print)
<whitequark> well, you can do the same with combinators
<whitequark> but with deriving and very little work, you can do the same for any existing deriver
<whitequark> List.sort ~cmp:[%derive.Ord: int list]
<companion_cube> sort ~cmp:[%derive.Ord] ?
<whitequark> yes
<companion_cube> ah, too late :D
<companion_cube> same, I have combinators for orderings
<whitequark> or even iter!
<companion_cube> but I see your point
<companion_cube> I have combinators for iterating :>
<companion_cube> (did I tell you about sequence?)
<whitequark> uh?
<companion_cube> I meant that combinators are generally already powerful enough
<companion_cube> it might be useful to generate those, but I'm not so sure about generating code at use point
<whitequark> it's mostly to have a single mechanism for both
Guest58938 has quit [Remote host closed the connection]
<whitequark> you could even do
<companion_cube> so what would it look like for iterating?
avsm has quit [Quit: Leaving.]
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
<whitequark> [%derive.Iter: 'a list] (printf "%d") [1;2;3]
englishm has joined #ocaml
<companion_cube> oh, using polymorphism
<companion_cube> I prefer being explicit for iteration
<whitequark> uhm?
<companion_cube> because it's a choice
<companion_cube> well, if you have an int list list, you can iterate on int, or on int list
<whitequark> the idea behind Iter is that it calls a function for every free type variable
<whitequark> you could probably say
<whitequark> [%derive.Iter: (int as 'a) list]
<companion_cube> if you have several type variables, what happens?
<whitequark> a separate function is accepted for each
<companion_cube> but how does the iteration proceed?
<whitequark> hm?
<whitequark> what do you mean?
<companion_cube> show me an example
pyon has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
<companion_cube> (for instance: [%derive.Iter: ('a * 'b) list] fa fb list ?
pyon has joined #ocaml
<whitequark> yes
<Drup> companion_cube: "[%derive.Iter: 'a list]" would iterate on the outer list, and "[%derive.Iter: 'a list list]" on the inside
<whitequark> it generates: let rec iter_foo poly_b poly_a = List.iter (fun (a0,a1) -> poly_a a0; poly_b a1);;
<companion_cube> sounds nice, but not as much as [%derive.sequence] :>
<whitequark> what would that do?
<Drup> companion_cube: not the same use
<companion_cube> whitequark: well it's a flip of [%derive.iter], which is better for composition
<whitequark> example?
<companion_cube> [%derive.sequence: int list] [1;2;3] |> Sequence.flat_map foobar |> Sequence.to_list ?
<whitequark> so, basically, CPS'd iter
<whitequark> you can write that as an exercise ;D
<companion_cube> when 4.02 is released :p
<whitequark> what prevents you from doing it now?
<companion_cube> merlin :p
<whitequark> git checkout merlin2
<whitequark> it works on 4.02.
englishm has quit [Remote host closed the connection]
<companion_cube> well I'm in no hurry
<whitequark> excuses
<companion_cube> yep :D
pyon has quit [Quit: stupid urxvt]
sheijk_ has joined #ocaml
pyon has joined #ocaml
troydm has joined #ocaml
sheijk has quit [Ping timeout: 260 seconds]
izaak has quit [Ping timeout: 264 seconds]
oscar_ has quit [Ping timeout: 246 seconds]
darkf has joined #ocaml
algoriddle has quit [Quit: Connection closed for inactivity]
miko has quit [Ping timeout: 260 seconds]
zpe has joined #ocaml
thomasga has quit [Quit: Leaving.]
zpe has quit [Ping timeout: 256 seconds]
sillyotter has joined #ocaml
sillyotter has quit [Client Quit]
madroach has quit [Ping timeout: 250 seconds]
oriba has quit [Quit: oriba]
madroach has joined #ocaml
WraithM has joined #ocaml
NoNNaN has quit [Remote host closed the connection]
penglingbo has joined #ocaml
NoNNaN has joined #ocaml
tautologico has quit [Quit: Textual IRC Client: www.textualapp.com]
WraithM has quit [Ping timeout: 240 seconds]
izaak has joined #ocaml