Generate specifications for your Erlang functions.
When you are inside the function, call :ErlangSpec
and this script will
produce specification for it. It won't fill in the argument types for you,
though.
- Pathogen
git clone https://github.com/melekes/vim-erlang-spec ~/.vim/bundle/vim-erlang-spec
- Vundle
Bundle 'melekes/vim-erlang-spec'
- NeoBundle
NeoBundle 'melekes/vim-erlang-spec'
Add a mapping to your ~/.vimrc (change the key to suit your taste):
nnoremap <leader>s :ErlangSpec<CR>
If you are new to Erlang, you may be not aware of TypEr - tool, which can be used to generate type annotations for functions. You can read about it here or in the "Erlang Programming" book ("TypEr: Success Types and Type Inference").
- transform record to record type (
#person{name=Name}
=>#person{}
) - parse
is_integer
and other simple guards in when block (f(N, _) when is_integer(N)
=>f(N, _) -> any() when N :: integer()
)
Any comments or suggestions? Feel free to open an issue and we will discuss them.