1

我想重新编译一组文件以在我的 Mac 中生成一个 .js 文件。它曾经工作(很久以前),我不知道为什么它不再工作了。

它返回:

$ make analyzejs
ocamlfind ocamlc -g unix.cma -package js_of_ocaml.ppx -I /Users/chengtie/lib -I hack -I functor -I params -I concrete -I pd -I ai -I domains -I frontend -I frontend/gen -I syntax -I lib -I main -I rules -I area -I values -I vars -I zones -I microsoft -I experiment -I expression -I abstract -I operator -I ev -I js -I /Users/chengtie/.opam/4.02.3/lib/xmlm -annot -c lib/array2_js.ml
File "lib/array2_js.ml", line 17, characters 50-54:
Error: Unbound module Js

我的lib/array2_js.ml

open Array2

module Array2_js:
  sig
    val of_js: (('a Js.js_array Js.t) Js.js_array Js.t) -> ('a -> string) ->
      string array array
    val of_js_shift :int -> int -> 'b ->
      (('a Js.js_array Js.t) Js.js_array Js.t) -> ('a -> 'b) -> 'b array array
    val of_js_f2_shift: int -> int -> 'b ->
      (('a Js.js_array Js.t) Js.js_array Js.t) ->
      (('a Js.js_array Js.t) Js.js_array Js.t) ->
      ('a -> 'a -> 'b) -> 'b array array
  end
=
struct
  (* {can better}: don't know why f:'a -> 'b is not permitted; *)
  let of_js (s: ('a Js.js_array Js.t) Js.js_array Js.t) (f: 'a -> string) :
    string array array =
    let s = Js.to_array s in
    let num_rows = Array.length s in
    let num_columns = Array.length (Js.to_array s.(0)) in
    (* pffo "num_rows_1: %d, num_columns_1: %d\n" num_rows num_columns; *)
    let t = Array2.make num_rows num_columns "" in
$ js_of_ocaml --version returned 3.5.2.

有人可以帮忙吗?

4

1 回答 1

4
  1. open Js_of_ocaml在 array2_js.ml 的顶部
  2. -package js_of_ocaml-ppx(而不是-package js_of_ocaml.ppx
于 2020-04-27T18:07:45.700 回答