<div dir="ltr">Your example will work if you are implementing some other module which uses my_db as its behavior:<div><br></div><div>-module(db_impl).</div><div>-behaviour(my_db).<br></div><div>-export([table/0]).<br></div>
<div><br></div><div>table -> ["hello, world"].</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jul 16, 2014 at 7:56 AM, Daniil Churikov <span dir="ltr"><<a href="mailto:ddosia@gmail.com" target="_blank">ddosia@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">%% I apologize if you get this message second time, but initially I posted it through google-groups<br>%% interface and discovered that it is not replicated to this mailing list.<br>
<br>Is there any way to write a spec for dialyzer that will tell that I expect module of certain behaviour?<br>
<br>Simplified example:<br><br>-module(my_db)<br><br>-callback table() -> iolist().<br><br>%% Instead of `Mod :: atom()' I want something that will reflect that only<br>%% modules which implements `my_db' behaviour are allowed.<br>

-spec create(Mod :: atom(), Vals :: [iolist(), ...]) -> iolist().<br>create(Mod, Vals) -><br>    Table = Mod:table(),<br>    ["INSERT INTO ", Table, " VALUES (", string:join(Vals, ", "), ");"].<br>

</div>
<br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Sean Cribbs <<a href="mailto:sean@basho.com" target="_blank">sean@basho.com</a>><div>Software Engineer</div><div>Basho Technologies, Inc.</div><div><a href="http://basho.com/" target="_blank">http://basho.com/</a></div>

</div>