Mentions légales du service

Skip to content

apply missing in code generation

If you try to compile the following code (I tried to find a simple example):

type s
val some_fun : s -> s

type m<a> = s -> (a, s)

val bind<a, b> ((w, f):(m<a>, a -> m<b>)) : m<b> =
  \s:s ->
  let (v, s') = w s in
  let fv = f v in
  fv s'

val get : m<s> =
  \s:s -> (s, s)

binder @ = bind

val modify (f: s -> s) : m<()> =
  \s:s ->
    let new_state = f s in 
    ((), new_state)

(* Does not compile without the (), but this is another issue *)
val computation : () -> m<s> =
  \_:() ->
  let _ =@ modify some_fun in 
  get

with

  • Necro Library, version: 0.12.2
  • Necro ML, version: 0.2.11.1

and try to run it as an ocaml program, you'll get:

File "./test.ml", line 71, characters 4-10:
71 |     apply2 bind _tmp (function _ ->
         ^^^^^^
Error: Unbound value apply2

This is very similar to #4 (closed), which has been patched in necroml 2.10.1, but the modified code has been removed in 6a0a1e5c.