kanishka

kanishka

Learning resources about dialyzer?

I am trying to build up my instincts for what errors dialyzer catches and what errors it doesn’t catch. Are there existing articles or videos that dive deep into Dialyzer and typespecs from a user perspective? I am hoping to avoid articles that go into the implementation of dialyzer.

Most Liked

BartOtten

BartOtten

If I recall correctly this video did help me a lot. It helps you think like Dialyzer which makes it easier to understand why it (does not) reports an error: https://youtu.be/Nxsw1jRE2A4

garazdawi

garazdawi

Erlang Core Team

While it in some parts is a bit heavy to read, the original paper on success typing contains a lot of information and if you understand what success typing is (and what it is not), then deciphering the error messages becomes easier.

BartOtten

BartOtten

Dialyzer is never wrong. When it knows an spec mismatch will happen in any case, it will report an error. If it might happen, it won’t as the conditions in which the function returns a non matching type might never occur. After all: you as a developer might call the function only in a way that makes it matching.

Example

@ spec foo(arg :: integer) :: :ok
def foo(arg) when is_integer(arg) do
   case arg do
     1 -> :ok
     _other -> :error
 end
end

You might think Dialyzer should/would warn that :error is not in the spec.

However, Dialyzer thinks different:

Maybe this function is only ever called with foo(1); then there is no issues at all as indeed it only will return :ok. I will not raise an issue.

There are flags to tune this behavior but their usage might cause other ‘issues’ so those are false by default.

Where Next?

Popular in Chat/Questions Top

Besto
I’ve been trying to start learning Elixir for a couple of weeks while I develop a tiny project I have on node.js, but every time I try to...
New
maqbool
what books/Resources do you recommend to learn about distributed system(theory)?
New
markdev
What are the best beginner resources for learning Elixir and OTP (not Phoenix) in 2018?
New
Nopp
Hey guys and girls, i am completely “new” to programming, recently played a bit with Python, Ruby and PureBasic, but i want to try somet...
New
Fl4m3Ph03n1x
I am doing some exercises while learning Elixir using Exercism.io. Now, my objective is to do all exercises, extras included. This shoul...
New
davearonson
I am looking for smallish problems to solve, using Elixir concepts beyond the basic syntax and concepts of Elixir as a language, such as ...
New
woohaaha
I’m coming from Ruby and Rails. I have read some Elixir and Phoenix books. They shed a lot of light about building applications in Elixir...
New
wolfiton
Hi everyone, How can i retrieve the name from a structure like this? %{"id" => "1570", "name" => "Croque Monsieur"} My test loo...
New
dopomecana
The title of this topic may sound silly at the first glance. But why I trying to ask you guys is how to go to the next level? I am curre...
New
marciol
Hey, I have very restricted resources and time so I’m trying to understand the best way to learn Liveview in terms of cost/time. The Pra...
New

Other popular topics Top

rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
Nvim
Anybody knows a comprehensive comparison of Django and Phoenix, thanks for the help. Where are they similar? Where do they differ the m...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 43622 214
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
274 41539 114
New

We're in Beta

About us Mission Statement