With apologies if it’s been discussed before, but I didn’t see anything.
What’s the rational behind having no support for negative numbers (i.e. Integers can be negative, but are opaque)? I’ve been using Dhall extensively for templating text with dhall text, but a sort of very basic thing one frequently wants to do is treat a value differently if it’s greater or less than zero (e.g. print negative number in red and positive in black). Since there’s no comparison for Integers nor even an Integer/isNegative or some such thing, this necessitates a lot of boilerplate, with a bunch of values that are just integers (and should ideally be represented in Json as such) having to instead be written as either:
< Positive : Natural | Negative : Natural>
or as something like
{ value : Natural, negative : Bool }
Both of these are cumbersome to actually use, since they necessarily require writing something like cost = MyType.Negative 5 rather than just cost = -5 and clutter things if/when they get turned to Json. Not to mention that there is the issue of having both “positive” and “negative” zero.
Is there a compelling reason to avoid arithmetic or at least sign checking for Integer? Or is there a better way of responding to negative values that I’m just overlooking (which is entirely possible)?