[Haskell-cafe] functional dependencies question
Ketil Malde
ketil at malde.org
Thu Jul 1 08:14:05 EDT 2010
Patrick Browne <patrick.browne at dit.ie> writes:
> 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
More information about the Haskell-Cafe
mailing list