anchor.diff:    {ok, Val} = Res, % deliberately throws in case of error
     Val.
   
  +ktrue(_) -> {ok, true}.
  +
  +%% Generic input port infrastructure
  +
  +-record(input_port_fns,
  +	{close,
  +	 read_char,
  +	 peek_char,
  +	 is_char_ready}).
  +
  +handle_input_port(State0, Fns) ->
  +  receive
  +    {Pid, Cmd} when is_pid(Pid), is_atom(Cmd) ->
  +      case Cmd of
  +	'read_char' ->
  +	  {R, State1} = (Fns#input_port_fns.read_char)(State0),
  +	  Pid ! {self(), R},
  +	  handle_input_port(State1, Fns);
  +	'peek_char' ->
  +	  {R, State1} = (Fns#input_port_fns.peek_char)(State0),
  +	  Pid ! {self(), R},
  +	  handle_input_port(State1, Fns);
  +	'is_char_ready' ->
  +	  R = (Fns#input_port_fns.is_char_ready)(State0),
  +	  Pid ! {self(), R},
  +	  handle_input_port(State0, Fns);
  +	'close' ->
  +	  R = (Fns#input_port_fns.close)(State0),
  +	  Pid ! {self(), R};
  +	_ ->
  +	  R = {error, Cmd},
  +	  Pid ! {self(), R},
  +	  handle_input_port(State0, Fns)
  +      end;
  +    _ ->
  +      handle_input_port(State0, Fns)
  +  end.
  +
   open_input_port(State, Fns) ->
     spawn(fun () -> handle_input_port(State, Fns) end).
   
  
positive.code:     [] -> {ok, false}; % alas, io: doesn't support non-blocking peeks
      _Ch -> {ok, true}
    end.
  
negative.code: 	  -1
        end,
    {{ok, V}, S}.
  
  %% File input ports
  
  