Enum support

Based on this patch

https://lists.ocamlcore.org/pipermail/pgocaml-general/2013-June/000044.html

For ease of reviewing, the original diff is split into patches grouped by functionality.