Hello, Here is the latest OCaml Weekly News, for the week of January 31 to February 07, 2017.
1) visitors 2) Feedback on cmdliner doc language changes 3) Memory Usage 4) omake-0.10.2 5) cppo, ocamlbuild, and dependencies 6) where are we on the Hoogle for OCaml front? 7) llpp v26 8) Research officer in theoretical foundations of cyber security at Swansea University 9) Ocaml Github Pull Requests 10) Other OCaml News ======================================================================== 1) visitors Archive: <https://sympa.inria.fr/sympa/arc/caml-list/2017-01/msg00152.html> ------------------------------------------------------------------------ ** Continuing this thread from last week, whitequark said: I wrote this tool long ago, it's called ppx_import[1]. In fact it motivated some improvements to the compiler, chiefly the way to extract the set of -I paths. It's even linked from ppx_deriving README[2]. [1]: <https://github.com/whitequark/ppx_import> [2]: <https://github.com/whitequark/ppx_deriving/#working-with-existing-types> ** François Pottier then said, and whitequark replied: > This is very cool, and I had missed it. Thanks for pointing it out. > I will refer to it in the visitors documentation. > > By the way, the ppx_deriving README says that ppx_import is useful > "in the case where no attributes need to be attached", > but it is more useful than that, > since the "@with" form actually allows attaching attributes a posteriori. That paragraph predates [@with]. I've updated it now. ** François Pottier then asked and Emilio Jesús Gallego Arias replied: > Is it possible to use ppx_import to import and copy not just one type > definition, but a whole family of (possibly mutually recursive) type > definitions? whitequark of course will know the exact details, but indeed ppx_import seems capable to work in your use case, see: <https://github.com/ejgallego/coq-serapi/blob/master/serlib/ser_constrexpr.ml#L49> ** François Pottier then said and whitequark replied: > Thanks Emilio. This works indeed, but you have to write one line for > every type that you want to import. When you have 86 mutually > recursive > types, that seems silly :-) Unfortunately Emilio has the shortest implementation that's possible right now. I think this would be a fairly straightforward addition to ppx_import. ** Emilio Jesús Gallego Arias finally said: In the lines of François suggestion, it would be great if ppx_import could some kind of "batch" import for modules. Imagine you want to add show to a whole module, you could do: [%import: M [@attach all [[@deriving show]]]] or module M = [%import M ....] Another option is to teach deriving about modules: module M = M [@@deriving sexp] but I am not sure what would be the best way to avoid all the boilerplate I currently have [would had submitted an issue otherwise] ======================================================================== 2) Feedback on cmdliner doc language changes Archive: <https://sympa.inria.fr/sympa/arc/caml-list/2017-01/msg00154.html> ------------------------------------------------------------------------ ** Daniel Bünzli announced: The current cmdliner manual doc language is broken beyond hope. The next release is going to fix that which may break the rendering of some manpages [1]. Your feedback on the changes and new language definition is welcome: <https://github.com/dbuenzli/cmdliner/blob/08be600c4b7f00c08339f078a88b30234d84fc44/CHANGES.md#doc-language-sanitization> <https://github.com/dbuenzli/cmdliner/blob/master/src/cmdliner.mli#L755-L768> Discussion can happen here: <https://github.com/dbuenzli/cmdliner/issues/68> Best, Daniel [1] I suspect most will not. But if: git grep '\$([ib],[^)]*\$([mt]name)[^)]*)' exits with 0 in your project you are affected for sure. Simply replace these marked up $(b,$(tname)) and $(b,$(mname)) by the variables $(tname) and $(mname) themselves. ======================================================================== 3) Memory Usage Archive: <https://sympa.inria.fr/sympa/arc/caml-list/2017-02/msg00001.html> ------------------------------------------------------------------------ ** Continuing the thread from last week, Alain Frisch said: If you are only interested in measuring how much a given function allocates, you can simply call Gc.allocated_bytes before and after. Otherwise, and in addition to other great suggestions, let me add this one: <https://github.com/LexiFi/landmarks> ======================================================================== 4) omake-0.10.2 Archive: <https://sympa.inria.fr/sympa/arc/caml-list/2017-02/msg00002.html> ------------------------------------------------------------------------ ** Gerd Stolpmann announced: it is my pleasure to announce omake-0.10.2. This is mainly a bug fix release: - fixing build of omake on bytecode-only system - (again) fixing "rm -rf" on Windows - omake defaults now to the C compiler used by OCaml - building the omake documentation is now optional (even if hevea is installed - could be non-working) - fix inotify on Linux (for omake -P). Note that it is still not working on Mac. - fix recognizing case-insensitive filesystems on Mac - fix the OCamlPackage macro when a pack is created and no pack-level mli file is present - omake now ignores the env vars PREFIX, BINDIR and LIBDIR at install time The new homepage is now <http://projects.camlcity.org/projects/omake.html>. See there for all the other links. The opam package will be updated soon. The old homepage omake.metaprl.org is no longer updated (I don't have access, and don't know how to take it down). ======================================================================== 5) cppo, ocamlbuild, and dependencies Archive: <https://sympa.inria.fr/sympa/arc/caml-list/2017-02/msg00003.html> ------------------------------------------------------------------------ ** François Pottier asked and Gabriel Scherer announced: > I am trying to use cppo and ocamlbuild together. > > Suppose the file a.cppo.ml contains the line: > #include "b.cppo.ml". > > Then, the build fails. As far as I understand, ocamlbuild is not aware of > the > dependency a.cppo.ml -> b.cppo.ml, so the source file b.cppo.ml is not even > copied to the _build directory. > > I am using the build rules bundled with cppo (in the module > Ocamlbuild_cppo). > > Shouldn't these build rules be improved so as to perform a genuine > dependency > computation? Has anyone run into this issue? Yes, the cppo ocamlbuild plugin <https://github.com/mjambon/cppo/blob/master/ocamlbuild_plugin/ocamlbuild_cppo.ml> does not currently perform any kind of dynamic dependency computation. I think the best way for this to be implemented would be at the level of cppo, have a kind of -list-includes flag that would run on a .cppo.* file and return the list of includes. Then you could easily change the cppo rule to call this first, dynamically build all these dependencies, and proceed with normal cppo processing. (I believe this is roughly how `gcc -M` works.) In the meantime, I implemented an amusing hack at the ocamlbuild level which is to simply parse the failure message and, if it complains about a missing file, recursively build that file as a dynamic dependency. It seems to work. (The code below is just a change over the main function of cppo's ocamlbuild plugin. To use it in your program, copy the cppo's ocamlbuild source in your myocamlbuild.ml, replace the relevant function, and at the end add "let () = dispatch dispatcher" or whatever dispatch logic you wish.) let cppo_rules ext = let dep = "%(name).cppo"-.-ext and prod1 = "%(name: <*> and not <*.cppo>)"-.-ext and prod2 = "%(name: <**/*> and not <**/*.cppo>)"-.-ext in let cppo_rule prod env build = let dep = env dep in let prod = env prod in let tags = tags_of_pathname prod ++ "cppo" in let cppo = S[A "cppo"; T tags; S [A "-o"; Px prod]; P dep] in let rec retry tmp = let cppo_to_tmp = S[cppo; Sh "2>"; P tmp ] in let cppo_cmd = Command.to_string (Cmd cppo_to_tmp) in match Sys.command cppo_cmd with | 0 -> Nop | _ -> let cppo_result = read_file tmp in let error = Str.regexp {|Error: Cannot find included file "\([^"]*\)"|} in (* If we cannot find the dependency, or if building the dependency fails, we return the original cppo command. This will do a bit of useless work but give a better error message than having the rule raise an exception here, as it will present the failure in terms of the cppo error message the user knows about, instead of backtracking in other rules. *) match Str.search_forward error cppo_result 0 with | exception Not_found -> Cmd cppo | _pos -> let dep = Str.matched_group 1 cppo_result in match build [[dep]] with | [Outcome.Good _dep] -> retry tmp | _ -> Cmd cppo in with_temp_file "ocamlbuild_cppo" "stderr" retry in rule ("cppo: *.cppo."-.-ext^" -> *."-.-ext) ~dep ~prod:prod1 (cppo_rule prod1); rule ("cppo: **/*.cppo."-.-ext^" -> **/*."-.-ext) ~dep ~prod:prod2 (cppo_rule prod2) ** François Pottier then said and Gabriel Scherer replied: > Thanks Gabriel for your quick reply. > > This seems amusing indeed, but does not quite work for me. Running > ocamlbuild > once fails, complaining that A.ml does not exist (whereas A.cppo.ml exists). > If I immediately run ocamlbuild again, the build succeeds. > > I think I would prefer to use a slightly less amusing approach and just find > out, ahead of time, what the dependencies are. In the rule that transforms > %.cppo.ml to %.ml, could I just read the source file, looking #include > patterns, and ask that the included files be built first? Yes, of course, your approach would also work (`Ocamlbuild_plugin.read_file` is you friend, followed by the parsing technique of your choice). The only issue is that you may over-approximate dependencies depending on how closely you approximate cppo's grammar (and I don't know, maybe there is a way to have computed inclusion instead of just file path literals?), so this logic would be easier to implement correctly in cppo itself. You may find inspiration in the part of the manual that describes how to write rules with dynamic dependencies (the explained example is the code of the (.itarget -> .otarget) rule): <https://github.com/ocaml/ocamlbuild/blob/master/manual/manual.adoc#Subsec_Rules__Dynamic_dependencies> ======================================================================== 6) where are we on the Hoogle for OCaml front? Archive: <https://sympa.inria.fr/sympa/arc/caml-list/2017-02/msg00017.html> ------------------------------------------------------------------------ ** François Berenger asked and Jacques Garrigue replied: > Do we have a hoogle[1] equivalent that is in production for OCaml? > > I mean something that would index all source code available in opam > and allow queries by type signature or keyword? > > Currently, I use ocp-browser but I still feel like > it's a temporary and not super efficient measure. > > I don't know how to do query by type signature with it. > And many packages don't install their doc so you cannot > see the doc for each function. > At list for the stdlib it works (inside ocp-browser you type List.map then > spacebar, for example). > > When I was an Haskell programmer (for two months, a long time ago), I felt > Hoogle was the biggest productivity enhancer (you don't reinvent > the wheel, just find which one you need and use it). > > Regards, > F. > > [1] <https://www.haskell.org/hoogle/> For search by type signature you can use Jun Furuse's OCamlOScope: <https://camlspotter.github.io/ocamloscope.html> It also gives documentation when available. I'm not sure how big the database is. ** Daniel Bünzli asked and Hendrik Boom replied: > I'm a little bit curious. While I can see the benefit of having general full > text search over value identifiers, type identifier and doc strings I was > always a little bit dubious about type signature search -- in the end ML types > for themselves are a rather weak specification language (I'm not talking about > the invariants you may hide behind those of course). > > So beyond curiosity searches are actually people seriously using this to > lookup a value they might need ? Search on parts of the type, even. It is very useful to find all the functions that do anything with values of a particular type in order to find out what you can do with it. As well as how you can produce values of that type. ** Ivan Gotovchits replied: Yep, the same as it is done in Coq's search command, where you query all functions that produce integer Search (_ -> int) It is extremely useful in Coq, and should be as well in OCaml. For example, when I see, that a function requires a value of type `Uuidm.t`, then a search for `_ -> Uuidm.t` will reveal all possible ways to create it. (Of course, I can just go to the mli file, and read it, but this defeats the whole purpose of searching). ** Daniel Bünzli also replied and Ivan Gotovchits said: > Sure but boolean queries on type identifiers seems enough for this. Of course > you can always wish to be more precise --- I want this type to appear in that > position --- but I'm not sure that's an information need users often have. That's why the search should be up-to some isomorphism, e.g., int -> float -> bool is isomoprhic to float -> int -> bool The seach should also work correctly with lots of aliases, since it is usual when the same type or value in OCaml has mutliple names. The seach should also ignore parameter names, as this is not what a user can know in advance. ** Ivan Gotovchits then added: This is a link [1] to the underlying theory of type isomorphism search, for those who are interested: [1]: <http://www.dicosmo.org/ResearchThemes/ISOS/ISOShomepage.html> ** Daniel Bünzli then said and Ivan Gotovchits replied: > The papers you mention seem to be about the type ismorophism theory but I > can't > see any that tries to asses end-user information needs and retrieval > evaluation. I'm not sure you need the full theory to build an effective system > to support a programmer, e.g. what about the effectiveness of a full type > isomorphism search vs a bag of type identifiers with functional position > model. > Meaningfully limiting the query power to an IR system is a problem in > practice, > for space, computational and user interface reasons. Well yes, the theory is not required, but it is better to know one :) I provided a link mostly because it is a sort of a homepage for type-isomorphic search. There are links to the CamlLight implementations (yeah the idea was there for some time) and Haskel. Speaking of modern implementations, Argot [1] is the only example that comes to mind. It has the isomorphic search and a type manifest search. The search is implemented mostly in Javascript (generated from OCaml). (Probably, you heard the story that it is broken and abandoned, and yadda yadda...) The digest of the theory, is that we have the following rules: 1. a -> b -> c ~ b -> a -> c 2. a * b -> c ~ a -> b -> c 3. unit -> a ~ a And by applying these rules recursively we can build a set of types that are isomorphic to the query (or partition all the types into the isomoprhism groups). [1]: <http://ocaml.github.io/platform-dev/packages/argot/> ** Frédéric Bour then added: The experimental version of Merlin implements a similar feature (however it looks only in loaded packages, not the whole opam universe). It is based on names (normalizing type constructors to resolve aliases), and uses variance information (types occurring in positive and negative positions) to guide the search. The prototype query language looks like "-int +string" for "string of int". You can see a demo here: <http://alfred.lakaban.net/~def/polarity.webm> . ======================================================================== 7) llpp v26 Archive: <https://sympa.inria.fr/sympa/arc/caml-list/2017-02/msg00018.html> ------------------------------------------------------------------------ ** moosotc announced: New version of llpp (tagged v26) is now available at: * <http://repo.or.cz/w/llpp.git> (has "tutorial" videos) * <https://github.com/moosotc/llpp/> (has a bug tracker) ============================================================================ Blurb llpp is a graphical PDF viewer, which aims to superficially resemble less(1) ============================================================================ Changes (relative to v25) * native macOS support (Nicolás Ojeda Bär) * wrapper-script to reload document on file change (Pascal Wittmann) * bugfixes Summary v25..v26 160 Nicolas Ojeda Bar 1 Pascal Wittmann 1 Tobias Kortkamp 78 malc Diffstat v25..v26 .gitignore | 5 +- .merlin | 1 + .ocp-indent | 2 + BUILDING | 13 +- Shakefile.hs | 13 +- build.sh | 53 ++- config.ml | 106 ++--- keys.ml | 6 +- link.c | 185 ++------ main.ml | 1122 ++++++++++++++++++++------------------------ main_osx.m | 906 +++++++++++++++++++++++++++++++++++ misc/Info.plist | 53 +++ misc/completions/llpp.in | 19 +- misc/dicx | 8 +- misc/gc.awk | 23 - misc/llpp.desktop | 4 +- misc/llpp.inotify | 38 ++ misc/llppac | 10 +- mkhelp.sh | 0 todo.org | 4 +- utils.ml | 60 ++- wsi/osx/wsi.ml | 318 +++++++++++++ wsi.ml => wsi/x11/wsi.ml | 132 ++---- wsi.mli => wsi/x11/wsi.mli | 10 +- 24 files changed, 2089 insertions(+), 1002 deletions(-) ======================================================================== 8) Research officer in theoretical foundations of cyber security at Swansea University Archive: <https://sympa.inria.fr/sympa/arc/caml-list/2017-02/msg00020.html> ------------------------------------------------------------------------ ** Markus Roggenbach announced: Research officer in theoretical foundations of cyber security at Swansea University Duration: 3 years Available now Application deadline: 24.2.17 URL: <http://www.jobs.ac.uk/job/AWX894/research-assistant-officer-in-theoretical-computer-science-theory-of-security/> Within an EPSRC funded project, we have a research position that offers an opportunity to undertake research in the broad area of Trust, Identity, Privacy and Security. To this end we want apply algebra and logic in explorations of topics such as - security and privacy properties for data sharing; - block-chain technologies; - digital identities; - authentication and certification. The position provides an opportunity to enter the important, developing field of formal methods for cyber security. We encourage any candidate with experience in - theory of computation; - formal methods for software development; - logic and AI; or - computer security to apply for our position. A previous track record in cyber security will be valuable, however not be necessary. For informal enquires please contact Prof John Tucker (j.v.tuc...@swansea.ac.uk) or Prof Markus Roggenbach (m.roggenb...@swansea.ac.uk) ======================================================================== 9) Ocaml Github Pull Requests ------------------------------------------------------------------------ ** Gabriel Scherer and the editor compiled this list: Here is a sneak peek at some potential future features of the Ocaml compiler, discussed by their implementers in these Github Pull Requests. - Unix library: better API for "close-on-exec" over file descriptors <https://github.com/ocaml/ocaml/pull/650> - Define Map.update. <https://github.com/ocaml/ocaml/pull/1026> - Various fixes for -dtimings <https://github.com/ocaml/ocaml/pull/1027> - display the output of -dtimings as a hierarchy <https://github.com/ocaml/ocaml/pull/1032> ======================================================================== 10) Other OCaml News ------------------------------------------------------------------------ ** From the ocamlcore planet blog: Here are links from many OCaml blogs aggregated at OCaml Planet, <http://ocaml.org/community/planet/>. Back-end Software Engineer at Maxwell Health (Full-time) <https://functionaljobs.com/jobs/8991-back-end-software-engineer-at-maxwell-health> News on the Eliom language <https://ocsigen.github.io/blog/2017/02/06/eliomlang/> FUNemployment <http://philtomson.github.io/blog/2017/02/02/funemployment/> NaBoMaMo 2016 writeup <http://blog.emillon.org/posts/2017-02-01-nabomamo-2016-writeup.html> Jackline, a secure terminal-based XMPP client <https://hannes.nqsb.io/Posts/Jackline> OASIS-DB sub-project is deprecated. <http://forge.ocamlcore.org/forum/forum.php?forum_id=959> gesticulations 001 <http://erratique.ch/log/2017-01-25> Sixteenth OCaml compiler hacking evening at Pembroke <http://ocamllabs.github.com/compiler-hacking/2017/01/24/february-compiler-hacking> OCaml Developer at Arena (Full-time) <https://functionaljobs.com/jobs/8989-ocaml-developer-at-arena> Version 0.8 of the E-ACSL 0.8 plugin is available for download. <http://frama-c.com/index.html> How to Build an Exchange <https://blogs.janestreet.com/how-to-build-an-exchange/> A brief trip through Spacetime <https://blogs.janestreet.com/a-brief-trip-through-spacetime/> Lwt 2.7.0 <https://ocsigen.github.io/blog/2017/01/06/lwt.2.7.0/> ======================================================================== Old cwn ------------------------------------------------------------------------ If you happen to miss a CWN, you can send me a message (alan.schm...@polytechnique.org) and I'll mail it to you, or go take a look at the archive (<http://alan.petitepomme.net/cwn/>) or the RSS feed of the archives (<http://alan.petitepomme.net/cwn/cwn.rss>). If you also wish to receive it every week by mail, you may subscribe online at <http://lists.idyll.org/listinfo/caml-news-weekly/> . ======================================================================== -- OpenPGP Key ID : 040D0A3B4ED2E5C7 Monthly Athmospheric CO₂, Mauna Loa Obs. 2016-12: 404.48, 2015-12: 401.85
signature.asc
Description: PGP signature
_______________________________________________ caml-news-weekly mailing list caml-news-weekly@lists.idyll.org http://lists.idyll.org/listinfo/caml-news-weekly