...
04:04:32  <struktured> argh.. my async parallel program is a black box of no activity lol
12:28:27  <companion_cube> https://github.com/lindig/lua-ml looks nice! :)
14:11:11  <sagotch> what is the best (simplest) way to install my own program. I already used ocamlfind install to install a library, but what about binary file? A tool to automatically find where to install bin
14:11:51  <companion_cube> if you have a configure file (using oasis for instance) you can cp to the bindir
14:11:54  <flux> I don't think there is one. programs usually just default to /usr/local/bin and if that's not ok, the user can somehow override it
14:13:53  <troydm> what's the name of a function to extract value from option ?
14:14:02  <companion_cube> match ... with
14:14:06  <companion_cube> :D
14:14:12  <flux> there is no such function in ocaml standard library
14:14:30  <flux> (Batteries comes with Option.get and a variant, though)
14:14:51  <companion_cube> basically options are designed to force you to pattern match
14:14:59  <companion_cube> because you need to deal with both cases
14:15:06  <pippijn> yes
14:15:11  <flux> but, there can be cases where you just know there is a value
14:15:16  <pippijn> yes
14:15:21  <pippijn> rarely
14:15:26  <pippijn> and I tend to avoid those cases
14:15:31  <flux> and doing a match in that case with just adds noise, not information
14:16:10  <pippijn> in most cases, you can add a match in the place where you gain the knowledge that it's Some
14:16:32  <pippijn> by slightly restructuring the code, perhaps splitting off some code into another function
14:17:08  <pippijn> if you know it by secondary circumstances, I don't think that's very good style
14:17:43  <pippijn> let opt = if something then Some stuff else None in if something then (* I know opt is Some *)
14:17:45  <flux> here is an example from my gtk-using app: let id = ref None in id := Some ( GMain.idle.add @@ fun -> GMain.idle.remove (Option.get id); .. more code ..
14:17:52  <flux> is that a bad case to use?
14:18:02  <pippijn> no
14:18:07  <pippijn> I think that's reasonable
14:18:36  <pippijn> I think you'd much more often get such cases in side-effectful code
14:19:41  <pippijn> it's Option.get !id, right?
14:19:55  <flux> right, I wrote that out as it was not an oneliner originally
14:20:08  <flux> GMain.Idle as well :)
14:20:15  <ggole> The alternative is to come up with a dummy value, which isn't always a good idea.
14:20:33  <companion_cube> here, couldn't you use a function reference directly?
14:20:43  <pippijn> ggole: right, actually I usually do that
14:20:59  <ggole> It can be preferable to matching on options in a million places
14:21:05  <flux> companion_cube, ?. note that I'm not assigning a function there.
14:21:20  <pippijn> most of my record types have an empty_record value
14:21:24  <flux> ggole, or maybe you could just use the equivalent of Option.get..
14:21:32  <companion_cube> oh
14:21:38  <ggole> But you are effectively lying to the type system by encoding your own "None"
14:21:47  <companion_cube> ggole: you can use a monad on options
14:22:02  <companion_cube> so that only to extract the final value is matching needed
14:22:59  <ggole> That's reasonable if you're going the option route, I guess.
14:26:32  <pippijn> I love it when I have an actual use case for option monads
14:26:37  <pippijn> it only happened twice, I think
14:27:00  <pippijn> https://paste.xinu.at/EMCRN/
14:27:03  <pippijn> this is one
14:28:58  <companion_cube> what's the type of  perform?
14:29:48  <pippijn> no type
14:29:51  <flux> it's a language extension, so it's not a function
14:29:52  <pippijn> it's "do" from haskell
14:30:24  <companion_cube> ah, I see
14:30:29  <companion_cube> that's cheating :D
14:30:41  <companion_cube> I'd use >>= personally
14:30:50  <flux> prettyy... not.
14:30:50  <pippijn> I think this is prettier
14:30:52  <flux> ;)
14:31:11  <flux> btw, is there an extension point based version of that kind of syntax extension? is it possible?
14:31:12  <companion_cube> well it's more explicit
14:31:25  <companion_cube> flux: I think extension points will allow this, yes
14:31:34  <pippijn> flux: wmeyer made one, I think
14:31:37  <companion_cube> things like    let%lwt x = ......  in  let%lwt y = .....
14:31:38  <pippijn> a ppx monad thing
14:31:44  <Drup> flux: http://www.danmey.org/omonad.html
14:31:48  <pippijn> yes, that
14:32:25  <ggole> gnuCond? Is that the x ?: y extension?
14:32:26  <companion_cube> awww, why did they use "fail" :/
14:32:26  <flux> coo, just opam install away. probably not impossible to integrate to ocamlbuild either :)
14:32:46  <pippijn> ggole: yep
14:33:03  <flux> though omonad probably doesn't work with ocamlfind in any meaningful way?
14:33:17  <pippijn> ggole: I prefer to keep it separate and not pollute the normal cond with options
14:33:28  <ggole> Yeah.
14:33:50  <flux> interesting how it's ListMonad.(begin .. end). is that redudant usage there or required by the syntax?
14:35:55  <flux> or maybe it's even a bug
14:35:59  <flux> in the example
14:36:10  <flux> actually it looks like it should be ListMonad.(perform begin ..
14:36:28  <flux> (so it's "perform (expr)")
14:36:46  <flux> pretty nice regardless!
14:43:57  <troydm> how do i pring string into out_channel
14:44:01  <troydm> without using printf?
14:44:08  <troydm> i don't need formatted output
14:44:18  <troydm> just output of string
14:44:19  <flux> print_string
14:44:21  <flux> hmm
14:44:24  <flux> no..
14:44:28  <flux> but there are functions to do that
14:44:38  <flux> output_string?
14:44:39  <pippijn> print_string and print_endline
14:44:43  <pippijn> oh, out_channel
14:44:46  <pippijn> yes, output_string
14:44:50  <pippijn> (and there is no output_endline)
14:45:28  <troydm> pippijn: oic, thx
14:46:05  <pippijn> I'm not so happy with ocaml's IO library
14:48:38  <companion_cube> agreed, out_channel being incompatible with buffers and strings isn't very nice
14:48:51  <companion_cube> maybe the IO system is where objects could help (as in ocamlnet)
14:48:53  <pippijn> out_channel being closed
14:49:16  <companion_cube> exactly
14:49:23  <companion_cube> it should be a class type
14:49:37  <pippijn> or have a function constructor
14:49:45  <companion_cube> also, why not
14:49:57  <companion_cube> batteries has batIO, but several people seem to dislike it
14:50:15  <pippijn> heh
14:50:26  <pippijn> Michael Angelo Batio
14:50:29  <pippijn> I should have known
14:50:38  <companion_cube> ?
14:50:43  <pippijn> I googled BatIO
14:50:50  <pippijn> got this guitarist
14:50:53  <companion_cube> :)
15:39:21  <rks_> if someone is using the "deriving" syntax extension, feel free to contribute to https://github.com/the-lambda-church/merlin/issues/168 :]
15:46:23  <troydm> the lambda church sounds like some kind of religious cult
15:46:53  <troydm> are functional programmers just fanatic cultists? :)
15:47:26  <rks_> either that or they like cheesy word plays
15:57:21  <smondet> rks_: I think anyone using .eliom files is using deriving, but Eliom syntaxes are not handled by merlin anyway, right?
16:44:28  <rks_> smondet: no it's not (for the moment)
16:44:45  <rks_> but I was refering to the "tell me which ones are the most useful/needed" :)
16:47:00  <adrien_oww> cookies, by far
17:13:08  <ArthurB> hi all, I'm having issues compiling ocaml from the git head
17:13:59  <ArthurB> configure is fine, but when I make world, it complains that "Unbound module Ocamlbuild_pack"
17:15:50  <ArthurB> ahhhh I think it does not like threaded compilation (-j in make)
19:19:15  <tizoc> there is no direct way of compiling bytecode into memory and then loading it from memory, right? (I'm checking the Dynlink module)
19:20:08  <adrien> well, first, you'd nee the compiler-libs
19:20:33  <adrien> maybe the toplevel does everything without writing on disk but I couldn't tell for sure
19:22:12  <def-lkb> the toplevel does everything in mem, exccept for finding dependencies (cmis are read from disk)
19:31:11  <tizoc> is compiler-libs documented anywhere? somehow I have them installed already but I cannot find docs online and http://caml.inria.fr/svn/ocaml/trunk/compilerlibs/ is empty
19:34:16  <adrien> compiler-libs is the package name
19:34:28  <adrien> they're from the compiler itself
19:35:40  <bernardofpc> adrien: """GtkPixmap has been deprecated since GTK+ 2.0 and should not be used in newly written code. Use GtkImage instead.""" Is there GtkImage in lablGtk ?
19:35:59  <adrien> use GtkPixmap :P
19:36:35  <adrien> bernardofpc: to use in what?
19:36:42  <adrien> actually
19:36:48  <adrien> try in GtkMisc, GMisc
19:37:32  <adrien> bernardofpc: yeah, there's GMisc.image
19:37:35  <bernardofpc> adrien: my idea is that I will have a fair amount of graphics (say curves drawn point by point because simulation)
19:37:59  <bernardofpc> so I want to render them in a layer-0
19:38:05  <adrien> I guess they deprecated it because they were switching to Cairo
19:38:26  <bernardofpc> and then some part will do an animation, which I'd put on layer-1
19:38:57  <bernardofpc> so that I can care about managing layer-1 only, and then render will properly (I don't know how yet) fuse them
19:39:04  <bernardofpc> so I started learning more about pixmaps
19:39:13  <bernardofpc> and then I found the deprecation just now
19:41:11  <adrien> I wasn't aware of it, or at least I kept on forgetting it
19:41:16  <adrien> I'm not a huge fan of Cairo
19:41:20  <adrien> it's fairly slow
19:41:57  <bernardofpc> well, I can take a suggestion on my basic problem ;-)
19:42:24  <adrien> GMisc.image? :P
19:42:47  <bernardofpc> I don't know how it works, but I'll look into it
19:43:10  <bernardofpc> oh, other quesiton
19:43:29  <bernardofpc> is there some place where the magic constants GDK_BUTTON1_MASK get declared ?
19:43:54  <bernardofpc> grep did not answer me)
19:48:10  <bernardofpc> o bit-test (GdkEvent.Motion.state ev) for the button pressed
19:48:17  <bernardofpc> *to bit-test
19:49:49  <adrien> bernardofpc: remove "GDK_"
19:49:53  <adrien> check again
19:54:51  <bernardofpc> no luck :/
19:55:06  <bernardofpc> I do find a lot of BUTTON1, but those are variants
19:55:14  <bernardofpc> `BUTTON1 or alike
19:55:25  <adrien>  :)
19:55:32  <bernardofpc> the compiler seems not to like comparing these with integers
19:55:37  <adrien> bernardofpc: you're grepping in the source?
19:55:44  <bernardofpc> (but maybe I shouldn't land them)
19:56:04  <bernardofpc> adrien: both the source and the /usr/lib/ocaml/lablgtk2/ dir
19:56:21  <adrien> look at .vars file
19:56:39  <adrien> they're read by varcc and that creates several files which are then compiled
19:56:54  <adrien> the "GDK_" bit is factored from the names
19:58:34  <bernardofpc> how nice of them :/
19:58:46  <bernardofpc> (well, It's better for maintainability, worse for grep)
19:59:31  <bernardofpc> still I see no "BUTTON1"
20:00:26  <bernardofpc> hum, so maybe they are "GDK_" `BUTTON1_MOTION instead of _MASK
20:00:41  <bernardofpc> oh no
20:00:47  <bernardofpc> its B1_MOTON_MASK
20:00:52  <bernardofpc> with a GDK in front
20:00:58  <bernardofpc> ok...
20:01:02  <bernardofpc> by the way
20:01:15  <bernardofpc> how do I mention a variant `BLAH  in module Foo ?
20:01:19  <bernardofpc> Foo.(`BLAH) ?
20:01:23  <adrien> `BLAH
20:01:34  <bernardofpc> variants have no namespace ?
20:02:35  <adrien> oh
20:02:44  <adrien> I've discovered a new thing in the syntax of .var files
20:02:50  <adrien> type modifier "gdkModifier" = "GDK_" [ `SHIFT | `LOCK | `CONTROL | `MOD1 | `MOD2 | `MOD3 | `MOD4 | `MOD5 | `BUTTON1 | `BUTTON2 | `BUTTON3 | `BUTTON4 | `BUTTON5 | `SUPER | `HYPER | `META | `RELEASE ] "_MASK"
20:03:01  <adrien> that there can also be a shared _suf_fix
20:03:09  <adrien> thought it only applied to prefixes
20:03:54  <bernardofpc> the compiler still does not like me
20:04:16  <adrien> what do you try?
20:04:53  <bernardofpc> let (a:int) = state ev in if a land `GDK_BUTTON1_MASK = `GDK_BUTTON1_MASK then ... does not compile
20:05:09  <bernardofpc> maybe there's a function to check if a flag is in state
20:05:34  <adrien> a land ... ?
20:05:36  <adrien> what?
20:05:44  <adrien> these are not integers
20:05:49  <adrien> they're polymorphic variants
20:05:52  <adrien> they're hashes
20:05:59  <bernardofpc> most certainly
20:06:03  <adrien> lablgtk should provide functions to do the check
20:06:10  <adrien> and that would involve going through C
20:06:13  <bernardofpc> but if I do "a land 256 = 256" it works
20:06:21  <adrien> but I suspect it does another approach
20:06:26  <adrien> s/does/uses/
20:07:13  <bernardofpc> they belong into "enum GdkModifierType" on Gtk-land
20:07:16  <adrien> which callback do you register on?
20:07:48  <bernardofpc> I'm inside the callback that handles motion events
20:08:00  <bernardofpc> and I want to know if BUTTON1 is pressed
20:08:03  <adrien> what is its name?
20:08:27  <bernardofpc> ignore(canvas#event#connect#motion_notify ~callback:canvas_motion);
20:09:24  <bernardofpc> and then I'm inside canvas_motion ev = ... let state = GdkEvent.Motion.state ev in ...
20:10:19  <bernardofpc> val test_modifier : Tags.modifier -> int -> bool -> I guess I found
20:10:40  <bernardofpc> (of course... once you know the type, you grep in .mli !!)
20:10:47  <bernardofpc> thanks adrien
20:11:51  <adrien> I usually have "ocamlbrowser -I $(ocamlfind query lablgtk2)" opened when I do lablgtk stuff
20:12:17  <adrien> I'm going to save rks_ and def-lkb some sweat and say merlin can be used too
20:14:29  <rks_> :D
20:14:41  <bernardofpc> no merlin for me (I'm unable to compile from source, and there's no opam in my distro neither)
20:14:45  <rks_> http://ocamloscope.herokuapp.com/ might be more useful
20:15:09  <rks_> bernardofpc: oh, what's the problem?
20:15:23  <rks_> you could open an issue for your compilation problem, so we look into it
20:16:44  <adrien> bernardofpc: and ocamlbrowser?
20:16:51  <bernardofpc> neither, I guess
20:16:57  <adrien> hmm
20:17:02  <adrien> it's shipped in ocaml
20:18:44  <bernardofpc> it's a Tk interface ?
20:18:51  <adrien> yes
20:19:02  <bernardofpc> I see
20:19:18  <adrien> bit weird at first but you can get fairly efficient with it
20:19:50  <rks_> ocp-index offers something similar but with a curse interface
20:19:54  <rks_> (i.e. it's nicer!)
20:21:43  <adrien> you cannot use a mouse wheel with it
20:26:57  <bernardofpc> adrien: ocamlbrowser finds BUTTON1 ??
20:41:03  <adrien> bernardofpc: no; but I meant using it to quickly get the type of a function and navigate to the related functions
20:42:11  <bernardofpc> right, this certainly will help
20:44:38  <flux> nice, it covers operators as well :) Error: Unbound value -~. Did you mean --., -. or ~-.?
21:12:09  <adrien> pippijn: around?
21:13:37  <pippijn> adrien: just in time
21:13:42  <pippijn> adrien: yes
21:14:22  <adrien> pippijn: I wanted to ask you what "Sie verzichten damit aber auf Zusatzleistungen und Services für die wir Ihre Kundendaten benötigen." would mean, it's from notebooksbilliger.de and I roughly understand it but it's not very clear
21:15:15  <pippijn> with this action, you waive your right to additional services and.. services for which we would need your customer data
21:15:30  <adrien> ah, thanks!
21:15:47  <adrien> "waive" is very important here
21:15:54  <pippijn> verzichten
21:16:10  <adrien> google wouldn't translate it that way
21:16:15  <pippijn> http://dict.leo.org/#/search=verzichten&searchLoc=0&resultOrder=basic&multiwordShowSingle=on
21:16:27  <adrien>  :)
21:16:41  <adrien> buying a new laptop almost in emergency
21:16:48  <pippijn> I did that once
21:16:58  <pippijn> it wasn't the worst machine I ever had
21:17:01  <adrien> and notebooksbilliger has a freedos option which is way less expensive
21:17:06  <pippijn> yeah
21:17:19  <pippijn> freedos = no OS
21:17:22  <pippijn> essentially :)
21:17:32  <pippijn> but it's funny that they actually bother to put it on there
21:17:40  <adrien> heh, I've been looking at it for some time now but since I'm leaving for 4-5 days on tomorrow, I want to buy it before I leave to not delay it too much
21:17:50  <adrien> they might have to ship at least something
21:18:05  <adrien> I have no idea what I'm going to waive
21:18:12  <pippijn> me neither
21:18:31  <pippijn> I'm going to bed, meeting tomorrow morning
21:18:32  <pippijn> good night
21:18:39  <adrien> night
21:18:45  <adrien> and good luck for the meeting :P
21:19:06  <companion_cube> good night pippijn
21:19:20  <companion_cube> http://vrac.cedeela.fr/truc.ml ← today I'm reinventing the sorting wheel ^^
21:19:24  <companion_cube> (just for fun of course)
21:28:10  <adrien> hmm, they only ship in germany and austria
21:34:15  <erider> hi all
21:34:57  <companion_cube> hi erider
22:04:15  <ArthurB> would it be fair to say that the difference between class and module in ocaml maps well to the difference between class with no virtual calls in C++ and those that do use dynamic binding?
22:04:57  <companion_cube> I'm not sure, because in Ocaml modules and classes are totally different wrt typing
22:05:10  <companion_cube> whereas in C++ they are almost the same ("virtual" excepted)
22:05:11  <ArthurB> in this respect, emulating inheritance with a functor is the equivalent of the Curiously Recurring Template trick
22:05:39  <ArthurB> companion_cube: they look similar but they are quite different
22:06:01  <companion_cube> in ocaml they don't look similar at all
22:06:15  <companion_cube> (but yeah, modules are static dispatch, objects dynamic dispatch)
22:12:24  <ArthurB> I'm somewhat new to ocaml  development
22:12:50  <ArthurB> what do most people commonly work with, modules or objects?
22:13:07  <bitbckt> modules.
22:13:44  <companion_cube> ArthurB: you had a fair point though, objects are sometimes used when dynamic dispatch is useful
22:16:46  <ArthurB> so in CPP, you can do a lot with the templating language to help you resolve types at compile time
22:17:25  <ArthurB> I work in hft where the cost of virtual calls is too high, and there are very often static workarounds
22:17:56  <companion_cube> apparently some trading can be done in ocaml, see Jane Street ;)
22:34:17  <Drup> (adrien : do you have a proposition for a drawing engine to replace cairo ?)
...