wa_diff (assert v1.0.1)

Summary

Types

block/0

-type block() :: {'__block__', meta(), [supported_input()]}.

break/0

-type break() :: binary().

container_type/0

-type container_type() :: tuple | list.

content/0

-type content() :: {boolean(), binary()}.

contents/0

-type contents() :: #{contents := [content()]}.

context/0

-type context() :: #{records => #{{atom(), pos_integer()} => [atom()]}}.

delimiter/0

-type delimiter() :: binary().

diff/0

-type diff() :: #{equivalent := boolean(), left := side(), right := side()}.

doc/0

-type doc() :: erlfmt_algebra:doc().

error_description/0

-type error_description() ::
          #{pos_integer() => unicode:chardata(),
            general => unicode:chardata(),
            reason => unicode:chardata()}.

error_info/0

-type error_info() :: #{cause => term(), module => module(), function => atom()}.

literal/0

-type literal() :: number() | atom() | binary() | string().

meta/0

-type meta() :: [{diff, boolean()}].

script/0

-type script() :: diffy:diffs().

side/0

-type side() ::
          contents() |
          literal() |
          {container_type(), meta(), [side()]} |
          block() |
          {struct_type(), meta(), [side()]} |
          struct_item().

struct_item/0

-type struct_item() :: {struct_item, side(), delimiter(), side()}.

struct_type/0

-type struct_type() :: map | {record, atom()}.

supported_input/0

-type supported_input() :: tuple() | number() | map() | atom() | string() | binary().

wrapper_fun/0

-type wrapper_fun() :: fun((doc()) -> doc()).

Functions

compute(Left, Right)

-spec compute(supported_input(), supported_input()) -> diff().

compute(Left, Right, Module)

-spec compute(supported_input(), supported_input(), atom()) -> diff().

error_info(Module, Left0, Right0)

-spec error_info(module(), dynamic(), dynamic()) -> {ok, error_info()} | {error, no_error_info}.

format_error(Reason, _)

-spec format_error(term(), erlang:stacktrace()) -> error_description().

glue(Doc1, BreakString, Doc2)

-spec glue(doc(), break(), doc()) -> doc().

green()

-spec green() -> binary().

join_docs(Doc1, Doc2)

-spec join_docs(doc(), doc()) -> doc().

red()

-spec red() -> binary().

reset()

-spec reset() -> binary().

to_algebra(Side, DiffWrapper)

-spec to_algebra(side(), wrapper_fun()) -> doc().

to_diff(Side, Pre, Post)

-spec to_diff(side(), doc(), doc()) -> {ok, string()} | {error, term()}.