On Saturday, February 18, 2017 at 11:23:01 PM UTC, Alex Barry wrote:
>
> I think for integer division, it has to return 0 because infinity is 
> expressed as a float. I'm going to agree with Erkal, though, you definitely 
> don't want to wrap all your math statements in a maybe or result type, that 
> would make most code considerably more verbose.
>

But to use it safely you have to wrap it in a check for zero anyway

if divisor == 0 then
  ...
else
  val // divisor

Which is equally complex as:

case (a // b) of
  Integer val -> val
  DivideByZero -> ...


-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to