[erlang-questions] How to define non_neg_float() type specification?
Fri Sep 28 09:21:17 CEST 2012
On Thu, Sep 27, 2012 at 09:32:47AM -0700, Stavros Aronis wrote:
> Unfortunately Dialyzer does not support it (even constants are generalized
> to any float, typwise). Consequentially, the type language does tnot
> support it.
Eh.. Erlang looks so close to having guards in type specs. Wouldn't that
> This will help you documentation-wise and also (though in a somewhat
> limited way) Dialyzer-wise. If you use this type PropEr-wise however, you
> will get positive values, which you will need to filter...
Even better, just abs(It) :)
?LET(It, float(), abs(It)).
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 836 bytes
Desc: Digital signature
More information about the erlang-questions