Hi
I have some code that uses MPTC + FDs + flexible and undecidable
instances that was working fine until I did a trivial modification on
another part of the project. Now, GHC is complaining with a very
confusing (for me, at least) error message. I've been finally able to
reproduce the
I have a guess...
Daniel Gorín wrote:
Hi
I have some code that uses MPTC + FDs + flexible and undecidable
instances that was working fine until I did a trivial modification on
another part of the project. Now, GHC is complaining with a very
confusing (for me, at least) error message. I've
By the way, if you make the class C fundep declaration into:
class C m f n | m f - n where
then it compiles. This means ((M n) and (F n) imply N) and (any m and F'
imply N') which no longer conflict.
Daniel Gorín wrote:
Hi
I have some code that uses MPTC + FDs + flexible and undecidable
Hi, Chris
Thanks for your answer. I guess that my intuitions of what functional
dependencies and context meant were not very accurate (see below)
class C m f n | m - n, f - n where
c :: m - f - Bool
The m-n functional dependency means that I tell you
C x _ z is an instance then you
Hi Marcin,
| In particular, should the following be legal:
|
| class C a b c | a - b c
| instance C [a] b b
| f:: C [a] b c = a
| f = undefined
|
| ghc panics and Hugs rejects it.
No, it is not legal. Even if you delete the definition of f, the code
is still not legal because the class and
Thu, 4 Jan 2001 13:01:56 -0800, Mark P Jones [EMAIL PROTECTED] pisze:
I hope now that the problem is becoming clear: this instance
declaration is not consistent with the dependency; in the first
two lines above, for example, we see two rows that violate the
specification because they have
| I think you can simplify the example. Given
|
| class HasFoo a b | a - b where
| foo :: a - b
| instance HasFoo Int Bool where ...
|
| Is this legal?
| f :: HasFoo Int b = Int - b
| f x = foo x
The theoretical foundation for functional dependencies goes back
On 03-Jan-2001, Mark P Jones [EMAIL PROTECTED] wrote:
... the best way to deal with this is (probably):
(i) to infer simpler types whenever possible, but
(ii) to allow more polymorphic types when they are requested by
means of an explicit type signature.
I agree.
(Incidentally, in
I don't fully understand fundeps. Would the following transform
legal programs (without overlapping instances) into legal programs?
I hope yes.
Let's imagine a class with a set of instances and uses, without
fundeps.
- Add some additional type variables to the class header.
- Add a fundep: all
Simon Peyton-Jones wrote:
I think you can simplify the example. Given
class HasFoo a b | a - b where
foo :: a - b
instance HasFoo Int Bool where ...
Is this legal?
f :: HasFoo Int b = Int - b
f x = foo x
You might think so, since
Thu, 21 Dec 2000 00:59:29 -0800, Jeffrey R. Lewis [EMAIL PROTECTED] pisze:
class HasFoo a b | a - b where
f :: HasFoo Int b = Int - b
f x = foo x
This is the step where the reasoning goes wrong. The functional
dependency tells you that `b' isn't really a free
Simon Peyton-Jones wrote:
I think you can simplify the example. Given
class HasFoo a b | a - b where
foo :: a - b
instance HasFoo Int Bool where ...
Is this legal?
f :: HasFoo Int b = Int - b
f x = foo x
You might think so, since
than meets the eye. Even whether
one type is more general than another has changed!
Simon
| -Original Message-
| From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
| Sent: 17 December 2000 19:30
| To: [EMAIL PROTECTED]
| Subject: Problem with functional dependencies
|
|
| The follow
The following module is rejected by both
ghc -fglasgow-exts -fallow-undecidable-instances
and
hugs -98
class HasFoo a foo | a - foo where
foo :: a - foo
data A = A Int
data B = B A
instance HasFoo A Int where
14 matches
Mail list logo