anchor.diff:    | (status, Inr n) -> (status, Inr n)
     | (status, Inl full_st) -> (status, Inl (fn full_st))
   
  +let repl_stdin = function
  +  | PartialReplState st -> st.prepl_stdin
  +  | FullReplState st -> st.repl_stdin
  +
  +let repl_fname = function
  +  | PartialReplState st -> st.prepl_fname
  +  | FullReplState st -> st.repl_fname
  +
   let repl_stack: ref<list<full_repl_state>> = Util.mk_ref []
   
   let repl_stack_empty () =
  
positive.code:           { qid = q.qid; qq = GenericError "Current module unset" }
          | _ -> q
  
  let stdin = function
    | PartialReplState st -> st.prepl_stdin
    | FullReplState st -> st.repl_stdin
  
  let rec go st : int =
    let rec loop st : int =
      let query = validate_query st (read_interactive_query (stdin st)) in
      let (status, response), state_opt = run_query st query.qq in
      write_response query.qid status response;
      match state_opt with
  
negative.code:                                   try_arg "rules"
                                      |> Util.map_option (js_list js_reductionrule))
             | "search" -> Search (arg "terms" |> js_str)
             | "vfs-add" -> VfsAdd (try_arg "filename" |> Util.map_option js_str,
                                   arg "contents" |> js_str)
             | _ -> ProtocolViolation (Util.format1 "Unknown query '%s'" query) }
    with
    | InvalidQuery msg -> { qid = qid; qq = ProtocolViolation msg }
  