Eliom을 막 배우는데 The types of client values must be monomorphic from its usage or from its type annotation라는 오류가 나요. 현재 예제는 이래요:
let%server new_entry_form =
let open Html.D in
let field = Raw.input ~a:[a_input_type `Text] () in
let submit = Raw.button ~a:[a_class ["button"]] [txt "add"] in
ignore
[%client
let open Html.D in
let open Js_of_ocaml_lwt.Lwt_js_events in
let field = Html.To_dom.of_input ~%field in
(Lwt.async @@ fun() ->
clicks (Html.To_dom.of_element ~%submit)
(fun _ _ ->
let entered = field##value |> Js_of_ocaml.Js.to_string in
add_entry {id="5";name=entered;description=""};
Lwt.return_unit):unit
)];
div [
field;submit
]
~%field와 ~%submit이 문제인 것 같아요. 튜토리얼 코드와 비슷해 보이는데 왜 오류가 날까요? 어디가 잘못된 건가요?
영어에서 번역·원문 보기I'm new to Eliom and encounter The types of client values must be monomorphic from its usage or from its type annotation. This is the example I've got so far:
let%server new_entry_form =
let open Html.D in
let field = Raw.input ~a:[a_input_type `Text] () in
let submit = Raw.button ~a:[a_class ["button"]] [txt "add"] in
ignore
[%client
let open Html.D in
let open Js_of_ocaml_lwt.Lwt_js_events in
let field = Html.To_dom.of_input ~%field in
(Lwt.async @@ fun() ->
clicks (Html.To_dom.of_element ~%submit)
(fun _ _ ->
let entered = field##value |> Js_of_ocaml.Js.to_string in
add_entry {id="5";name=entered;description=""};
Lwt.return_unit):unit
)];
div [
field;submit
]
I'm guessing ~%field and ~%submit are the trouble. Why does this produce an error when it looks much like the tutorial code? Where have I gone wrong?