Re: [Haskell-cafe] functional dependencies question

2010-07-01 Thread Neil Brown
On 01/07/10 13:11, Patrick Browne wrote: Neil, Does the following sum up the situation? The class Num has subclasses containing various numeric types and the literal 1 is a value for one or more of those types. Hence the Haskell compiler says the instance 1) is OK. But at run time, without the qu

Re: [Haskell-cafe] functional dependencies question

2010-07-01 Thread Miguel Mitrofanov
The class Num has subclasses containing various numeric types and the literal 1 is a value for one or more of those types. Well, the problem is not with subclasses, but with types. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haske

Re: [Haskell-cafe] functional dependencies question

2010-07-01 Thread Ketil Malde
Patrick Browne 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'

Re: [Haskell-cafe] functional dependencies question

2010-07-01 Thread Patrick Browne
Neil, Does the following sum up the situation? The class Num has subclasses containing various numeric types and the literal 1 is a value for one or more of those types. Hence the Haskell compiler says the instance 1) is OK. But at run time, without the quantified (1:Int), the 1 could of more than

Re: [Haskell-cafe] functional dependencies question

2010-07-01 Thread Neil Brown
On 01/07/10 12:37, Patrick Browne wrote: Why do some cases such as 1) fail to run even if they are the only instantiation. -- 1) Compiles but does not run instance LocatedAt Int String where spatialLocation(1)="home" That instance is fine. I presume the problem is that you are trying

[Haskell-cafe] functional dependencies question

2010-07-01 Thread Patrick Browne
Hi, My understanding of functional dependencies is that they can be used to ensure that one type depends on another type. For example, the type of location depends could on the type of the object at that location. Consider two models 1) The location of an aircraft landing should have location of th