
1 Jul
2010
1 Jul
'10
8:14 a.m.
Patrick Browne
Why do some cases such as 1) fail to run even if they are the only instantiation.
I think this is because literal numbers are polymorphic, i.e. a '1' in your source code is shorthand for 'fromIntegral 1', which is a type of Num a => a. Thus, 'spatialLocation 1' doesn't tell the compiler enough to know that you don't want the Float instance, for instance. Try 'spatialLocation (1::Int)'? Similar for floating point literals, they are of type Fractional a => a. -k -- If I haven't seen further, it is by standing in the footprints of giants