bitwalker / libgraph

A graph data structure library for Elixir projects
MIT License
524 stars 75 forks source link

Might be better for Graph.topsort/1 to return :error and {:ok, sorted_graph}? #27

Open x-ji opened 5 years ago

x-ji commented 5 years ago

Dialyzer complains The test [any()] == 'false' can never evaluate to 'true' when I try to check the output of Graph.topsort/1. Apparently the typespec annotation confused it. I guess one could either change the return value to :error | {:ok, sorted_graph} or change the typespec so that Dialyzer doesn't find it problematic? Or am I doing something wrong here.

stevensonmt commented 5 months ago

What test are you referring to here? Since topsort/1 can return a list of vertices or the boolean false Dialyzer is correct to say that you cannot get a list to equate to false.