It would be nice if more OTP modules included -export_type
.
For example we create a module in our application to provide a public API for logging. In that module the logs are implemented with disk_log
. We write an API function like this:
-spec log(Log, Event) -> Result
when
Log :: term(),
Event :: event(),
Result :: ok | {error, Reason},
Reason :: disk_log:log_error_rsn().
%% @doc Log `Event' to disk.
… however since disk_log
doesn’t export log_error_rsn()
dialyzer won’t find it. There are many examples like this.