anchor.diff:      gen_spec("-spec", ErlTypePrefix, F).
   
   gen_spec(SpecAttribute, ErlTypePrefix, F) ->
  +    % XXX, NOTE: use of piqic:erlname() here is a quick hack but this should be
  +    % enough; to do it properly, we'd need to resolve <Name>-input|output|error
  +    % Piqi type and use its erlang_name
  +    ErlTypeName = [ErlTypePrefix, piqic:erlname(F#func.name)],
       ErlName = F#func.erlang_name,
       Input =
           case F#func.input of
               'undefined' -> "'undefined'";
  -            _ -> [ ErlTypePrefix, ErlName, "_input()" ]
  +            _ -> [ ErlTypeName, "_input()" ]
           end,
   
       Output =
           case F#func.output of
               'undefined' -> "ok";
  -            _ -> [ "{ok, ", ErlTypePrefix, ErlName, "_output()}" ]
  +            _ -> [ "{ok, ", ErlTypeName, "_output()}" ]
           end,
   
       Error =
           case F#func.error of
               'undefined' -> "";
  -            _ -> [ " |\n    {error, ",  ErlTypePrefix, ErlName, "_error()}" ]
  +            _ -> [ " |\n    {error, ", ErlTypeName, "_error()}" ]
           end,
   
       [
  
positive.code:     Name = F#func.name,
      ErlName = F#func.erlang_name,
      ScopedName = [ Mod, "/", Name ],
      InputCode =
          case F#func.input of
              'undefined' -> % the function doesn't have input
  
negative.code:     Output =
          case F#func.output of
              'undefined' -> "ok";
              _ ->
                  % XXX, NOTE: use of piqic:erlname() here is a quick hack but
                  % this should be enough; to do it properly, we'd need to resolve
                  % <Name>-output Piqi type and use its erlang_name
                  [ "{ok, ", ErlMod, ":default_", piqic:erlname(F#func.name), "_output()}" ]
          end,
  
      [ ErlName, "(", Input, ") -> ", Output, ".\n\n" ].
  