anchor.diff:      io_lib:format("list(~s)", [join([ atom_to_list(Attr) || Attr <- Attrs ], ",")]);
   typeref(_Style,{predef,{tuple,Attrs}},_C) ->
       io_lib:format("tuple(~s)", [join([ atom_to_list(Attr) || Attr <- Attrs ], ",")]);
  +%% abnf
  +typeref(ubf,{abnf_alt,_}=X,_C) ->
  +    io_lib:format("~p", [X]);
  +typeref(ubf,{abnf_seq,_}=X,_C) ->
  +    io_lib:format("~p", [X]);
  +typeref(ubf,{abnf_repeat,Min,Max,Type},C) ->
  +    io_lib:format("{abnf_repeat,~s,~s,~s}",
  +                  [typeref(ubf,Min,C), typeref(ubf,Max,C), typeref(ubf,Type,C)]);
  +typeref(ubf,{abnf_byte_range,_,_}=X,_C) ->
  +    io_lib:format("~p", [X]);
  +typeref(ubf,{abnf_byte_alt,_}=X,_C) ->
  +    io_lib:format("~p", [X]);
  +typeref(ubf,{abnf_byte_seq,_}=X,_C) ->
  +    io_lib:format("~p", [X]);
  +typeref(ubf,{abnf_byte_val,_}=X,_C) ->
  +    io_lib:format("~p", [X]);
  +typeref(_Style,{abnf_alt,_},_C) ->
  +    "binary()";
  +typeref(_Style,{abnf_seq,_},_C) ->
  +    "binary()";
  +typeref(_Style,{abnf_repeat,_,_,_},_C) ->
  +    "binary()";
  +typeref(_Style,{abnf_byte_range,_,_},_C) ->
  +    "binary()";
  +typeref(_Style,{abnf_byte_alt,_},_C) ->
  +    "binary()";
  +typeref(_Style,{abnf_byte_seq,_},_C) ->
  +    "binary()";
  +typeref(_Style,{abnf_byte_val,_},_C) ->
  +    "binary()";
   %% otherwise
   typeref(_Style,Type, _C) ->
       io_lib:format("~p()", [Type]).
  
positive.code:                      , "%% ----------"
                       , io_lib:format("%% ~s", [Input])
                       , "%%"
                       , io_lib:format("%~s =>", [Params])
                       , io_lib:format("%   ~s;", [Result])
                      ], "\n")
             end
             || {{prim,1,1,Input}, {prim,1,1,Output}} <- C#contract.anystate ],
  
negative.code:           , "%%   - A()? means \"optional A()\""
            , "%%   - A(Attrs) means \"A() subject to the comma-delimited type attributes"
            , "%%"
            , "%%"
            , "%% true\n%%\t\ttrue"
            , "%% false\n%%\t\tfalse"
            , "%% undefined\n%%\t\tundefined"
            , "%%"
            , "%% any()\n%%\t\tany"
            , "%% any()?\n%%\t\tany | undefined"
            , "%%"
            , "%% none()\n%%\t\t /* no result is returned */"
            , "%% none()?\n%%\t\t /* no result is returned */ | undefined"
            , "%%"
            , "%% atom()\n%%\t\tatom"
            , "%% atom()?\n%%\t\tatom | undefined"
            , "%%"
            , "%% binary()\n%%\t\tbinary"
            , "%% binary()?\n%%\t\tbinary | undefined"
            , "%%"
            , "%% float()\n%%\t\tfloat"
            , "%% float()?\n%%\t\tfloat | undefined"
            , "%%"
            , "%% integer()\n%%\t\tinteger"
            , "%% integer()?\n%%\t\tinteger | undefined"
            , "%%"
            , "%% list()\n%%\t\tlist"
            , "%% list()?\n%%\t\tlist | undefined"
            , "%%"
            , "%% tuple()\n%%\t\ttuple"
            , "%% tuple()?\n%%\t\ttuple | undefined"
            , "%%"
            , "%% --------------------"
            , "%% type attributes"
            , "%%"
            , "%%"
            , "%% any(AnyAttrs)\n%%\t\tany"
            , "%% any(AnyAttrs)?\n%%\t\tany | undefined"
            , "%%"
            , "%% atom(AtomAttrs)\n%%\t\tatom"
            , "%% atom(AtomAttrs)?\n%%\t\tatom | undefined"
            , "%%"
            , "%% binary(BinaryAttrs)\n%%\t\tbinary"
            , "%% binary(BinaryAttrs)?\n%%\t\tbinary | undefined"
            , "%%"
            , "%% list(ListAttrs)\n%%\t\tlist"
            , "%% list(ListAttrs)?\n%%\t\tlist | undefined"
            , "%%"
            , "%% tuple(TupleAttrs)\n%%\t\ttuple"
            , "%% tuple(TupleAttrs)?\n%%\t\ttuple | undefined"
            , "%%"
            , "%%"
            , "%% AnyAttrs"
            , "%% \t nonempty"
            , "%% \t nonundefined"
            , "%%"
            , "%% AtomAttrs"
            , "%% \t ascii | asciiprintable"
            , "%% \t nonempty"
            , "%% \t nonundefined"
            , "%%"
            , "%% BinaryAttrs"
            , "%% \t ascii | asciiprintable"
            , "%% \t nonempty"
            , "%%"
            , "%% ListAttrs"
            , "%% \t nonempty"
            , "%%"
            , "%% TupleAttrs"
            , "%% \t nonempty"
            , "%%"
            , "%% --------------------"
            , "%% user-defined attributes"
            , "%%"
            , "%%"
            , "%% {type1() ...}\n%%\t\ttuple"
            , "%% {type1() ...}?\n%%\t\ttuple | undefined"
            , "%%"
            , "%% record()\n%%\t\trecord"
            , "%% record()?\n%%\t\trecord | undefined"
            , "%%"
            , "%% [type()]\n%%\t\tlist of type()"
            , "%% [type()]?\n%%\t\tlist of length 0 or length 1 of type()"
            , "%% [type()]+\n%%\t\tlist of length greater than 0 of type()"
            , "%% [type()]{M}\n%%\t\tlist of length M of type()"
            , "%% [type()]{M,}\n%%\t\tlist of minimum length M of type()"
            , "%% [type()]{,M}\n%%\t\tlist of maximum length M of type()"
            , "%% [type()]{M,N}\n%%\t\tlist of minimum length M and maximum length N of type()"
            , "%%"
            , "%% integer()..integer()\n%%\t\tinteger"
            , "%% ..integer()\n%%\t\tinteger"
            , "%% integer()..\n%%\t\tinteger"
            , ""
            , ""
           ],
  