[cwn] Attn: Development Editor, Latest OCaml Weekly News
Alan Schmitt
alan.schmitt at polytechnique.org
Mon Jun 3 23:40:16 PDT 2019
Hello
Here is the latest OCaml Weekly News, for the week of May 28 to
June 04,
2019.
Table of Contents
─────────────────
Is there a tool to do automatic serialization/deserialization AND
automatic schema migration (from OCaml types)?
A module for printing a tree to a terminal like the 'tree' command
ppx_enum v0.0.1
Dungeon crawler game
Coccinelle engineer position
ppx_bsx 2.0.0
Other OCaml News
Old CWN
Is there a tool to do automatic serialization/deserialization AND
automatic schema migration (from OCaml types)?
════════════════════════════════════════════════════════════════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/is-there-a-tool-to-do-automatic-serialization-deserialization-and-automatic-schema-migration-from-ocaml-types/2606/9>
Deep in this thread, Jared Forsyth announced
────────────────────────────────────────────
Well I went ahead and made one 😅 would love to hear your
thoughts
<https://jaredforsyth.com/posts/announcing-milk/>
A module for printing a tree to a terminal like the 'tree' command
══════════════════════════════════════════════════════════════════
Archive:
<https://discuss.ocaml.org/t/a-module-for-printing-a-tree-to-a-terminal-like-the-tree-command/3879/1>
Martin Jambon announced
───────────────────────
Today I made [a module for printing trees] in a readable
fashion. The
output looks like the output of the [tree command]:
<https://aws1.discourse-cdn.com/standard11/uploads/ocaml/original/2X/b/bf5f6580cdbe190d643bb0b7a996c216c54d4b69.png>
It works on any data structure that supports `get_name' and
`get_children' functions and depends on nothing else than the
OCaml
standard library.
I'm releasing it into the Public Domain in the hope others find
it
useful. Anyone is welcome to include it in their projects or
turn it
into a proper open-source project that they maintain.
[a module for printing trees]
<https://gist.github.com/mjambon/75f54d3c9f1a352b38a8eab81880a735>
[tree command] <https://en.wikipedia.org/wiki/Tree_(command)>
ppx_enum v0.0.1
═══════════════
Archive:
<https://discuss.ocaml.org/t/ann-ppx-enum-v0-0-1/3875/1>
James Owen announced
────────────────────
Cryptosense is happy to announce the initial release of
`ppx_enum' !
`ppx_enum' is a ppx to derive enum-like modules from variant
definitions. It’s inspired by the enum declaration syntax in
Python,
and various other languages.
Enums are bare variants that are intended to represent a flag
that can
have more values than just true and false. The idea is that
`ppx_enum'
makes it easier to work with enums, in particular handling the
conversion to and from strings. This is useful when
(de)serializing
values (for example, when serializing to store in a database),
and
cuts down on repetitive boilerplate code.
Consider the following simple example:
┌────
│ type my_enum =
│ | Foo
│ | Bar
│ | Baz
│ [@@deriving enum]
└────
The use of `[@@deriving enum]' will generate the following
functions:
┌────
│ let my_enum_to_string = function
│ | Foo -> "Foo"
│ | Bar -> "Bar"
│ | Baz -> "Baz"
│
│ let my_enum_from_string = function
│ | "Foo" -> Ok Foo
│ | "Bar" -> Ok Bar
│ | "Foo" -> Ok Foo
│ | _ -> Error ...
│
│ let my_enum_from_string_exn = function
│ | "Foo" -> Foo
│ | "Bar" -> Bar
│ | "Foo" -> Foo
│ | _ -> invalid_arg ...
└────
Since we found this was something we were doing a lot in our
code, the
use of `ppx_enum' has improved readability, reduced the need for
boilerplate tests and made the conversions less error prone (as
it
eliminates bugs caused by typos in the string conversion
methods).
It’s in a beta release at this point so any feedback is
appreciated!
You can find it on [github ] and [opam]!
[github ] <https://github.com/cryptosense/ppx_enum>
[opam] <https://opam.ocaml.org/packages/ppx_enum/>
Dungeon crawler game
════════════════════
Archive:
<https://discuss.ocaml.org/t/dungeon-crawler-game/3850/2>
Continuing this thread, Bramford Horton said
────────────────────────────────────────────
Cool. I see you've made heavy use of the object system. If
you're
interested in games built using the more idiomatic
functional/ocaml
approach (i.e. modules), you should check out
[a-nikolaev/wanderers].
I also wrote [bramford/2d-exploration-game] - a simple
terminal/ncurses game while I was learning ocaml. I tried a
couple of
different approaches using the module system. I never felt that
I got
it quite right so while it is quite simple, it may not be the
best
example.
[a-nikolaev/wanderers] <https://github.com/a-nikolaev/wanderers>
[bramford/2d-exploration-game]
<https://github.com/bramford/2d-exploration-game>
Florent Monnier also said
─────────────────────────
On my side I started a shmup game with abstract graphics because
I'm
fond of Kenta Cho games, not yet in a git repository, I put it
in a
gist:
<https://gist.github.com/fccm/ade9aee7b4594dc9c130b40098ad92ab>
Quite functional too, only shot and missed variables are
imperative.
Florent Monnier then added
──────────────────────────
I updated it to remove the dependencies on ageom and timeline by
including the pieces of code used: [shmup_av10.ml]
As there is only one source code file, you can run it directly
with
ocaml:
┌────
│ opam install ocamlsdl2
└────
If you're using SDL2 version 2.0.9, or if you installed an older
version:
┌────
│ opam install ocamlsdl2.0.02
└────
Then you can run the game with:
┌────
│ eval $(opam env)
│ ocaml -I $(ocamlfind query sdl2) sdl2.cma shmup_av10.ml
└────
I created a [basic webpage] for this game, there are screenshots
and
an executable binary for Windows.
[shmup_av10.ml]
<https://gist.github.com/fccm/ade9aee7b4594dc9c130b40098ad92ab>
[basic webpage]
<http://www.linux-nantes.org/~fmonnier/ocaml/shmup_av/>
Coccinelle engineer position
════════════════════════════
Archive:
<https://discuss.ocaml.org/t/coccinelle-engineer-position/3881/1>
Julia Lawall announced
──────────────────────
Despite our old fashioned web site (<http://coccinelle.lip6.fr>)
and
insufficient manpower to accept many external contributions, the
Coccinelle team is looking for an engineer to work on the
Cocinelle
implementation for 2 years starting in September 2019.
Coccinelle is
a program transformation tool for C code, written in OCaml,
primarily
targeting the Linux kernel. The position will be at Inria-Paris
(concretely at LIP6). A masters degree is required (relevant
work
experience might be acceptable). Good knowledge of OCaml or
another
functional programming language, familiarity with C code, and
experience with program analysis (eg in a compiler course) would
be
helpful. There is no constraint on nationality or requirement
to
speak French. Please contact julia.lawall at lip6.fr if interested.
ppx_bsx 2.0.0
═════════════
Archive: <https://discuss.ocaml.org/t/ann-ppx-bsx-2-0-0/3882/1>
Chen Xian-an announced
──────────────────────
If you like me, want to do ReasonReact projects in OCaml but not
Reason, I'm happy to announce the release of ppx_bsx:
[https://github.com/cxa/ppx_bsx].
[https://github.com/cxa/ppx_bsx] <https://github.com/cxa/ppx_bsx>
Other OCaml News
════════════════
From the ocamlcore planet blog
──────────────────────────────
Here are links from many OCaml blogs aggregated at [OCaml
Planet].
• [Moved to GitHub]
• [LablGTK moved to GitHub]
[OCaml Planet] <http://ocaml.org/community/planet/>
[Moved to GitHub]
<http://forge.ocamlcore.org/forum/forum.php?forum_id=967>
[LablGTK moved to GitHub]
<http://forge.ocamlcore.org/forum/forum.php?forum_id=968>
Old CWN
═══════
If you happen to miss a CWN, you can [send me a message] and
I'll mail
it to you, or go take a look at [the archive] or the [RSS feed
of the
archives].
If you also wish to receive it every week by mail, you may
subscribe
[online].
[Alan Schmitt]
[send me a message] <mailto:alan.schmitt at polytechnique.org>
[the archive] <http://alan.petitepomme.net/cwn/>
[RSS feed of the archives]
<http://alan.petitepomme.net/cwn/cwn.rss>
[online] <http://lists.idyll.org/listinfo/caml-news-weekly/>
[Alan Schmitt] <http://alan.petitepomme.net/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/caml-news-weekly/attachments/20190604/269b373f/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 487 bytes
Desc: not available
URL: <http://lists.idyll.org/pipermail/caml-news-weekly/attachments/20190604/269b373f/attachment-0001.pgp>
More information about the caml-news-weekly
mailing list