You can implement this with -callback
attributes:
%% Filename: sport.erl
-module(sport).
-callback setHomeTeam(Name :: string()) -> ok.
-callback setVisitingTeam(Name :: string()) -> ok.
Then whenever you want to provide this interface:
-behavior(sport).
I cannot however currently think of a way to do inheritance between behaviours. You can emulate it with included .hrl files that contain the relevant -behaviour
attributes, instead of specifying them verbatim but this feels dirty.
Dialyzer will check that the callback satisfy the specified -specs
if the behaviour modules are analyzed together with the modules that use them or are already in the PLT.