Skip to content

Instantly share code, notes, and snippets.

@ksauzz
Created September 16, 2011 11:04
Show Gist options
  • Save ksauzz/1221867 to your computer and use it in GitHub Desktop.
Save ksauzz/1221867 to your computer and use it in GitHub Desktop.
erlang development note...

OTP

trace debug

gen_server:start_link({local, ?SERVER}, ?MODULE, [], [{debug,[trace]}])

rebar

dependencies

{deps, [
  {webmachine, "1.9.0", {git, "https://github.com/basho/webmachine.git", {tag,"1.9.0"}}}
]}.

generate skelton codes

  • ./rebar create-app appid=xxx
  • ./rebar create template=simplemod modid=xxx
  • ./rebar create template=simplesrv srvid=xxx_serve

packaging

mkdir rel
cd rel
../rebar create-node nodeid=ememcached
../rebar generate

see: https://github.com/basho/rebar/tree/master/priv/templates

dialyzer

Dialyzer is a static analysis tool that identifies software discrepancies such as type errors, unreachable code, unnecessary tests, etc in single Erlang modules or entire (sets of) applications.

build plt file

dialyzer --build_plt --apps erts kernel stdlib

extend plt file

dialyzer --add_to_plt --apps mnesia

analyse sources

dialyzer --src src/*.erl

typer

TypEr is a tool that automatically inserts type annotations in Erlang code.

show type

typer -I include src/*.erl

insert type into file

typer --annotate -I include src/*.erl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment