anchor.diff:  parse_constraints([ConstraintType | Rest], Substitutions) ->
       case ConstraintType of
           {type,_,constraint,[{atom,_,is_subtype},[{var,_,Variable},Type]]} ->
  -            NewSubstitutions = gb_trees:insert(Variable, Type, Substitutions),
  -            parse_constraints(Rest, NewSubstitutions);
  +            case gb_trees:lookup(Variable, Substitutions) of
  +                {value,Val} ->
  +                    case equal_types(Val, Type) of
  +                        true ->
  +                            NewSubstitutions = gb_trees:enter(Variable, Type, Substitutions),
  +                            parse_constraints(Rest, NewSubstitutions);
  +                        false ->
  +                            throw({parse_error, Val})
  +                    end;
  +                none ->
  +                    NewSubstitutions = gb_trees:insert(Variable, Type, Substitutions),
  +                    parse_constraints(Rest, NewSubstitutions)
  +            end;
           _ ->
               ct:pal("unknown constraint ~w", [ConstraintType]),
               parse_constraints(Rest, Substitutions)
  
positive.code:         none -> {var,_Line,VarName}
      end;
  
  substitute_constraints({type, Line,bounded_fun, [FunType, _Constraints]}, Substitutions) ->
      substitute_constraints(FunType, Substitutions);
  
  % generic types
  
negative.code:     %ct:pal("~w:~w ~w ~w", [Module, _Line, FunName, AFunSpec]),
      FunSpec = case AFunSpec of
                    [{type, _,bounded_fun, [_TypeFun, ConstraintType]}] ->
                        try
                            Substitutions = parse_constraints(ConstraintType, gb_trees:empty()),
                            substitute_constraints(AFunSpec, Substitutions)
                        catch
                            {subst_error, Description} ->
                                ct:pal("substitution error ~w in ~w:~w ~w", [Description, Module, FunName, AFunSpec]),
                                exit(foobar);
                            {parse_error, Description} ->
                                ct:pal("parse error ~w in ~w:~w ~w", [Description, Module, FunName, AFunSpec]),
                                exit(foobar)
                        end;
                    _ ->
  