Pregunta

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?

¿Fue útil?

Solución

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top