Question

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?

Était-ce utile?

La solution

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top