
27 Mar
2009
27 Mar
'09
5:12 a.m.
Daniel Fischer
(/) in the first equation is at type Double -> Double -> Double.
Then why don't I get an error here: Prelude> 2 / 4 0.5 Prelude> 2 / fromIntegral 4 0.5 And why does this happen: Prelude> let x = 2 Prelude> :type x x :: Integer Prelude> x / fromIntegral 4 <interactive>:1:0: No instance for (Fractional Integer) arising from a use of `/' at <interactive>:1:0-17 Possible fix: add an instance declaration for (Fractional Integer) In the expression: x / fromIntegral 4 In the definition of `it': it = x / fromIntegral 4 And how do I read this type: Prelude> :type fromIntegral fromIntegral :: (Num b, Integral a) => a -> b What does the => mean?