4 ms·
Haskell has no problem with this(though its default Num hierarchy is sorely lacking) Prelude> a = 1 Prelude> a/2 0.5 Prelude> :t a/2 a/2 ::
by wz1000 8y ago
Haskell has no problem with this(though its default Num hierarchy is sorely lacking)
Prelude> a = 1
Prelude> a/2
0.5
Prelude> :t a/2
a/2 :: Fractional a => a
Prelude> b = 1 :: Int
Prelude> b/2
<interactive>:6:1: error:
• No instance for (Fractional Int) arising from a use of ‘/’
• In the expression: b / 2
In an equation for ‘it’: it = b / 2
Prelude> b `div` 2
0
Prelude> :t div
div :: Integral a => a -> a -> a