zheng.li / archive / buzzlogs / ocaml /
...
06:35:38  <appleby> Drup: hey
06:35:47  <appleby> you linked me to this lablgtk tutorial
06:35:48  <appleby> http://plus.kaist.ac.kr/~shoh/ocaml/lablgtk2/lablgtk2-tutorial/
06:35:49  <appleby> bt
06:35:53  <appleby> but it won't load anymore for some reason?
06:58:57  <adrien> bluh
06:59:15  <adrien> crap
06:59:27  <adrien> I don't have time to handle it
07:00:31  <adrien> (I have no idea what the copyrights aer)
07:01:02  <adrien> appleby: my wip quick tutorial: http://notk.org/~adrien/lablgtk_tutorial/tutorial.html
07:01:17  <appleby> wip?
07:01:19  <adrien> and the other, longer, one from archive.org: https://web.archive.org/web/20130602074257/http://plus.kaist.ac.kr/~shoh/ocaml/lablgtk2/lablgtk2-tutorial/
07:01:23  <adrien> work-in-progress
07:01:39  <adrien> although it's mostly done; I need to remove the pony images from the screenshots mostly
07:02:19  <appleby> is that archive the same as the link i posted?
07:02:31  <adrien> yes
07:03:32  <appleby> nice, thx
07:05:48  <appleby> if I find a reference to a module
07:05:50  <appleby> for example
07:05:55  <appleby>   Arg.parse options
07:06:07  <appleby> why is it that I can't find the file arg or Arg.ml ?
07:07:13  <Drup> where are you looking ?
07:07:29  <adrien> Arg is from the standard library
07:07:50  <appleby> like Core?
07:08:08  <adrien> no, Core is a replacement for the standard library
07:08:18  <appleby> k
07:08:20  <appleby> so is it like
07:08:21  <appleby> in files
07:08:23  <appleby> somewhere?
07:08:42  <appleby> is there anyway someone can help me with my huge ass project
07:09:01  <adrien> "man Arg" should give you some doc
07:09:13  <appleby> I have < 3 months to develop this huge project to fly a drone
07:09:19  <appleby> I have 8 other people on my team
07:09:25  <appleby> only 2 software
07:10:01  <adrien> only 2 software, you're lucky then
07:10:16  <appleby> hell no
07:10:20  <appleby> like 80% of the project is software
07:10:40  <appleby> so say there is a reference to a module in a .ml file
07:10:50  <appleby> what possible places can I find that ml file
07:10:52  <ggole> The stdlib source is sitting in /usr/lib/ocaml/ on my machine
07:10:54  <appleby> i mean the module
07:10:59  <appleby> oh okay
07:11:04  <appleby> so it's either in the ocaml thing
07:11:09  <appleby> or in a local directly
07:11:11  <appleby> directory*
07:11:16  <adrien> appleby: but why are you after the .ml file?
07:11:28  <ggole> You can direct the compiler to look in other directories, too
07:11:29  <appleby> well it's jsut easier to reverse engineerthat way
07:11:44  <ggole> Much like C compilers
07:12:01  <adrien> appleby: huh, why?
07:12:13  <adrien> there is documentation in the .mli which then gets into the manpage and on the website
07:12:27  <appleby> k
07:12:35  <appleby> then in that case maybe i'm looking for the mli file
07:12:35  <appleby> haha
07:12:41  <ggole> (The .mli is in the same place, so...)
07:12:50  <appleby> what's a good
07:12:57  <appleby> what's a good ocaml editor for mac
07:13:01  <appleby> i'm using eclipse right now
07:13:18  <ggole> I think most people use emacs or vim.
07:13:23  <ggole> Any good editor will suffice.
07:13:30  <adrien> and on my laptop I can directly access file:///usr/doc/ocaml-4.02.0/ocaml-refman.html and file:///usr/doc/ocaml-4.02.0/ocaml-refman.html#htoc299 for the standard library in particular (which contains Arg) [ of course, you're not running 4.02 ]
07:13:39  <appleby> like do those have syntax highlighting
07:13:57  <ggole> Yep.
07:14:21  <ggole> Well, you might need to install some stuff for the editor: depends
07:14:34  <Drup> actually; emacs/vim have far more than syntax highlighting, thanks to merlin
07:14:49  <appleby> what stuff
07:14:54  <Drup> I think there is an experimental merlin support for textmate too
07:17:15  <ggole> Merlin does completion, jump to definition, shows you types of things, etc
07:17:27  <ggole> Can be handy.
07:17:54  <Drup> and inline typechecking while editing
07:18:45  <appleby> niceee
07:19:39  <appleby> how can i make emacs highlight
07:19:43  <appleby> merlin?
07:20:32  <Drup> just use the tuareg mode for that
07:21:04  <appleby> how
07:22:00  <Drup> https://github.com/the-lambda-church/merlin/wiki/emacs-from-scratch
07:23:43  <appleby> ok
07:23:56  <appleby> do you know where to find emacs config file on mac?
07:24:50  <Drup> don't ask me any help about mac
07:25:14  <Drup> I don't know anything about it and I hope that it stay that way
07:27:48  <appleby> haha
07:46:23  <appleby> Drup
07:46:29  <appleby> in emacs what is C-x C-f
07:47:35  <Drup> appleby, I like to help, but I'm not a proxy to google =)
07:48:10  <adrien> appleby: you should look for a tutorial/introduction to emacs
07:48:13  <appleby> like i don't know how to execute it
07:48:28  <adrien> and to the caml-mode/tuareg for emacs
07:48:40  <flux> appleby, C-h k (somekeybinding) will tell you the function
07:48:54  <flux> and for me it's ido-find-file, but I may have customized it
07:53:10  <appleby> why when I created a ~./emacs file and put this into it:
07:53:11  <appleby>     (add-to-list 'load-path "~/.elisp/tuareg-mode")
07:53:11  <appleby>     (autoload 'tuareg-mode "tuareg" "Major mode for editing Caml code" t)
07:53:13  <appleby>     (autoload 'camldebug "camldebug" "Run the Caml debugger" t)
07:53:14  <appleby>     (autoload 'tuareg-imenu-set-imenu "tuareg-imenu"
07:53:14  <appleby>       "Configuration of imenu for tuareg" t)
07:53:17  <appleby> I do not get tuareg mode?
07:53:25  <appleby> I put the tuareg files in the right directory i think
07:55:52  <ggole> You need an auto-mode-alist entry for tuareg mode, probably
07:55:59  <ggole> Does M-x tuareg-mode work?
07:56:58  <appleby> says symbol's definition is void
07:57:36  <ggole> Sometime didn't work then.
07:57:39  <ggole> *Something
07:59:42  <ggole> Check that the .emacs is running: you can probably just put (message "test!") in it and see if it turns up
08:03:51  <appleby> k
08:04:37  <appleby> and where would it turn up
08:05:08  <ggole> In the *Messages* buffer, see it with C-h e
08:07:08  <appleby> okay
08:07:09  <appleby> I see the test!
08:08:29  <ggole> Hmm :/
08:09:22  <ggole> Double check that the files are in the same place mentioned in the .emacs, I guess
08:10:55  <ggole> You could try loading it manually with M-: (require 'tuareg)
08:11:08  <ggole> If that fails, then it means emacs cannot find the mode.
08:11:16  <appleby> so when I type
08:11:53  <appleby>   /Users/appleby/.elisp/tuareg-mode:
08:11:54  <appleby>   total used in directory 352 available 3730169
08:11:55  <appleby>   drwxr-xr-x  5 appleby  staff     170 Feb 12 01:05 .
08:11:57  <appleby>   drwxr-xr-x  4 appleby  staff     136 Feb 12 01:05 ..
08:11:59  <appleby>   -rw-r--r--@ 1 appleby  staff   29234 Apr 22  2010 camldebug.el
08:11:59  <appleby>   -rw-r--r--@ 1 appleby  staff   12996 Apr 23  2010 sym-lock.el
08:12:00  <appleby>   -rw-r--r--@ 1 appleby  staff  128778 Apr 23  2010 tuareg.el
08:12:18  <appleby> thats what I get when I do C-x C-f  ~/.elisp/tuareg-mode/
08:12:35  <appleby> (add-to-list 'load-path "~/.elisp/tuareg-mode")
08:12:36  <appleby>     (autoload 'tuareg-mode "tuareg" "Major mode for editing Caml code" t)
08:12:37  <appleby>     (autoload 'camldebug "camldebug" "Run the Caml debugger" t)
08:12:39  <appleby>     (autoload 'tuareg-imenu-set-imenu "tuareg-imenu"
08:12:40  <appleby>       "Configuration of imenu for tuareg" t)
08:12:42  <appleby>     (add-hook 'tuareg-mode-hook 'tuareg-imenu-set-imenu)
08:12:43  <appleby>     (setq auto-mode-alist
08:12:45  <appleby>         (append '(("\\.ml[ily]?$" . tuareg-mode)
08:12:46  <appleby> 	          ("\\.topml$" . tuareg-mode))
08:12:48  <appleby>                   auto-mode-alist))
08:12:49  <appleby> (message "test!")
08:12:49  <appleby> and that is my .emacs file
08:12:56  <flux> appleby, have you confirmed your .emacs file is actually executed?
08:13:06  <appleby> the test message works
08:13:10  <flux> appleby, if you go into that buffer and select 'evaluate buffer' from the elisp menu, does it work after that?
08:13:55  <appleby> I see no evaluate button
08:14:03  <ggole> I don't see any mistake :(
08:14:12  <appleby> damn
08:14:14  <flux> you don't have menus in emacs?
08:14:26  <appleby> k
08:14:28  <appleby> I used it
08:14:32  <appleby> and of course I see "test"
08:14:41  <flux> and it still doesn't work?
08:14:46  <flux> I suppose not
08:15:00  <flux> btw, if the 'test' was at the beginning of the file, an error could have stopped its evaluation
08:15:08  <flux> but I think if there was an error, at least now you should see it..
08:15:26  <appleby> so wtf ;(
08:15:38  <flux> M-x eval-expression auto-mode-alist
08:15:45  <flux> is tuareg mode there?
08:16:00  <flux> btw, when you open an .ml file does it go just in the fundamental mode or ocaml mode?
08:17:09  <appleby> fundamental
08:17:34  <appleby> when I type M-x eval-expession
08:17:36  <appleby> then I type space
08:17:46  <appleby> it says [Sole completion]
08:17:47  <flux> well actually you need to press enter
08:17:50  <appleby> k
08:18:15  <appleby> (("\\.ml[ily]?$" . tuareg-mode) ("\\.topml$" . tuareg-mode) ("\\.gpg\\(~\\|\\.~[0-9]+~\\)?\\'" nil epa-file) ("\\.elc\\'" . emacs-lisp-byte-code-mode) ("\\.dz\\'" nil jka-compr) ("\\.xz\\'" nil jka-compr) ("\\.lzma\\'" nil jka-compr) ("\\.lz\\'" nil jka-compr) ("\\.g?z\\'" nil jka-compr) ("\\.bz2\\'" nil jka-compr) ("\\.Z\\'" nil jka-compr) ("\\.vr[hi]?\\'" . vera-mode) ...)
08:18:22  <flux> ok, so that seems to be fine
08:18:42  <flux> though curiously it's mentioned there only once, I would have expected it would be there twice (once after startup, second time after manually evaluating the buffer)
08:18:53  <flux> if you enter M-x tuareg-mode, does it work?
08:19:12  <appleby> says symbol's definition is void
08:20:00  <flux> how about M-x eval-expression (require 'tuareg-mode) ?
08:20:57  <appleby> says
08:21:03  <appleby> let: Invalid read syntax: ")"
08:21:12  <flux> hmm
08:21:17  <flux> that sounds.. weird..
08:21:26  <flux> does your tuareg-mode.el look like it should?
08:21:46  <flux> btw, my tuareg-mode is over 200 kilobytes
08:21:47  <ggole> Huh? Are you getting the prompt down the bottom when you do M-x?
08:22:13  <flux> though it's possibly more recent than one -from 2010-
08:22:17  <flux> maybe you could upgrade it as well :)
08:22:26  <appleby> Wait
08:22:27  <appleby> so when I did
08:22:32  <appleby> M-x eval-expression (require 'tuareg-mode)
08:22:35  <appleby> I was doing M-x eval-expression (require 'tuareg-mode')
08:22:44  <appleby> and now when I do M-x eval-expression (require 'tuareg-mode), it says debugger entered--Lisp error
08:23:14  <appleby> my tuareg.el is 129 kb
08:23:20  <appleby> no tuareg-mode.el
08:23:25  <flux> what are the topmost errors? or you can put the whole shebang at a paste site
08:23:30  <flux> oh, I meant tuareg.el alright
08:23:45  <ggole> It might be (require 'tuareg)
08:23:52  <ggole> But that's what you'd expect if emacs can't find the code.
08:23:55  <flux> and that as well :)
08:24:13  <flux> I just read the autoload command and and mistakenly chose the wrong name
08:24:20  <flux> so, next step, (require 'tuareg) :-)
08:24:26  <appleby> Debugger entered--Lisp error: (file-error "Cannot open load file" "tuareg-mode")
08:24:27  <appleby>   require(tuareg-mode)
08:24:28  <appleby>   eval((require (quote tuareg-mode)) nil)
08:24:30  <appleby>   eval-expression((require (quote tuareg-mode)) nil)
08:24:31  <appleby>   call-interactively(eval-expression record nil)
08:24:32  <appleby>   command-execute(eval-expression record)
08:24:34  <appleby>   execute-extended-command(nil "eval-expression")
08:24:34  <appleby>   call-interactively(execute-extended-command nil nil)
08:24:52  <flux> yes, the topmost line would have done juust fine..
08:25:19  <ggole> Yep, emacs can't find the code.
08:25:22  <ggole> It's not clear why.
08:25:27  <flux> it is clear, the name was wrong
08:25:33  <flux> it should have been (require 'tuareg) in my instructions
08:25:45  <ggole> Didn't he just get a backtrace from that?
08:25:52  <ggole> (If not, forget what I said.)
08:25:56  <flux> "(file-error "Cannot open load file" "tuareg-mode")" looks like 'no'
08:26:05  <appleby> so then...
08:26:12  <ggole> Oh, it's there on the second line. Indeed.
08:26:13  <ggole> Sorry. :)
08:26:13  <appleby> if this is my emacs file
08:26:22  <appleby> (add-to-list 'load-path "~/.elisp/tuareg-mode")
08:26:23  <appleby>     (autoload 'tuareg-mode "tuareg" "Major mode for editing Caml code" t)
08:26:24  <appleby>     (autoload 'camldebug "camldebug" "Run the Caml debugger" t)
08:26:26  <appleby>     (autoload 'tuareg-imenu-set-imenu "tuareg-imenu"
08:26:27  <appleby>       "Configuration of imenu for tuareg" t)
08:26:29  <appleby>     (add-hook 'tuareg-mode-hook 'tuareg-imenu-set-imenu)
08:26:30  <appleby>     (setq auto-mode-alist
08:26:32  <appleby>         (append '(("\\.ml[ily]?$" . tuareg-mode)
08:26:33  <appleby> 	          ("\\.topml$" . tuareg-mode))
08:26:34  <appleby>                   auto-mode-alist))
08:26:35  <appleby> (message "test!")
08:26:36  <appleby> what's wrong
08:26:54  <flux> (you know, people often don't like it when people paste line after another to irc, and rather have it put to a paste site instead)
08:27:01  <appleby> yea, sorry
08:27:07  <flux> you should try if (require 'tuareg) works
08:27:30  <flux> with M-x eval-expression
08:27:41  <appleby> same thing
08:27:43  <appleby> function symbol void
08:28:13  <flux> ok, how about (load-file "~/.elisp/tuareg-mode/tuareg.el") ?
08:28:27  <appleby> with M-x eval?
08:28:30  <flux> yes
08:28:39  <ggole> You can shortcut that with M-:, btw
08:29:04  <appleby> wtf void
08:29:50  <flux> it should return 't'
08:30:01  <flux> well, next step: open tuareg.el in emacs
08:30:05  <flux> and evaluate that buffer
08:30:42  <flux> (also I would remind you that you tuareg.el looks curiously small and old, maybe it has an issue with your emacs that has been solved in a more recent version)
08:31:46  <appleby> for some very weird reason
08:31:51  <appleby> my 2 tuareg files are different
08:31:58  <appleby> one which I copied over from another directory
08:31:58  <flux> 2 tuareg files?
08:32:04  <flux> out of disk space?
08:32:05  <appleby> i downloaded it to my desktop
08:32:13  <appleby> and copied it to the elisp folder
08:32:27  <appleby> ok nvm nvm
08:32:28  <appleby> sorry
08:32:31  <appleby> was scrolled down in one
08:32:56  <appleby> for some reason when I open my tuareg.el in my elisp directory
08:33:04  <appleby> the title of my emacs editor says tuareg.el<2>
08:33:06  <appleby> whatever that means
08:33:15  <flux> you have two different tuareg.el files open in your emacs
08:33:33  <appleby> okay when I evaluate buffer
08:33:36  <appleby> of tuareg.el
08:33:41  <appleby> it says symbol's function def is void
08:34:10  <flux> so maybe there's something wrong in it and that's the ultimate reason why nothing earlier has worked?
08:34:30  <ggole> So the void-function error was tuareg.el all along -_-
08:34:55  <ggole> ...presumably. Which symbol is named in the error?
08:34:55  <appleby> can I get a link to a site
08:35:00  <appleby> doesn't say any symbol
08:35:12  <appleby> I was using this
08:35:13  <appleby> https://who.rocq.inria.fr/Albert.Cohen/tuareg/mode/
08:35:24  <appleby> with version 1.45.7
08:35:48  <ggole> You should see something like Symbol's function definition is void: foo in *Messages*
08:36:02  <flux> maybe here: https://forge.ocamlcore.org/projects/tuareg/
08:36:47  <appleby> ok
08:36:49  <appleby> from that link
08:36:53  <appleby> which files do I need
08:36:56  <appleby> after unzipping
08:37:08  <appleby> just tuareg.el?
08:37:44  <flux> it probably has installation instructions.. I would take all, if it has many .el files they may depend on each other
08:40:21  <appleby> so it says to put this in my emacs file
08:40:22  <appleby> (load "/where/ever/you/put/tuareg-mode/tuareg-site-file")
08:40:30  <appleby> but I have tuareg-site-file.el
08:40:34  <appleby> do I add the .el?
08:40:51  <flux> documentation for load says "Execute a file of Lisp code named FILE. First try FILE with `.elc' appended, then try with `.el',"
08:40:59  <flux> so: no need to add .el
08:41:15  <flux> (btw, documentation for functions can be reached with C-h f functionname)
08:41:32  <appleby> IT WORKED
08:41:50  <flux> congratulations!
08:41:59  <flux> now you can try installing merlin and wondering why it doesn't work.. ;-)
08:42:08  <appleby> lol
08:59:15  <rgrinberg> Drup: marshal should be easy. why bencode however? it's not a very useful protocol outside of reading torrent files imo
08:59:41  <Drup> curiosity :p
09:00:09  <Drup> ( companion_cube has talked too much about it, I'm contaminated )
09:01:35  <rgrinberg> sexplib/binprot might also be interesting
09:02:29  <rgrinberg> P.S. how is the raw ocsigen http stuff? Is there anything I can pillage for cohttp?
09:02:57  <rgrinberg> or is it ocamlnet based?
09:03:08  <Drup> not sure to understand the question
09:03:19  <Drup> ocsigen is not ocamlnet based
09:03:48  <rgrinberg> i mean request/response read/write, cookies, auth, etc.
09:03:50  <Drup> oh, you mean, could you steal feature from ocsigen for cohttp ?
09:04:03  <Drup> yes, you can, that would be desirable actually
09:04:13  <rgrinberg> yeah cohttp has its own but it's not very optimized currently
09:04:44  <rgrinberg> i've looked at what else is there and both ocsigen and ocamlnet have this functionality as a subset as well i believe
09:05:00  <Drup> vincent talked to me a few time about the fact it would be good to make ocsigen more modular, and one way was to use cohttp as base, but, according to what he told me, ocsigen is using stuff that are not in cohttp
09:05:44  <Drup> performance wise, ocsigen is good, probably not fantastic, but quite good
09:06:35  <rgrinberg> yeah I see, that woudl make sense because cohttp is still not nearly as mature
09:07:15  <Drup> the big issue with ocsigen is clearly not feature or performances, it's just the fact that the core is quite in one piece
09:07:54  <Drup> on the other hand, the extension mechanic is nice
09:08:47  <Drup> rgrinberg: if you are interested by this, ask vincent about it, he will tell you far more than I could
09:10:25  <rgrinberg> Drup: thanks, let me do some homework on this first. What I'm interested in should be in: ocsigen/ocsigenserver, correct?
09:10:39  <Drup> yes
09:10:56  <Drup> the code is a bit ... rough on the edge
09:11:44  <rgrinberg> I'm not sure about the code yet but I did try using ocsigen as an http client before
09:11:54  <rgrinberg> the interface was a little... strange
09:11:56  <Drup> oh yeah
09:12:21  <Drup> the http client is a bit weird, since you need to bring the server with it
09:12:41  <Drup> that's one of the "come in one piece" issue I was talking about :)
09:13:42  <Drup> (and this module is admittedly a bit experimental, since it's not used a lot)
09:17:40  <sagotch> I apologize if I alreayd asked, but connection is not good and I think my message did not passed.
09:18:06  <rgrinberg> looks like this is what i need: https://github.com/ocsigen/ocsigenserver/blob/master/src/http/ocsigen_http_com.ml
09:18:13  <sagotch> How to put an unicode char in a string ? writing "中国" is OK, "\u00E9" is not
09:18:31  <Drup> (can confirm your messages did not reach us)
09:20:53  <sagotch> (trying to avoid the use of extern library to handle utf8, cause I just need to parse it, not to make operations on it)
09:25:38  <sagotch> Is there a special character to represent this \u ?
11:03:10  <Kakadu> Can you explain me shortly what is Centre National de la Recherche Scientifique? Is it related to INRIA or OCaml somehow?
11:05:30  <adrien_oww> both INRIA and CNRS are government stuff (mostly)
11:05:36  <adrien_oww> and both are large
11:05:55  <jpdeplaix> CNRS is larger
11:06:03  <jpdeplaix> and not really related to OCaml
12:23:54  <gasche> Kakadu: CNRS and INRIA are French national bodies that pay full-time researchers without teaching obligation
12:53:05  <gasche> def-lkb, rks_: I regret you implement those syntax extensions in Merlin
12:53:34  <rks_> what do you mean?
12:53:38  <gasche> if you said "no", people would have to use -ppx instead, which is easier to support and probably better in the long run
12:53:53  <rks_> well, I think they will
12:54:11  <gasche> currently people conveniently avoid changing their infrastructure, because they can rely on the tooling people to take the burden of non-standard-ism
12:54:14  <rks_> once 4.02 is out, that is
13:02:21  <companion_cube> o/
13:47:46  <sagotch> http://pastebin.com/mhTkEdvJ >> Why do you have to `open Unix` or ask for `d.Unix.tm_year` to avoid the warning?
13:48:47  <sagotch> (btw, I already opened a module in this file which explicitly `open Unix`)
13:49:27  <ggole> open is not recursive
13:50:07  <ggole> I think the the warning is new, and that the code would not compile in previous versions of OCaml
13:50:14  <sagotch> ok, but I specified Unix.tm type in function signature
13:50:56  <ggole> Until very recently, field access was insensitive to type
13:51:06  <ggole> So you had to either open the module or qualify the name.
13:51:19  <sagotch> hum... did not know that
13:51:20  <sagotch> thank you
13:52:33  <sagotch> but what does `d.Unix.tm_year` means?
13:52:59  <flux> the module Unix defines record tm that has field tm_year, and d has type Unix.tm
13:53:15  <flux> actually, ocaml 4.x brings a feature that allows to elide that .Unix from that expression
13:53:38  <flux> though it is considered fragile, so you probably want to disable the associated warning 40 if you are going to use it
13:53:49  <flux> (I'm testing the feature on a couple small projects of mine ;))
13:54:23  <flux> so to answer you question: it returns the tm_year field of the value d :)
13:54:35  <ggole> sagotch: that's the qualification that allows you to use several modules which define records using the same field names
13:55:10  <flux> btw, the feature I mentioned probably requires that the compiler already knows the type of d
13:55:26  <ggole> Basically it's there because type inference isn't precise enough.
13:55:40  <flux> type inference works like this: it sees you have expression d.Unix.tm_year, ok, so d's type must be Unix.tm
13:56:13  <flux> unless it (in 4.x) happens to already know that d is Unix.tm (for example, you have defined that d is a parameter of that type)
13:56:31  <flux> in that case it can realize that ok d.tm_year, well d is Unix.tm so the field comes from there as well
13:56:44  <flux> AFAIK the compiler does not try to search all available modules for records with field tm_year
13:57:17  <flux> nor can a value be polymorphic so that it could have tm_year field of module A or B depending on how the function is called
13:58:49  <sagotch> I understand that, but why isn't `let string_of_date (d : Unix.tm) : string ` enough to infer type? (for what I understood, old compiler where unable to avoid the `.Unix`)
13:58:56  <li6> but… but…
13:58:58  <li6> ÇA NE FAIT PAS SENS
13:59:58  <flux> it is enough to infer type in current ocaml versions
13:59:59  <ggole> It is enough to infer the type of d
14:00:14  <ggole> But in previous OCaml versions, field access was not sensitive to type.
14:01:38  <sagotch> you mean there was no way to tell the compiler which type it was?
14:02:08  <flux> it was possible to tell the type of 'd'
14:02:17  <flux> but it was not used for finding out what fields it has
14:02:45  <flux> when a record field was being accessed in format x.y, the record with field y must have existed in current scope
14:03:13  <flux> so nowadays this works: let f (d : Unix.tm) = d.tm_year  - earlier it did not work
14:03:24  <sagotch> I see
14:03:36  <sagotch> thanks again
14:04:04  <gasche> (to sum up: record fields live in a precise scope, unless you disable this warning and they become attached to their types)
14:04:21  <flux> in some cases, though, you might be happy if your type-inferred code actually read foo.ModuleName.bar
14:04:32  <flux> because in that case you, the person reading the code, can easily infer the type in your head
14:05:02  <flux> but I suppose in many cases it doesn't matter, especially if you are already familiar with the code base, or you have tools such as Merlin available
14:05:30  <flux> actually probably normal ocaml mode is able to tell the type of 'd' precisely in that case..
14:59:43  <rks_> gasche: https://github.com/the-lambda-church/merlin/issues/152 I'll close if you don't answer :)
15:06:47  <gasche> rks_: I don't really know, I'll try to answer by the end of the week
15:07:15  <gasche> installing merlin through OPAM means that I never quite know which version I'm using, as it depends on which switch was enabled when emacs started
15:22:50  <troydm> can i get a value out of option without using match expression
15:23:02  <troydm> is there a function that extracts value from option?
15:24:46  <kaustuv> Option.get in batteries
15:24:56  <kaustuv> nothing in the standard library as far as I know
15:26:59  <kaustuv> My recommendation would be not to avoid match though. It forces you to think about failure conditions and makes your code more robust.
15:30:53  <troydm> kaustuv: k, thx
16:23:19  <rks_> gasche: ok, thanks!
17:37:59  <flux> is this a sufficient bug report to submit on merlin? http://www.modeemi.fi/~flux/ocaml/ocamlmerlin-whitespace.png
17:38:34  <rks_> flux: what's going on?
17:38:42  <flux> the tabs break the location of the error
17:38:52  <rks_> which editor?
17:38:56  <flux> emacs
17:39:02  <rks_> oh.
17:39:08  <rks_> well sure then, report :)
17:39:47  <ggole> But in previous OCaml versions, field access was not sensitive to type.
17:39:52  <ggole> Oops, sorry
17:51:44  <flux> hmm, so does the threading support of merlin work for people?
17:52:06  <flux> or is there actual support.. I just found three instances of threads from the github search..
17:53:31  <flux> a few more with git grep, but still not convinced..
17:53:35  <flux> shall file an issue :)
18:04:42  <flux> but then I have this mysterious case where a let open Vector in .. is singled out by merlin as Vector being a non-existing module..
18:05:16  <flux> dunno why exactly that module, others work. well Batteries' Option is also a similar case..
18:05:26  <flux> can I debug in some useful manner?
18:05:30  <flux> +it
18:06:31  <companion_cube> flux: even with  :Use batteries  or the emacs equivalent
18:10:58  <flux> I put PKG batteries to .merlin
18:11:05  <flux> seems to work with other packages and modules
18:11:28  <flux> not sure what :Use batteries does in vim?
18:11:31  <companion_cube> the same
18:11:39  <companion_cube> so it's something else, don't know what
18:12:17  <flux> actually, it could be related to the threads problem
18:12:26  <flux> because AFAIK batteries now requires threads?
18:12:46  <companion_cube> no, there is batteries.thread or something like this
18:13:07  <flux> funny how my small reproductions don't seem to work the same as the original cases..
18:13:18  <companion_cube> hmmmmm, I may talk too fast
18:13:23  <companion_cube> #require only shows batteries
18:13:35  <companion_cube> but you need to   open BatteriesThread in addition to Batteries
19:12:40  <troydm> is using a tuple a good idea to match two values at the same time?
19:13:00  <nlucaroni> you bet.
19:13:04  <troydm> like match (a,b) with (1,2) -> true | _ -> false
19:13:23  <nlucaroni> you can drop the parens if you want.
19:13:40  <ggole> That's a very common pattern.
19:23:30  <flux> also related, binding multiple values at once: let x_abs, y_abs = abs_float x, abs_float y in ..
19:26:23  <seliopou> any ocaml thrift contributors around?
19:26:49  <flux> hmph, somewhat annoying that Cairo2's matrix interface
19:27:12  <flux> you cannot duplicate a matrix.. well, you maybe can by setting and getting it to/from the cairo context, but..
19:31:41  <flux> nevermind :) it's actually an ocaml record :-)
19:33:37  <flux> though this does look a bit stupid.. let dup_matrix (m : Cairo.matrix) = { m with Cairo.xx = m.Cairo.xx }
20:10:24  <troydm> can i have function with the same name but with different types of arguments
20:10:40  <troydm> so i can have let's say a function called f that takes a pair of tuples
20:10:40  <bitbckt> that would be overloading. no.
20:10:57  <troydm> that i think is the only thing i'm missing right now
20:11:03  <troydm> and it makes me rly rly sad
20:11:29  <troydm> because now i need to come up with different function names for same logical operations :(
20:11:56  <bitbckt> if you must, you could put them in different modules and use local opens to achieve that effect.
21:08:39  <nlucaroni> +1 bitbckt. i'd do that troydm. or append each with a type description (_float/_int). or figure out how to make it polymorphic if possible.
21:13:13  <troydm> nlucaroni: ic
21:44:44  <travisby> Hi guys.  I'm new to ocaml, coming from a little of a haskell background.  Is there a way to clean up my simple tokenizer implementation (the part at line 47).  In Haskell, I would have used guards.  Is there a better way than nested if-else blocks in vanilla ocaml?  http://pastebin.com/AYuGFaR7
21:44:57  <travisby> I figured ocaml would be fun to learn for my compilers class this semester ^.^
21:45:44  <nlucaroni> there are guards in ocaml: | str when Str.string_match id_regex str 0 ->
21:46:45  <travisby> nlucaroni:  thanks!  A quick google had showed me an extension library.  Glad to see there was something builtin
22:04:24  <seliopou> Has anybody used thrift with an jane street's async as is? Seems like they're a bit incompatible...
22:23:05  <orbitz> seliopou: i have not, does thrift have its own event loop/blocking?
22:23:28  <seliopou> orbitz: yeah, a while loop :P
22:23:34  <seliopou> I think they're fundamentally incompatible
22:23:43  <seliopou> but just wanted to see if anybody would contradict that
22:24:20  <orbitz> seliopou: what's the while loop looping on?
22:24:32  <seliopou> orbitz: true
22:24:47  <orbitz> how is it getting input?
22:25:08  <seliopou> ah i see what you're asking
22:25:12  <seliopou> blocking on accept
22:25:18  <orbitz> that's wkward
22:25:46  <seliopou> yeah i don't think there's a way for the scheduler to actually maintain control there
22:25:52  <orbitz> is that the rpc layer?  my protobufs implemenation lets the user figure out how to get the bytes and just handles parsing them
22:26:05  <orbitz> seliopou: there aren't functions for just doing the parsing?
22:26:44  <seliopou> orbitz: yeah I think I'm going to create an async submodule and just implement it myself
22:26:52  <seliopou> sending the result upstream once it works
22:27:02  <orbitz> why does thrift even have to care about the socket layer?
22:27:09  <orbitz> how do you write thrift stuff to files, for example?
22:27:29  <seliopou> orbitz: thrift was originally conceived as an rpc layer, not just a serialization library
22:27:50  <orbitz> sure, but rpc is built on top of serialziatio
22:27:55  <orbitz> so you can't just access teh serialization?
22:27:55  <seliopou> so you write down what a service looks like in an IDL, and it handles the serialization, protocol, generates client library, and stub server code
22:28:21  <seliopou> the point is that it was intended as an end-to-end, out of the box solution to writing services using custom rpc interface
22:28:33  <seliopou> that's the historical story
22:28:38  <seliopou> not saying it's right or wrong
22:28:40  <seliopou> but it's what they made
22:28:46  <orbitz> yeah i get you, i'm just asking if they expose the underlying layers
22:28:52  <seliopou> now of course under the hood, there are different modules for all of this
22:28:56  <lilred> Anyone here using OMake? The documentation isn't very clear about what I should do if my project includes multiple executables, and sometimes I only want to build one or a few
22:29:20  <seliopou> or rather classes
22:29:26  <seliopou> and those classes can't be polymorphic
22:29:40  <seliopou> so you can't just write a Async-based Transport and throw it in there
22:29:57  <seliopou> you have to write an Async-based transport and everything above it in the stack
22:30:03  <seliopou> sad
22:30:37  <seliopou> :/
22:31:11  <seliopou> meh, this might be more trouble than it's worth
22:31:25  <seliopou> orbitz you use protobufs?
22:36:35  <orbitz> seliopou: not for anything serious, but yes
22:38:36  <orbitz> seliopou: my protobuf library is in opam if you want to use it.  i plan on doing some fixing up this weekend though, there are some bugs i think. i want to add some prop testing
...