But that if statement would only go around something doing integer
division, where the divisor could be zero. What you're suggesting would be
required for at least all integer division, and potentially a pattern for
other integer operations. That's a huge impact.

On Feb 18, 2017 7:06 PM, "'Rupert Smith' via Elm Discuss" <
elm-discuss@googlegroups.com> wrote:

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 elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
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 elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to