ninenines/ranch — pull request #97 by sile (2014-12-04 19:27:35+00:00)
Title: Fix ranch:start_listener/6 spec

Error reasons which may be returned by `supervisor:start_child/2` are added.

### Motivation

Currently dialyzer warns correct codes as below:

```erlang
-module(my_ranch).

-export([ensure_listener_started/6]).

%% @doc Equivalent to `ranch:start_listener/6' except it returns `{ok, pid()}' for already started listeners.
ensure_listener_started(Ref, NbAcceptors, Transport, TransOpts, Protocol, ProtoOpts) ->
%% dialyzer warning:
%% The pattern {'error', {'already_started', Pid}} can never match the type {'error','badarg'} | {'ok',pid()}
case ranch:start_listener(Ref, NbAcceptors, Transport, TransOpts, Protocol, ProtoOpts) of
{error, {already_started, Pid}} -> {ok, Pid};
Other -> Other
end.
```