for when one expects a list to be non-empty, i think there’s strong argument in favor of an enforcement from the type checker, given that the prove will very likely be necessary. if not in the application code then in the tests.
Re:Typing Lists and Tuples in Elixir
by greener_grass on Wednesday August 28, 2024 @02:51PM
(#41382879)
Does this break down if we want some other types?
e.g.
list(a) = empty_list() or singleton_list(a) or two_or_more_list(a)
But overall, you are right: our concern is exactly all of the extra function calls that may now suddenly become necessary (and the tension mentioned in the article). We will review our design decisions as we keep on rolling out the type system!