apply1 missing in generated code
The compilation result of the following program is wrong (necroml version 2.10):
type s
type m<a> = | Value (s -> (a, s))
val fmap<a, b> (f : a -> b) (w : m<a>) : m<b> =
Value<b> (\s:s ->
let Value v = w in
let (ws, _) = v s in
let v' = f ws in
(v', s)
)
(** Module defining the specified terms *)
module MakeInterpreter (F: UNSPEC) = struct
include F
let ( let* ) = M.bind
let rec fmap: 'a 'b. ('a -> 'b M.t) -> ('a m -> ('b m) M.t) M.t =
function f ->
M.ret (function w ->
M.ret (Value (function s ->
let Value v = w in
let* (ws, _) = apply1 v s in
let* v' = apply1 f ws in
M.ret (v', s))))
end
The function apply1
is used but not declared. Note that this works as expected if we remove the Value
constructor and use type m<a> := s -> (a, s)
.