anchor.diff:      [] = rotate([]).
   
   rewrite(Fun, Term) ->
  -    case Fun(Term) of
  -        continue ->
  -            do_rewrite(Fun, Term);
  -        {stop, NewTerm} ->
  -            NewTerm
  -    end.
  -
  -do_rewrite(Fun, [H|T]) ->
  -    [rewrite(Fun, H) | rewrite(Fun, T)];
  -do_rewrite(_Fun, []) ->
  -    [];
  -do_rewrite(Fun, Tuple) when is_tuple(Tuple) ->
  -    L = [rewrite(Fun, E) || E <- tuple_to_list(Tuple)],
  -    list_to_tuple(L);
  -do_rewrite(_Fun, Term) ->
  -    Term.
  +    generic:maybe_transform(
  +      fun (T) ->
  +              case Fun(T) of
  +                  continue ->
  +                      {continue, T};
  +                  {stop, NewTerm} ->
  +                      {stop, NewTerm}
  +              end
  +      end, Term).
   
   rewrite_correctly_callbacks_on_tuples_test() ->
       executing_on_new_process(
  
positive.code:       end).
  
  rewrite_value(Old, New, Struct) ->
      rewrite(
        fun (Term) ->
                case Term =:= Old of
                    true ->
                        {stop, New};
                    false ->
                        continue
                end
        end,
        Struct).
  
  rewrite_key_value_tuple(Key, NewValue, Struct) ->
      rewrite(
        fun (Term) ->
                case Term of
                    {Key, _} ->
                        {stop, {Key, NewValue}};
                    _ ->
                        continue
                end
        end,
        Struct).
  
  rewrite_tuples(Fun, Struct) ->
      rewrite(
  
negative.code: 
  -include("triq.hrl").
  -include_lib("eunit/include/eunit.hrl").
  
  -include("generic.hrl").
  
  -compile(export_all).
  
  