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
kvelicka has quit [Quit: Leaving.]
philtor has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
NoNNaN has quit [Remote host closed the connection]
NoNNaN has joined #ocaml
philtor has quit [Ping timeout: 272 seconds]
contempt has quit [Ping timeout: 264 seconds]
contempt has joined #ocaml
shinnya has joined #ocaml
contempt has quit [Remote host closed the connection]
contempt has joined #ocaml
lordkryss has quit [Quit: Connection closed for inactivity]
jao has joined #ocaml
jao has quit [Changing host]
jao has joined #ocaml
contempt has quit [Remote host closed the connection]
contempt has joined #ocaml
englishm has joined #ocaml
zRecursive has joined #ocaml
philtor has joined #ocaml
tac_ has quit [Ping timeout: 240 seconds]
shinnya has quit [Ping timeout: 272 seconds]
philtor has quit [Ping timeout: 272 seconds]
q66 has quit [Quit: Leaving]
_twx_ has joined #ocaml
axiles has joined #ocaml
BitPuffin has quit [Ping timeout: 246 seconds]
ygrek has joined #ocaml
ebzzry has quit [Remote host closed the connection]
koderok has joined #ocaml
koderok has quit [Read error: Connection reset by peer]
koderok has joined #ocaml
englishm has quit [Quit: Leaving...]
tac_ has joined #ocaml
tac_ has quit [Read error: Connection reset by peer]
mcclurmc has joined #ocaml
englishm has joined #ocaml
cody__ has quit [Quit: Leaving]
ygrek has quit [Ping timeout: 250 seconds]
lusory has joined #ocaml
koderok has quit [Quit: koderok]
jao has quit [Ping timeout: 240 seconds]
SethTisue has quit [Quit: SethTisue]
ygrek has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
racycle has joined #ocaml
koderok has joined #ocaml
Mercuria1Alchemi has joined #ocaml
MercurialAlchemi has joined #ocaml
jprakash has joined #ocaml
axiles has quit [Ping timeout: 264 seconds]
Skolem has quit [Quit: Skolem]
Skolem has joined #ocaml
Skolem has quit [Client Quit]
maattdd has joined #ocaml
MercurialAlchemi has quit [Remote host closed the connection]
Mercuria1Alchemi has quit [Remote host closed the connection]
axiles has joined #ocaml
siddharthv_away is now known as siddharthv
WraithM has joined #ocaml
maattdd has quit [Ping timeout: 260 seconds]
racycle has quit [Quit: ZZZzzz…]
koderok has quit [Quit: koderok]
yacks has joined #ocaml
siddharthv is now known as siddharthv_away
koderok has joined #ocaml
badon has quit [Ping timeout: 245 seconds]
Nahra has quit [Ping timeout: 250 seconds]
Nahra has joined #ocaml
WraithM has quit [Ping timeout: 245 seconds]
siddharthv_away is now known as siddharthv
Simn has joined #ocaml
samrat has joined #ocaml
ggole has joined #ocaml
fantasticsid has quit [Remote host closed the connection]
ygrek has quit [Ping timeout: 240 seconds]
pyon has quit [Ping timeout: 272 seconds]
pyon has joined #ocaml
arj has joined #ocaml
jprakash has quit [Quit: leaving]
Nahra has quit [Ping timeout: 250 seconds]
_0xAX has joined #ocaml
Nahra has joined #ocaml
Hannibal_Smith has joined #ocaml
Arsenik has joined #ocaml
englishm has quit [Remote host closed the connection]
zRecursive has quit [Remote host closed the connection]
ygrek has joined #ocaml
AltGr has joined #ocaml
cago has joined #ocaml
fold has quit [Ping timeout: 260 seconds]
rgrinberg has quit [Quit: Leaving.]
kvelicka has joined #ocaml
eikke__ has joined #ocaml
koderok has quit [Quit: koderok]
koderok has joined #ocaml
hhugo has joined #ocaml
thomasga has joined #ocaml
iorivur has quit [Ping timeout: 272 seconds]
kvelicka has quit [Read error: Connection reset by peer]
badon has joined #ocaml
thomasga has quit [Quit: Leaving.]
bezirg has joined #ocaml
thomasga has joined #ocaml
Thooms has joined #ocaml
leowzukw has joined #ocaml
Nahra has quit [Remote host closed the connection]
dsheets has joined #ocaml
thomasga has quit [Quit: Leaving.]
tane has joined #ocaml
Kakadu has joined #ocaml
dsheets has quit [Ping timeout: 245 seconds]
avsm has joined #ocaml
kvelicka has joined #ocaml
koderok has quit [Quit: koderok]
maattdd has joined #ocaml
rand000 has joined #ocaml
iorivur has joined #ocaml
thomasga1 has joined #ocaml
avsm has quit [Quit: Leaving.]
dsheets has joined #ocaml
thomasga1 has quit [Client Quit]
BitPuffin has joined #ocaml
thomasga1 has joined #ocaml
iorivur has quit [Ping timeout: 255 seconds]
bezirg has quit [Quit: Leaving.]
kvelicka has left #ocaml [#ocaml]
yacks has quit [Ping timeout: 250 seconds]
fraggle_laptop has joined #ocaml
Nahra has joined #ocaml
thomasga has joined #ocaml
thomasga has quit [Client Quit]
thomasga1 has quit [Ping timeout: 240 seconds]
waneck_ has quit [Ping timeout: 245 seconds]
maattdd has quit [Ping timeout: 264 seconds]
avsm has joined #ocaml
rand000 has quit [Quit: leaving]
NoNNaN has quit [Remote host closed the connection]
iorivur has joined #ocaml
iorivur has quit [Ping timeout: 255 seconds]
iorivur has joined #ocaml
lpw25 has joined #ocaml
bezirg has joined #ocaml
sepp2k has joined #ocaml
eikke__ has quit [Ping timeout: 240 seconds]
iorivur has quit [Ping timeout: 250 seconds]
Algebr has joined #ocaml
<Algebr> About to pull my hair out, I keep getting Fatal error: exception Parser.Error
<Algebr> and menhir -v gives me just one shift/reduce error
<def`> there is a syntax error in your input
koderok has joined #ocaml
<Algebr> but my scanner should be able to pick it up, then my scanner is wrong?
<def`> how would I know?
maattdd has joined #ocaml
SethTisue has joined #ocaml
SethTisue has quit [Client Quit]
maattdd has quit [Ping timeout: 255 seconds]
<def`> (Algebr: are you catching Parser.Error in the driver?)
eikke__ has joined #ocaml
<Algebr> No, I saw something about let parser_error s but wasn't sure where I should put that
ohama has joined #ocaml
_andre has joined #ocaml
hhugo has quit [Ping timeout: 240 seconds]
<def`> Ok. Then what is your problem?
<Algebr> my problem is thatFatal error: exception Parser.Error
<Algebr> tells me nothing
<def`> yes, you have to add error management to your parser if you want more helpful error messages
<def`> you could start by printing position of the last token your scanner produced
<Kakadu> also, parser-combinators are great
maattdd has joined #ocaml
siddharthv is now known as siddharthv_away
hhugo has joined #ocaml
cody__ has joined #ocaml
hhugo has quit [Client Quit]
cody__ has quit [Client Quit]
Nahra has quit [Remote host closed the connection]
ygrek has quit [Ping timeout: 260 seconds]
Nahra has joined #ocaml
avsm has quit [Quit: Leaving.]
freling has quit [Ping timeout: 240 seconds]
tani has joined #ocaml
tane has quit [Ping timeout: 245 seconds]
samrat has quit [Quit: Computer has gone to sleep.]
BitPuffin has quit [Ping timeout: 264 seconds]
iorivur has joined #ocaml
BitPuffin has joined #ocaml
fraggle_ has quit [Read error: Connection reset by peer]
fraggle_ has joined #ocaml
araujo has joined #ocaml
darkf has quit [Quit: Leaving]
avsm has joined #ocaml
koderok has quit [Ping timeout: 246 seconds]
samrat has joined #ocaml
leowzukw has joined #ocaml
<leowzukw> Hi everybody, is there any tutorial about cryptokit?
* adrien_oww thinks the API looked easy enough
<adrien_oww> a special issue?
<adrien_oww> specific*
<leowzukw> no, just getting started
<leowzukw> and be sure do not to do mistake
<adrien_oww> the API itself shouldn't be an issue; not using crypto right can be one however
descender has joined #ocaml
<leowzukw> adrien_oww: Do you have any tips?
<adrien_oww> no :P
<adrien_oww> only had to use for sha3 so far and read the API around
<leowzukw> ok so I'll try and hope ;-) Thanks!
englishm has joined #ocaml
samrat has quit [Quit: Computer has gone to sleep.]
yacks has joined #ocaml
leowzukw has quit [Quit: leaving]
zarul has quit [Ping timeout: 240 seconds]
Superpelican_ has joined #ocaml
avsm has quit [Quit: Leaving.]
freling has joined #ocaml
iorivur has quit [Ping timeout: 250 seconds]
samrat has joined #ocaml
studybot has quit [Remote host closed the connection]
nlucaron1 has left #ocaml [#ocaml]
pgomes has joined #ocaml
_`_ has quit [Remote host closed the connection]
_`_ has joined #ocaml
fold has joined #ocaml
huza has joined #ocaml
samrat has quit [Quit: Computer has gone to sleep.]
zarul has joined #ocaml
Patchou has quit [Ping timeout: 240 seconds]
_0xAX has quit [Remote host closed the connection]
huza has quit [Quit: WeeChat 0.3.8]
WraithM has joined #ocaml
<Superpelican_> Hello it’s me again :)
avsm has joined #ocaml
<Superpelican_> I now have the following code: http://pastie.org/9461994
oriba has joined #ocaml
<Superpelican_> I’m getting a syntax error on line 15
<pgomes> I would say it requires a semi-colon
<pgomes> in line 15 no ?
<oriba> What is the "`name"-argument for in Tk-idgests (labltk) ? I remember, somehow, Tk had a signalling mechanism... does this argument it relate to it? And how to use it?
<Superpelican_> pgomes: line 15 a semicolon?
<pgomes> I would say no ?
<Superpelican_> You mean after ‘let () =‘?
<pgomes> | `Ok win -> win ;
<pgomes> here
<Superpelican_> hmmm
<pgomes> Not sure
<Superpelican_> I’ll try
<pgomes> also learnign so ... I might be wrong
samrat has joined #ocaml
<pgomes> *learning
maattdd has quit [Ping timeout: 272 seconds]
<Superpelican_> pgomes: I don’t think so: http://ocaml.org/learn/tutorials/data_types_and_matching.html
<pgomes> I warned:p
<Superpelican_> ;)
mcclurmc has joined #ocaml
<pgomes> But the matching is fine
<pgomes> but I would assume it needs termination
ygrek has joined #ocaml
rgrinberg has joined #ocaml
<oriba> what does (ocamlnet) "Uncaught exception: Netconversion.Malformed_code" mean? Looks like an internal error, I did not use a Netconversion-module at all.
<rgrinberg> oriba: did you turn on stack traces?
<oriba> hmhh, stack traces? don't know that option. Is it compile-time or runtime switch?
<ggole> Both
inr_ is now known as inr
<ggole> Compile everything with -g, run with OCAMLRUNPARAM="b"
freling has quit [Ping timeout: 264 seconds]
<def`> Superpelican_: the binding opened on line 3 is not terminated
<bernardo1pc> Superpelican_: remove ; on line 5
<def`> (the ; on line 5 … Ok)
<oriba> ggole, done; does not print more information
avsm1 has joined #ocaml
Denommus has joined #ocaml
<Superpelican_> bernardo1pc: thanks, I forgot
shinnya has joined #ocaml
<Superpelican_> def`: what binding?
<def`> Superpelican_: that's what bernardo1pc said
<def`> the "let () = … " is a (let-)binding
<def`> it is not closed because the ; on line 5 makes ocaml think the following let is a nested expression of this binding
Nahra has quit [Remote host closed the connection]
<Superpelican_> ok thanks
<Superpelican_> I’ll try compiling now
Nahra has joined #ocaml
avsm has quit [Ping timeout: 260 seconds]
<Superpelican_> def`: is the shutdown procedure even possible?
<Superpelican_> I forgot that OCaml maybe copies the variables/arguments
<Superpelican_> if I add win as an argument
slash^ has joined #ocaml
<Superpelican_> def`: and win is destroyed with Sdl.destroy_window won’t the copy just be destroyed then?
<def`> ocaml copies nothing
<Superpelican_> ok
<def`> and you are right that the win value is not bound in the scope of shutdown
<Superpelican_> I added win as an argument
<Superpelican_> Now I’m getting: “Error: This pattern matches values of type [? `Ok ] but a pattern was expected which matches values of type Tsdl.Sdl.surface Tsdl.Sdl.result Types for tag `Ok are incompatible”
<Superpelican_> on line 19
<def`> Hehe, any idea why you get this error?
<Superpelican_> Well yes
<ggole> oriba: hmm, maybe something is catching it :/
<Superpelican_> I think it is caused by the last match body in the file
<def`> where does img come from
<oriba> ggole, Maybe I can explore it in more detail later... need to go. thx so far
oriba has quit [Quit: oriba]
<ggole> The ocamlnet docs mention a catch-all handler that is on by default, that could be it
<ggole> ...
<Superpelican_> img is an surface
<ggole> Well, never mind.
<Superpelican_> it is returned by load_bmp
<Superpelican_> def`: also this might be helpful http://erratique.ch/software/tsdl/doc/Tsdl.Sdl.html#surfaces
<Superpelican_> def`: ok I think I fixed the error by changing `Ok to `Ok win in the last match body
<Superpelican_> Now I get Error: unbound value win on line 20
<Superpelican_> oh wait
<Superpelican_> I actually forgot to bind it ;)
<Superpelican_> Ok I now have the following code:
<Drup> https://github.com/diml/utop/issues/80 not sure how I feel about that
<Drup> (following a discussion here a few days ago)
<Superpelican_> And now I’m getting “Error: This expression has type 'a option but an expression was expected of type Tsdl.Sdl.rect”
<Superpelican_> This has to do with the Sdl.blit_surface call
<Superpelican_> with the None's
<Superpelican_> yes
<Superpelican_> but in this C/C++ tutorial I’m following
<Superpelican_> they use NULL for the rect arguments
<Superpelican_> And in the OCaml tutorials I’ve read
<Superpelican_> def`: you can provide either Some ‘a as an argument or just None
<def`> No.
<Superpelican_> So I don’t understand why providing None isn’t sufficient
<def`> You can't, it's an sdl rect and nothing else.
<Superpelican_> weird
<def`> Not weird, it's just a different binding with different decisions.
<Superpelican_> because in the C/C++ tutorial they call blit_surface like this: “SDL_BlitSurface( gHelloWorld, NULL, gScreenSurface, NULL );"
<def`> (That can be contested, that's another problem)
<def`> Yes, but then it's C++, not OCaml.
<Superpelican_> where gHelloWorld = img
<def`> Well, not Tsdl's ocaml binding
<Superpelican_> and gScreenSurface = screenSurface in my case
<Superpelican_> So there isn’t a way to provide NULL using the binding
<Superpelican_> ?
<Superpelican_> well I don’t really know what else I could provide
<def`> Just create a rect.
<Superpelican_> “If srcrect is NULL, the entire surface is copied. If dstrect is NULL, then the destination position (upper left corner) is (0, 0).”
<Superpelican_> I just want to copy the entire surface
<Superpelican_> Why would I want to crop a surface?
<Superpelican_> providing the dstrec wouldn’t be a problem
eikke__ has quit [Ping timeout: 260 seconds]
<def`> I agree it's not very convenient that the rects are mandatory in the binding.
<def`> (Why wouldn't you want to crop a surface ?!)
samrat has quit [Quit: Computer has gone to sleep.]
samrat has joined #ocaml
<Superpelican_> def`: https://wiki.libsdl.org/SDL_Rect
<Superpelican_> So how can one ‘define’ an sdl.rect in OCaml with Tsdl?
<Superpelican_> a variant?
<Superpelican_> * variant -> record
pgomes has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
<acieroid> Superpelican_: you should probably take a look at the examples (eg. https://github.com/dbuenzli/tsdl/blob/master/test/test.ml)
<acieroid> Sdl.Rect.create seems to be what you're looking for
avsm has joined #ocaml
maattdd has joined #ocaml
<Superpelican_> acieroid: thanks :)
avsm1 has quit [Ping timeout: 245 seconds]
hhugo has joined #ocaml
maattdd has quit [Ping timeout: 272 seconds]
pminten has joined #ocaml
samrat has quit [Ping timeout: 264 seconds]
Denommus has quit [Changing host]
Denommus has joined #ocaml
avsm has quit [Quit: Leaving.]
<Superpelican_> def`: ok, I was able to fix the call to blit_surface thanks to acieroid’s link :)
<Superpelican_> def`: I’m now getting “Error: This expression has type Tsdl.Sdl.surface Tsdl.Sdl.result but an expression was expected of type Tsdl.Sdl.surface” on line 23
<Superpelican_> So looks like I still haven’t really fixed the last match body
avsm has joined #ocaml
samrat has joined #ocaml
<acieroid> Superpelican_: look at the definition of Tsdl.Sdl.result
<acieroid> and you'll find how to get your Tsdl.Sdl.surface from that
testcocoon has quit [Quit: Coyote finally caught me]
<Superpelican_> acieroid: so I should place “of” between `Ok and img and `Error and err?
<Superpelican_> Isn’t “of” only for types?
<Superpelican_> I don’t know what I would change otherwise
<acieroid> Superpelican_: no, a value of the result type is either `Error s where s describes the error, or `Ok x where x is the actual return value of the function
<Superpelican_> wait but the result and variable of type ‘a are reversed
<Superpelican_> acieroid: But don’t I already have it that way?
arj has quit [Quit: Leaving.]
<acieroid> you have t he 'a result, you want the 'a
<acieroid> which *might* be inside the 'a result, but that's not sure (as an error could have happened)
<Superpelican_> yes but I have a match for that
<Superpelican_> acieroid: http://pastie.org/9462067
<acieroid> ah, I didn't see your code, sorry
testcocoon has joined #ocaml
<Superpelican_> I did add the Sdl.Rect.create stuff though since that paste
<acieroid> well I guess the error doesn't come from one of your match but rather from another function that returns a 'a result
<acieroid> can you paste your current code ?
<Superpelican_> ok
<Superpelican_> Current code: http://pastie.org/9462235
<acieroid> get_window_surface returns a surface result, not a surface
<Superpelican_> oops
<Superpelican_> LOL why does it also return a result
<Superpelican_> ?
<acieroid> (ideally you should also check the return values of the functions that return a unit result, even though it will compile if you don't)
<Superpelican_> In what situation *can* you create a window but *not* get its surface?
<acieroid> if it has been destroyed since you created it?
<Superpelican_> hmm yeah
<Superpelican_> that would be possible yes
iorivur has joined #ocaml
<Superpelican_> although that would be a programmer side error
<Superpelican_> as in
<Superpelican_> programmer of the application not of the OS, libraries, firmware etc. ;)
<acieroid> maybe, but it still can result in an error :)
<Superpelican_> acieroid: so I should place even more match’s in my code? :(
eikke__ has joined #ocaml
<acieroid> Superpelican_: indeed
<Superpelican_> I rather like the match stuff
<Superpelican_> but I wouldn’t like placing them between every 2 lines :(
samrat has quit [Ping timeout: 260 seconds]
<Superpelican_> especially when you consider indentation
<acieroid> Superpelican_: you can always nicely compose them, look at Haskell's Maybe monad
<Superpelican_> acieroid: Although I ideally should probably put all this stuff in seperate functions ;)
<acieroid> or just define some kind of fmap on 'a results I guess
samrat has joined #ocaml
sepp2k has quit [Quit: Konversation terminated!]
<Superpelican_> acieroid: I guess I should create some kind of abstraction function for blit
cago has quit [Quit: cago]
<Superpelican_> acieroid: Or I could skip that abstraction and create a draw method for each object that I have that calls Sdl.blit_surface directly
<acieroid> probably
iorivur has quit [Ping timeout: 244 seconds]
<Superpelican_> have to leave now :(
Superpelican_ has quit [Quit: Superpelican_]
racycle has joined #ocaml
hhugo has quit [Quit: Leaving.]
bezirg has quit [Ping timeout: 272 seconds]
avsm has quit [Quit: Leaving.]
slash^ has quit [Read error: Connection reset by peer]
parcs has quit [Remote host closed the connection]
slash^ has joined #ocaml
maattdd has joined #ocaml
samrat has quit [Ping timeout: 260 seconds]
racycle has quit [Read error: Connection reset by peer]
racycle has joined #ocaml
philtor has joined #ocaml
parcs has joined #ocaml
samrat has joined #ocaml
maattdd has quit [Ping timeout: 260 seconds]
shinnya has quit [Ping timeout: 240 seconds]
iorivur has joined #ocaml
jwatzman|work has joined #ocaml
jwatzman|work has quit [Changing host]
jwatzman|work has joined #ocaml
koderok has joined #ocaml
racycle has quit [Read error: Connection reset by peer]
racycle has joined #ocaml
koderok has quit [Ping timeout: 250 seconds]
eikke__ has quit [Ping timeout: 240 seconds]
racycle has quit [Read error: Connection reset by peer]
racycle has joined #ocaml
eikke__ has joined #ocaml
racycle has quit [Read error: Connection reset by peer]
racycle has joined #ocaml
racycle has quit [Read error: Connection reset by peer]
racycle has joined #ocaml
eikke__ has quit [Ping timeout: 245 seconds]
lordkryss has joined #ocaml
racycle_ has joined #ocaml
stevej has joined #ocaml
racycle has quit [Read error: No route to host]
racycle has joined #ocaml
racycle has quit [Client Quit]
racycle has joined #ocaml
S11001001 has joined #ocaml
S11001001 has quit [Changing host]
S11001001 has joined #ocaml
racycle_ has quit [Ping timeout: 250 seconds]
anddam has quit [Ping timeout: 245 seconds]
diethyl has quit [Ping timeout: 245 seconds]
rand000 has joined #ocaml
diethyl has joined #ocaml
anddam has joined #ocaml
stevej has quit [Quit: ["Textual IRC Client: www.textualapp.com"]]
Simn has quit [Ping timeout: 240 seconds]
lpw25 has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
AltGr has left #ocaml [#ocaml]
slash^ has left #ocaml [#ocaml]
igitoor has quit [Ping timeout: 240 seconds]
igitoor has joined #ocaml
troutwine_away is now known as troutwine
Hannibal_Smith has quit [Quit: Sto andando via]
maattdd has joined #ocaml
hhugo has joined #ocaml
njcomsec has joined #ocaml
yacks has quit [Ping timeout: 272 seconds]
pminten has quit [Quit: KVIrc 4.2.0 Equilibrium http://www.kvirc.net/]
maattdd has quit [Ping timeout: 264 seconds]
claudiuc has joined #ocaml
q66 has joined #ocaml
igitoor has quit [Changing host]
igitoor has joined #ocaml
Simn has joined #ocaml
ollehar has joined #ocaml
maattdd has joined #ocaml
ollehar has quit [Client Quit]
jprakash has joined #ocaml
Anarchos has joined #ocaml
Superpelican_ has joined #ocaml
philtor_ has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
WraithM has quit [Ping timeout: 260 seconds]
koderok has joined #ocaml
claudiuc has quit [Remote host closed the connection]
jao has joined #ocaml
jao has quit [Changing host]
jao has joined #ocaml
claudiuc has joined #ocaml
yacks has joined #ocaml
rand000 has quit [Quit: leaving]
avsm has joined #ocaml
philtor has quit [Ping timeout: 260 seconds]
koderok has quit [Quit: koderok]
artagnon has joined #ocaml
<artagnon> To malloc, I have to declare_function the malloc and build_call it, right?
jwatzman|work has quit [Quit: jwatzman|work]
<artagnon> There's no shortcut wrapper like build_malloc?
<adrien> artagnon: wrong channel?
<adrien> or there's something I really don't understand
<mrvn> ocaml has no malloc :)
<artagnon> OCaml LLVM bindings actually.
<adrien> ah
<mrvn> what are they actually? BIndings to drive the compiler from ocaml so you can compile stuff or a frontend so you can compile ocaml with llvm?
<artagnon> The former.
<artagnon> You can write an LLVM-based compiler in OCaml without emitting IR by hand.
<Superpelican_> def`: I’m now getting “Error: syntax error” on line 30, I now have the following code: http://pastie.org/9462628
artagnon has left #ocaml [#ocaml]
Kakadu has quit [Ping timeout: 246 seconds]
<def`> Superpelican_: are you sure ? this code seems correct
<Superpelican_> yep
<Superpelican_> def`: Maybe the actual error is located on another line?
<Superpelican_> Or have you already read the whole file? :D
<def`> I read and passed it through ocamlc
<Superpelican_> def`: So you mean it compiles?
dsheets has quit [Ping timeout: 260 seconds]
<Superpelican_> ?
<Superpelican_> now it compiles!
<def`> :P
<Superpelican_> I didn’t change anything
<Superpelican_> maybe I forgot to save or something like that
<Superpelican_> OMG
<Superpelican_> I have actually compiled my first, real OCaml program :)
<def`> congratulations :D
<Superpelican_> not just someone else’s example
philtor has joined #ocaml
<Superpelican_> but my own little demo
<Superpelican_> let’s try it :D
<Superpelican_> it works!
<Superpelican_> no errors
<Superpelican_> that was pretty smooth
<Superpelican_> and getting all the dynamic library stuff working was a breeze too thanks to OPAM :)
<Superpelican_> I have always been puzzled how to compile a C++ program with a dynamic library
<Superpelican_> or it’s just OS X
* Superpelican_ just switched from Linux a month ago
<bjorkintosh> nah.
<bjorkintosh> it's just you.
<bjorkintosh> kidding. i have no idea.
samrat has quit [Ping timeout: 240 seconds]
<Superpelican_> Even though my application only displays a picture that I borrowed (read: stole) from NASA, it still feels like a (small) accomplishment
WraithM has joined #ocaml
<bjorkintosh> it is.
<bjorkintosh> you should be proud.
bezirg has joined #ocaml
thomasga has joined #ocaml
Thooms_ has joined #ocaml
samrat has joined #ocaml
<jeroud> Superpelican_: Nice.
rgrinberg has quit [Quit: Leaving.]
troutwine is now known as troutwine_away
* jeroud isn't sure how much work is left in his first real OCaml project.
yomimono has joined #ocaml
maattdd has quit [Ping timeout: 240 seconds]
troutwine_away is now known as troutwine
avsm has quit [Quit: Leaving.]
ygrek_ has joined #ocaml
ygrek has quit [Ping timeout: 272 seconds]
thomasga has quit [Quit: Leaving.]
ygrek has joined #ocaml
ygrek_ has quit [Ping timeout: 250 seconds]
divyanshu has joined #ocaml
divyanshu has quit [Client Quit]
malo has joined #ocaml
hhugo has quit [Quit: Leaving.]
jao has quit [Ping timeout: 240 seconds]
oriba has joined #ocaml
pyon has quit [Quit: Fiat justitia ruat caelum.]
Kakadu has joined #ocaml
freling has joined #ocaml
mcclurmc has joined #ocaml
samrat has quit [Quit: Computer has gone to sleep.]
WraithM has quit [Ping timeout: 250 seconds]
mcclurmc has quit [Remote host closed the connection]
tac_ has joined #ocaml
fold has quit [Ping timeout: 240 seconds]
philtor_ has quit [Ping timeout: 264 seconds]
<Superpelican_> def`: BTW are you an experienced OCaml programmer?
<Superpelican_> def`: I’m wondering if you think my code was OCaml’ish, or alien ;)
agarwal1975 has quit [Quit: agarwal1975]
<Drup> hard to answer considering that 1) it's small 2) the library is a very thin binding to C, so not idiomatic to begin with.
<def`> Superpelican_: moderately experienced. your code was correct for a beginner, but…
<Superpelican_> it isn’t very OCaml’ish?
<def`> 1) try to stay close to the guidelines concerning indentation, eventually use tools like ocp-indent to do so
<Drup> Superpelican_: also, ocaml indentation is usually 2 spaces :p
<Superpelican_> so no tabs
<Superpelican_> :(
<Superpelican_> I too at first used 2 spaces
<Superpelican_> but everyone used tabs in the Python world
<Superpelican_> and now I should use 2 spaces again ;)
<def`> 2) it was OCaml'ish in the sense that you made use of ocaml features :) (you didn't really had choice as you were guided by the library :))
<Superpelican_> ok, that’s good
<Superpelican_> I’m trying to make use of the basic OCaml features
<def`> 3) but you pinpointed the main problem : repetitive. ocaml provides basic features, but those are highly composable which means you'll have to build your own abstracions
<Superpelican_> although I haven’t really completely read Real World OCaml yet
<Superpelican_> so I don’t know about some advanced features yet
<Superpelican_> and I still find polymorphic variants confusing
<def`> Also, Drup is right, the sdl binding is really low-level, so it doesn't help writing idiomatic code.
<def`> It's the minimum layer above C-code.
<Superpelican_> yeah that was to be expected
<Superpelican_> of a thin binding
<Superpelican_> which almost directly maps to C code ;)
<def`> Yes. You can skip polymorphic variants etc by following RWO, you will use those when appropriate.
<Superpelican_> ok, that’s reassuring :)
<whitequark> def`: "moderately experienced"
mcclurmc has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
rgrinberg has joined #ocaml
mcclurmc has joined #ocaml
<Drup> (I wonder in which other community a guy hacking the typechecker like you do would be described as "moderately experienced")
<def`> :P all is relative
<Superpelican_> :)
mcclurmc has quit [Remote host closed the connection]
ygrek has quit [Ping timeout: 244 seconds]
manizzle has joined #ocaml
<smondet> Drup: well, a guy hacking python's typechecker is a "total beginner" :)
ygrek has joined #ocaml
<Drup> ahah x)
<Drup> I expected this kind of remark :D
fold has joined #ocaml
Superpelican_ has quit [Quit: Superpelican_]
dsheets has joined #ocaml
yomimono has quit [Read error: Connection reset by peer]
mcclurmc has joined #ocaml
yomimono has joined #ocaml
yomimono has quit [Read error: Connection reset by peer]
yomimono has joined #ocaml
yomimono has quit [Read error: Connection reset by peer]
Thooms has quit [Quit: Towards infinity and beyooooooond]
yomimono has joined #ocaml
yomimono has quit [Read error: Connection reset by peer]
yomimono has joined #ocaml
yomimono has quit [Read error: Connection reset by peer]
yomimono has joined #ocaml
yomimono has quit [Read error: Connection reset by peer]
yomimono has joined #ocaml
yomimono has quit [Read error: Connection reset by peer]
yomimono has joined #ocaml
yomimono has quit [Read error: Connection reset by peer]
yomimono has joined #ocaml
yomimono has quit [Read error: Connection reset by peer]
yomimono has joined #ocaml
yomimono has quit [Read error: Connection reset by peer]
yomimono has joined #ocaml
ggole has quit []
yomimono has quit [Read error: Connection reset by peer]
oriba_ has joined #ocaml
oriba has quit [Ping timeout: 240 seconds]
_andre has quit [Quit: leaving]
avsm has joined #ocaml
jwatzman|work has joined #ocaml
eikke__ has joined #ocaml
kakadu_ has joined #ocaml
Kakadu has quit [Quit: Konversation terminated!]
freling has quit [Ping timeout: 260 seconds]
bezirg has quit [Ping timeout: 272 seconds]
freling has joined #ocaml
ygrek has quit [Ping timeout: 245 seconds]
Algebr has quit [Ping timeout: 244 seconds]
BitPuffin has quit [Ping timeout: 272 seconds]
BitPuffin has joined #ocaml
<Anarchos> Is there an ocaml implementation of the Martelli-Montanari algorithm for unification ?
* whitequark has read that as Martelli-Monogatari
tac_ has left #ocaml ["Leaving"]
<Anarchos> whitequark i will do one then :)
<Anarchos> whitequark and make it a functor of a term module
<whitequark> oh, the unification thing
<whitequark> good idea!
<Anarchos> whitequark i printed the article at work ;)
<Anarchos> whitequark and to add more fun to it i will program it in literate programming style.
jao has joined #ocaml
jao has quit [Changing host]
jao has joined #ocaml
dsheets has quit [Ping timeout: 250 seconds]
bezirg has joined #ocaml
eikke__ has quit [Ping timeout: 240 seconds]
eikke__ has joined #ocaml
<Drup> whitequark: how would you go at iterating on all the edges of the CFG of an llvm function ?
<Drup> iterate at all the successor for each basicblock ?
<mrvn> .oO(recursively)
hbar has joined #ocaml
<mrvn> DID WE FLY TO THE MOON TOO SOON?
<whitequark> Drup: yes
<whitequark> no other way
<Drup> that's what I though, good
<Drup> whitequark: If I consider a terminator, is there a simple way to retrieve the lluses associated with the edges to the next basic blocks ?
<whitequark> I don't think so
<Drup> :(
<whitequark> what API would you propose? we can get it merged
<Drup> I don't really propose anything, I'm having fun at implementing this toy https://github.com/Drup/llvmgraph
<Drup> for now, an edge is just a couple of basicblock
<Drup> I would like to label it by the lluse
<Drup> not sure if it's actually useful, though
<Drup> I think it is
<whitequark> hrm
<Drup> for predecessors, it's easy, since I get predecessors though lluse to begin with
<Drup> for sucessors ...
<Drup> (I'm reworking it currently)
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
thomasga has joined #ocaml
xvilka has joined #ocaml
dcampbell_ has joined #ocaml
<xvilka> hi! trying to make a FFI from this http://paste.kolibrios.org/show/272 - here is what i got http://paste.kolibrios.org/show/271 - is it ok? Because in "Real World OCaml" syntax differs from time to time in the FFI chapter
yomimono has joined #ocaml
tani has quit [Quit: Verlassend]
yomimono has quit [Client Quit]
yomimono has joined #ocaml
<mrvn> does it compile?
<mrvn> you know, compilers are verry good at checking syntax.
<dcampbell_> I would like to structure my code so that I have a module A with a submodule B, and corresponding files a/b.ml, a/b.mli b/mod.ml b/mod.mli (or similar name) where everything in mod.mli can be referenced outside the module as a.thing_in_a, is there an easy/standard way to do this sort of thing?
<dcampbell_> a/mod.ml and a/mod.mli I mean
<mrvn> dcampbell_: in a.mli include the mod.mli
kakadu_ has quit [Quit: Konversation terminated!]
thomasga1 has joined #ocaml
<Drup> dcampbell_: you want that your directory structure is reflected at the module level ? If so, that's not how it works in ocaml
<xvilka> hm, strange, i have ~/.ocamlinit with proper requires still have a bitching about unbound module 'Core'
Arsenik has quit [Remote host closed the connection]
<mrvn> dcampbell_: I've been thinking of having a/b.ml provide an module type Internal and External and then in a/b.mli include the Internal type and in a then the External type. The idea would be to keep all the interface and code in a single file.
<Drup> xvilka: there are obvious mistakes, but I will let your decipher the error messages, for educational purposes :D
thomasga has quit [Ping timeout: 240 seconds]
<Drup> whitequark: if you are bored, I don't mind you reading this part https://github.com/Drup/llvmgraph/blob/master/src/llvmgraph.ml#L75-L101
<dcampbell_> Drup, yeah that is what I would like, a way to have the module and directory structure mirror each other
<whitequark> Drup: will read soon
<dcampbell_> mrvn, sounds interesting
jao has quit [Ping timeout: 240 seconds]
<xvilka> any gentoo + ocaml users here? should i install opam from some overlay?
<mrvn> I wish I could write "type t = int = internal private int = external abstract" or similar.
<whitequark> mrvn: what would that do?
<mrvn> make it so within the module t is int, in the mli it is private int and there is an _ext.mli where it is abstract
<whitequark> huh? just write the .mli, don't be lazy
<mrvn> whitequark: then you have the information in 3 files
<Drup> the issue is not lazyness, more like keeping up with changes
<mrvn> and tons of duplication
<Drup> if you have a module type in a file
<Drup> it's *very* annoying to have to copy paste it in the mli
<Drup> same for big types
<whitequark> Drup: ppx_import
<mrvn> haven't looked at ppx yet. Is there an introduction to it showing off its cool features?
<Drup> does it work in a ml from the mli ?
<whitequark> Drup: it just finds the cmi in load path
<whitequark> so, yes.
<Drup> whitequark: and yes, I was hoping ppx_import would fullfil this role
<mrvn> type t = A [@id 1] | B [@id 4] of int [@@id_of]
<mrvn> whitequark: Now make that work directly from C enums please
<whitequark> mrvn: ppx_deriving handles that
<mrvn> whitequark: nice.
<whitequark> and you could definitley use ppx_import with ppx_deriving like
<whitequark> type t = [%import: Foo.t] [@@deriving Enum]
<whitequark> mrvn: the problem with C enums is that they don't have a defined ABI
<whitequark> so you can't FFI to them without generating C code anyway
<mrvn> whitequark: they are totaly defined
joncfoo has joined #ocaml
<Drup> we discussed that already.
<mrvn> implementation defined in the calling conventions
<mrvn> and usualy enums are ints or you can specify a different type easily enough
<whitequark> they're not ints with real compilers.
<whitequark> mrvn: well, if you want an importer from C enums, I can make that for you as a PoC
<whitequark> easy enough
WraithM has joined #ocaml
<mrvn> close enough to int that you can ignore the differences
<mrvn> enough C sources do
<whitequark> close enough, except it segfaults
<mrvn> whitequark: what segfaults?
<Drup> whitequark: be a man, like mrvn, and use Obj.magic to fix segfaults.
<whitequark> do I *have* to construct an example which would segfault due to enum size being different, or will you trust my word?
<whitequark> e.g. put it into a structure
<whitequark> after a char
<mrvn> whitequark: in a struct it will be int, unsigned int or larger integer type as needed.
<mrvn> when it is larger then specify it.
<mrvn> doesn't have to work 100% automatic.
<whitequark> what makes you think it will be an int?
<mrvn> I'm more concerned with getting the mapping between C value and ocaml value.
<mrvn> whitequark: that is what the C specs say
<whitequark> where?
<whitequark> I did check them, of course
<bitbckt> 6.7.2.2.
<mrvn> whitequark: wherever it discusses the storage size and alignment requirements for enums.
<bitbckt> Each enumerated type shall be compatible with char, a signed integer type, or an unsigned integer type. The choice of type is implementation-defined, but shall be capable of representing the values of all the members of the enumeration.
<mrvn> bitbckt: exactly, implementation defined.
<whitequark> ≠ is an int.
<mrvn> enum Foo { BLA }; sizeof(Foo) == 4
<mrvn> on all the archs I know.
<bitbckt> it doesn't have to be; that could easily be a char.
<mrvn> bitbckt: it could. It isn't.
<whitequark> mrvn: ... even if that is actually true for all interesting compilers in existence
<whitequark> which I don't believe in
<whitequark> then it's still not entire story
<mrvn> whitequark: 16bit DSPs will have shorts or even char.
<whitequark> no, that's too obscure
<Drup> It reminds me of a very clever comment I read once in some C sources
<whitequark> OCaml doesn't run there anyway
<Drup> "No compiler should be clever enough to optimize that"
<Drup> guess what ?
<whitequark> Drup: oh god no.
<flux> don't forge ocapic!
<mrvn> enum Foo { BLA = 0x123456789abcdefllu }; sizeof(Foo) == 8
<flux> +t
<Drup> whitequark: well, mrvn comment does remind me that
<mrvn> Sometimes, like with that, you would have to specify the type since the default assumption of int wouldn't work.
<Drup> "don't worry, it's ok for all the compiler i know !"
<mrvn> Drup: the compiler can't optimize that. The ABI specifies that a simple enum uses a signed int.
englishm has quit [Remote host closed the connection]
<mrvn> Drup: it's defined in the calling conventions the compiler adheres to for gcc.
<whitequark> hm
avsm has quit [Remote host closed the connection]
<whitequark> mrvn: what about Windows?
englishm has joined #ocaml
<mrvn> whitequark: don't know, don't care.
<Drup> that's not exactly what the paragraph quoted by bitbckt says
<whitequark> Drup: I agree that "ABI docs specify that on every platform OCaml runs on" is sufficient
enquora has joined #ocaml
<mrvn> Drup: what bitbckt says it is implementation defined. That definition is in the ABI in the case of gcc.
<mrvn> s/says/says that/
<whitequark> but I completely disagree with Windows being "don't care"
<mrvn> whitequark: I don't care. you can care. others certainly will.
<mrvn> whitequark: it's likely windows uses int as minimum size too since that is the fastest integer type.
<mrvn> or short because it comes from 16bit.
<bitbckt> fwiw, Windows should always be an int by virtue of being ANSI C, not C99 (from which I quoted)
<bitbckt> in ANSI-land, enums are always ints.
<whitequark> bitbckt: thanks
<whitequark> mrvn: okay, so I agree: your solution is generic enough
<bitbckt> np
<whitequark> in practice for OCaml at least
<whitequark> s,generic,general,
<mrvn> whitequark: anyway. You need the option of specifying a type anyway, for when int is insufficient. The ppx code could deduce that from the values but that might be harder to do.
<mrvn> and differ for every arch/abi
bezirg has quit [Ping timeout: 244 seconds]
<Drup> since we are on the subject
<whitequark> it'll have to have some ABI knowledge anyway
<whitequark> could as well encode the rules
<whitequark> they're not *That* complex
<Drup> whitequark: for my enum issue, do you have a minimal example I can extend/play with ?
<mrvn> does ctypes work with ppx?
<whitequark> no
<whitequark> and shouldn't
<whitequark> ctypes doesn't parse C headers.
<mrvn> I would want enums parsed through ppx specifically for ctypes
<whitequark> well, sure? it makes sense to use ctypes
<whitequark> Drup: what's your enum issue?
<Drup> bind it, while the rest of my binding is ctypes-powered
<mrvn> Drup: my use case exactly too
<whitequark> Drup: yes, as I've said: substitute it for int unless it has values over 2**32
<whitequark> this should get you going for every platform OCaml is currently available on
<mrvn> whitequark: 2**31 on 32bit.
<Drup> hum, no C needed then ?
<whitequark> right
<whitequark> Drup: I looked at your llvm code and it is ok
<mrvn> actually 2**30, int32 for 2**31, uint32 for 2*32, (u)int64 beyond that
<whitequark> I meant for the C type
<whitequark> but yes, that's true as well
<mrvn> this could get ugly on the ocaml side
<mrvn> did ctypes have something that uses int32/int64 on 32bit archs and plain int on 64bit archs?
<whitequark> nativeint?
<whitequark> and a view
<mrvn> nativeint is nativeint
<whitequark> how would you use different ocaml-side types on different archs?
<mrvn> whitequark: that was the question
<whitequark> why would you want to do that?
<whitequark> you're screwing over all your downstream users, if you have any
<whitequark> including other your modules
englishm has quit [Remote host closed the connection]
englishm has joined #ocaml
<mrvn> int is way faster. One of my projects has an Int63 module that uses int64 on 32bit and plain int on 64bit. Uses different sources depending on the arch.
<mrvn> only for binary though, bytecode is always int64.
<whitequark> well.
<whitequark> you could cleverly use ppx_import and ppx_clang for that
<whitequark> (ppx_clang being the hypothetical extension that extracts definitions from headers)
hhugo has joined #ocaml
joncfoo has left #ocaml ["Leaving"]
joncfoo has joined #ocaml
<joncfoo> Is there an easy way to create string representations of custom types? So far I've figured out that I have to use sexplib (http://hastebin.com/icilaromup.hs)
<Drup> sexplib, as you said, or deriving. In the next version of ocaml, ppx_deriving
<mrvn> Drup: 4.0.2?
<joncfoo> thanks
<Drup> yes
englishm has quit [Remote host closed the connection]
<whitequark> mrvn: 4.02
hhugo has quit [Quit: Leaving.]
<Drup> ah, yeah, obviously
shinnya has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
mcclurmc has joined #ocaml
darkf has joined #ocaml
<Drup> ok, I'm quite happy with my experimentation x)
<Drup> whitequark: https://github.com/Drup/llvmgraph/blob/master/test/colordot.ml read a bitcode, run k-color algorithm on it, output the dot file
<Drup> 38 line.
englishm has joined #ocaml
<whitequark> hmmm, very interesting
<bitbckt> heh. cute. :)
<Drup> It's ready only, but you get access to all read-only algorithm from ocamldoc, so that's connex component, k-coloration, all flow and path stuff
<Drup> ocamlgraph*
<whitequark> I wonder if you could make it writable
<Drup> and I made a little functor so that you can give it another graph structure (that will be writable) to copy the graph
enquora has quit [Quit: enquora]
<Drup> so, technically, it's writable, there is no overhead, a graph *is* an llvm function and a vertex *is* a llbasicblock
<Drup> (that's the beauty of it :D)
mcclurmc has quit [Remote host closed the connection]
<Drup> about the fact to make it actually writable, as Graph.Sig.I ...
<Drup> the issue is that adding an edge, in ocamlgraph sense, is heavily under specified from llvm's point of view
<whitequark> I think it's underspecified from ocamlgraph's point of view too
<whitequark> i.e.: why would you try to want an edge?
<Drup> for example, the dominator functor need add_edge
<Drup> (don't ask me why, I didn't look at the code, I find it extremely weird)
<whitequark> I bet it tries to break critical edges itself, or something like that
<Drup> probably, but I feel like you could split the functor in a read-only part
<Drup> I'm gonna add pre-applied functors before releasing it
tov has joined #ocaml
maufred has quit [Ping timeout: 255 seconds]
eikke__ has quit [Ping timeout: 240 seconds]
ebzzry has joined #ocaml
maattdd has joined #ocaml
maufred has joined #ocaml
<Drup> hum, the path functor are going to be suboptimal with this interface
<Drup> they compute the weigh from the label, which is always unit :(
madroach has quit [Ping timeout: 250 seconds]
<whitequark> huh, what would you normally assign?
<Drup> on the label ?
<whitequark> eys
<whitequark> yes
<Drup> for now, it's always unit, there is no label
madroach has joined #ocaml
<Drup> I would like to add the use, but as I told you before, it's annoying to get the use when looking at the successors
<Drup> I don't see any way to do that, except by getting the successor, getting it's uses and finding the right one by iteration on them
Thooms_ has quit [Ping timeout: 260 seconds]
<Drup> and it's horrible, I don't want to do that
<whitequark> simply mark the edge with (from llblock, to llblock) tuple
<Drup> that's what I do currently, but setting this couple for the label is going to make the function E.create very akward
mcclurmc has joined #ocaml
<Drup> does the C++ interface contain a mapping from user to uses that is not in the C/Ocaml api ?
<whitequark> hrm
<whitequark> yes. getOperandUSe
<Drup> ah!
<whitequark> you can add that to the C & OCaml APIs & I'll merge.
<whitequark> it seems like a thing that could be reviewed post-commit
thomasga1 has quit [Quit: Leaving.]
* Drup takes a deep breath at the idea of writing C code.
mcclurmc has quit [Ping timeout: 244 seconds]
<whitequark> C++ code, even.
<Drup> :O
<whitequark> muahahaha
<Drup> I'm lost and terrified without my typechecker :(
<whitequark> it's a trivial change though
mcclurmc has joined #ocaml
araujo has quit [Read error: Connection reset by peer]
araujo has joined #ocaml
BitPuffin has quit [Ping timeout: 240 seconds]
maufred has quit [Ping timeout: 255 seconds]
<Drup> whitequark: some read-only algorithm use marking (http://ocamlgraph.lri.fr/doc/Sig.IM.Mark.html) for a more efficient version, do I think I should add a marked interface (basically, a graph would a couple llfun, int Hashtable) or I don't care ?
englishm has quit [Remote host closed the connection]
maufred has joined #ocaml
yomimono has quit [Ping timeout: 250 seconds]
<Drup> (I'm busily applying functor, then I will try to open some C++ file)
englishm has joined #ocaml
<Drup> -"I think" =')
rgrinberg has quit [Quit: Leaving.]
S11001001 has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]