I am struggling to properly set up my OCaml environment to use ppx derivers map, fold and iter, as devined here: https://github.com/ocaml-ppx/ppx_deriving#plugins-iter-map-and-fold
My minimal example is here (I am using Base since this is a library I am using in my wider project):
open Base;;
type data = Row of float array | Dim of data array
[@@deriving iter, map, fold, show];;
let t = Row [|2.;2.|];;
pp_data Caml.Format.std_formatter t;;
map_data (fun x -> x +. 1.) t;;
pp_data Caml.Format.std_formatter t;;
The following code is compiled with
ocamlfind ocamlc -package base -package ppx_deriving.iter -package ppx_deriving.map -package ppx_deriving.fold -package ppx_deriving.show -linkpkg -g test.ml && ./a.out
; I get a compilation error stating that map_data
has type data -> data
. But according to the documentation and my general knowledge, map
gets a function and a mappable structure, which seems not to be the case here. Testing this in utop gives me the same error.
Is there anything I am missing?
Thank you in advance :)