Is there a more elegant way of expressing positive and negative infinities in haskell other than let posInf = 1 / 0 and let negInf = -1 / 0 respectively?

有帮助吗?

解决方案

For Double and Float: no, not really. For other types: yes! Those types that do not yet have an infinity may be given one via PosInf and NegInf type constructors. Some types may also have their own special infinity, but to say more than that we'd need to know what type specifically you want to use.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top