anchor.diff:  process_clauses(Type, Vars, Clauses) ->
     % Proceed with the normal SSA transformation on each clause
     Clauses2 = lists:map(fun(Clause) ->
  -    {ok, {_, Binding}, Clause2} = reia_visitor:transform(Clause, {Type, Vars}, fun transform/2),
  +    {ok, #state{bindings=Binding}, Clause2} = reia_visitor:transform(
  +      Clause, 
  +      #state{mode=Type, bindings=Vars}, 
  +      fun transform/2
  +    ),
       {Binding, Clause2}
     end, Clauses),
     
  
positive.code:       {dict:store(Name, 0, Dict), 0}
    end,
    Node = {identifier, Line, ssa_name(Name, Version2)},
    {stop, {match, Dict2}, Node};
    
  % Vars are generated internally by earlier stages of the compiler and work 
  % like identifiers, mapped to their latest version
  transform({normal, _} = State, {var, Line, Name}) ->
    {stop, State2, {identifier, _, Name2}} = transform(State, {identifier, Line, Name}),
    {stop, State2, {var, Line, Name2}};
    
  transform({match, _} = State, {var, Line, Name}) ->
    {stop, State2, {identifier, _, Name2}} = transform(State, {identifier, Line, Name}),
    {stop, State2, {var, Line, Name2}};
     
  
negative.code:     error ->
        case internal_variable(Name) of
          true ->
            transform(#state{mode=normal, bindings=dict:store(Name, 0, Dict)}, Node);
          false ->
            throw({error, {Line, lists:flatten(io_lib:format("unbound variable: '~s'", [Name]))}})
        end
    end;
    
  % On the LHS of match expressions, variables are assigned a new version
  transform(#state{mode=match, bindings=Dict}, {identifier, Line, Name}) ->
    {Dict2, Version2} = case dict:find(Name, Dict) of
      {ok, Version} ->
        {dict:store(Name, Version + 1, Dict), Version + 1};
  