Skip to content

Instantly share code, notes, and snippets.

@egisatoshi
Last active August 29, 2015 14:01
Show Gist options
  • Save egisatoshi/936492f59fbd762ff160 to your computer and use it in GitHub Desktop.
Save egisatoshi/936492f59fbd762ff160 to your computer and use it in GitHub Desktop.

Preparation

Build PLT files. (Get types of core libraries.) The file .dialyzer_plt is created in your home directory. It will take time (more than a minute).

$ dialyzer --build_plt --apps erts kernel stdlib crypto mnesia sasl common_test eunit

Get project source

$ git clone [email protected]:leo_project/leo_pod.git
$ cd leo_pod

Build PLT files for dependent libraries. (If there are ones.) leo_pod has no dependent libraries. So you don't need this.

$ dialyzer --build_plt --apps ...

Use typer and dialyzer

$ typer -r src/

%% File: "src/leo_pod_sup.erl"
%% ---------------------------
-spec start_link() -> 'ignore' | {'error',_} | {'ok',pid()}.
-spec start_link(atom(),_,_,_,_) -> 'ignore' | {'error',_} | {'ok',pid()}.
-spec start_link(atom(),_,_,_,_,_) -> 'ignore' | {'error',_} | {'ok',pid()}.
-spec stop(atom()) -> 'not_started' | 'true'.
-spec init([any()]) -> {'ok',{{'one_for_one',5,10},[{_,_,_,_,_,_}]}}.

%% File: "src/leo_pod_app.erl"
%% ---------------------------
-spec start(_,_) -> 'ignore' | {'error',_} | {'ok',pid()}.
-spec stop(_) -> 'ok'.

%% File: "src/leo_pod_manager.erl"
%% -------------------------------
-spec test() -> any().
-spec start_link(atom(),_,_,_,_,_) -> 'ignore' | {'error',_} | {'ok',pid()}.
-spec stop(_) -> any().
-spec checkout(_) -> any().
-spec checkin(_,_) -> any().
-spec checkin_async(atom() | pid() | {atom(),_} | {'via',_,_},_) -> 'ok'.
-spec status(_) -> any().
-spec raw_status(_) -> any().
-spec pool_pids(_) -> any().
-spec init([any(),...]) -> {'ok',#state{num_of_children::pos_integer(),max_overflow::pos_integer(),num_overflow::pos_integer(),worker_mod::atom(),worker_args::[tuple()],worker_pids::[pid()]}} | {'stop',_}.
-spec handle_call('checkout' | 'pool_pids' | 'raw_status' | 'status' | 'stop' | {'checkin',_},_,_) -> {'reply','ok' | {'error','empty'} | {'ok',_},tuple()} | {'stop','normal','ok',_}.
-spec handle_cast(_,_) -> {'noreply',_}.
-spec handle_info(_,_) -> {'noreply',_}.
-spec terminate(_,_) -> 'ok'.
-spec code_change(_,_,_) -> {'ok',_}.
-spec start_child(atom(),[any()]) -> {'ok',pid()} | {'error',any()}.
-spec start_child(non_neg_integer(),atom(),[any()],[pid()]) -> {'ok',[pid()]} | {'error',any()}.

%% File: "src/leo_pod.erl"
%% -----------------------
-spec child_spec(atom(),_,_,_,_,_) -> 'ignore' | {'error',_} | {'ok',pid()}.
-spec checkout(_) -> any().
-spec checkin(_,_) -> any().
-spec checkin_async(atom() | pid() | {atom(),_} | {'via',_,_},_) -> 'ok'.
-spec status(_) -> any().
$ dialyzer -r src/ --src
  Checking whether the PLT /home/egi/.dialyzer_plt is up-to-date... yes
  Proceeding with analysis... done in 0m0.91s
done (passed successfully)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment