This is another case where I’m sure I’m doing something stupid, but it is not obvious to me where the stupidity is:
problem
I am trying to replace this example here: bonsai/user_info.ml at v0.15 · janestreet/bonsai · GitHub
My code looks like:
open Core
module User_info = struct
type t = { name : string; int_id : int } [@@deriving compare, equal, fields, sexp]
end
let sample_data =
lazy
(List.mapi [ "prod"; "dev"; "test" ] ~f:(fun i suffix ->
List.mapi [ "bonsai"; "incremental"; "app" ] ~f:(fun j name ->
let name = String.concat ~sep:"-" [ name; suffix ] in
let int_id = (10 * i) + j in
(name, Fields.create ~name ~int_id)))
|> List.concat |> String.Map.of_alist_exn)
module Input = struct
type t = { all_users : User_info.t String.Map.t } [@@deriving fields]
let default () = Fields.create ~all_users:(Laxy.force User_info.sample_data)
end
I am getting an error of:
13 | (name, Fields.create ~name ~int_id)))
^^^^^^^^^^^^^
Error: Unbound module Fields
Hint: Did you mean Field?
debug 1
The only open
statement in bonsai/user_info.ml at v0.15 · janestreet/bonsai · GitHub is an open Core
, which my code also has.
So maybe the problem is this Fields
is coming in from dune file.
debug 2
Here is my dune file:
(library
(name v0_cmd)
(preprocess
(pps ppx_jane ppx_pattern_bind js_of_ocaml-ppx))
(libraries
async_kernel
bonsai
bonsai_web
bonsai_experimental_animation
bonsai_web_ui_form
bonsai_web_ui_search_bar
core
js_of_ocaml
virtual_dom.keyboard
incr_dom
incr_dom_partial_render))
As far as I can tell, for both libraries & pps, mine is a superset of: bonsai/dune at v0.15 · janestreet/bonsai · GitHub
I’ve tried grepping for “module Fields” in the bonsai github tree; no response. Grepping for “Fields” in the bonsai github tree shows usages, but as far as I an tell, no definitions.
question
Where is this Fields
coming in from? And how is the bonsai example pulling it in?
Thanks!