4 ms·
The type signature of division in Haskell merely requires that it takes two fractional `a`s and returns another `a`. 1 / 0 :: Double evaluates to Infinity.
by dddbbb 6y ago
The type signature of division in Haskell merely requires that it takes two fractional `a`s and returns another `a`.
1 / 0 :: Double
evaluates to Infinity.
1 / 0 :: Rational
throws a runtime exception. A division by zero producing zero would be perfectly sensible in Haskell, and perhaps even desired if you are totally averse to runtime errors. The Pony language infamously does this.