4.08 let bindings let*, let+ giving errors with ppx_jane

I am using ocaml 4.08.1 and trying to use the new let bindings let* and let+ along with ppx_jane and core_kernel. I have defined Result monad as such

module Result = struct
  include Result

  let ( let+ ) = ( >>| )

  let ( let* ) = ( >>= )

  let ( and+ ) = Let_syntax.Let_syntax.both
end

My dune file

(library
 (name test)
 (flags
  (:standard
   (-open Core_kernel)
   (-w -37)
   (-w -32)))
 (libraries core_kernel lwt lwt.unix core_kernel.binary_packing)
 (preprocess
  (pps ppx_jane)))

However, when I try to use let bindings like below I am getting a compilation error.

let open Result in 
let* res = get_result () in 
...

Error:

Raised at file "src/migrate_parsetree_408_407_migrate.ml", line 7, characters 2-49
Called from file "src/migrate_parsetree_408_407_migrate.ml", line 57, characters 8-40
Called from file "src/migrate_parsetree_408_407_migrate.ml", line 211, characters 9-29
Called from file "src/migrate_parsetree_408_407_migrate.ml", line 57, characters 8-40
Called from file "src/migrate_parsetree_408_407_migrate.ml", line 211, characters 9-29
Called from file "src/migrate_parsetree_408_407_migrate.ml", line 57, characters 8-40
Called from file "src/migrate_parsetree_408_407_migrate.ml", line 84, characters 10-30
Called from file "src/migrate_parsetree_408_407_migrate.ml", line 57, characters 8-40
Called from file "src/migrate_parsetree_408_407_migrate.ml", line 253, characters 8-34
Called from file "list.ml", line 92, characters 20-23

Using without ppx_jane seems to work. Is there a workaround to this? I am using the latest version of ppx_jane - v0.12.0.

I believe this happens because the 0.12 version of ppx_jane is only up to date through OCaml 4.07, so it isn’t able to read syntax trees that contain new constructs from 4.08.

One workaround is to use the development version of ppx_jane, for example by adding the “janestreet-bleeding” opam repo.

Of course, you can also get basically the same behavior as the new binding operators by using the ppx_let part of ppx_jane, but that might not be compatible with what you’re trying to do.

Just tried to use the ppx_jane dev branch. However, the build was not successful since ppxlib does not support 4.08. :frowning_face:

I think @Levi_Roth’s analysis is spot on. Jane Street ppxes
ultimately rely on ppxlib, whose version for v0.12 selects the
4.07 AST.

It is also true that the bleeding edge repository does use a
ppxlib version whose AST is 4.08, thus fixing the issue.

The only useful thing I can add is that we are currently in
the early stages of v0.13 (which will be based on what is
currently in the bleeding edge repository). The upcoming
version is expected to be fully compatible with 4.08 and 4.09.

I do think ppxlib is compatible with 4.08. There is probably
something weird with your constraints, or your opam metadata
is out of date.

Please also notice that we do not support mixing released
versions and bleeding edge versions.

Ah, okay. Maybe that’s why. Thanks. Any expected timeline for v0.13.0 release?

(I will start the process next week, but it can take several
weeks before the packages are actually available in opam.)