diff options
author | simonpj <unknown> | 2001-12-06 10:45:43 +0000 |
---|---|---|
committer | simonpj <unknown> | 2001-12-06 10:45:43 +0000 |
commit | 61fae1d3fb61c5f53c3fbcb94afe7c548ad31591 (patch) | |
tree | b6f7d88797610980dcf504be8f98328f817269f7 /Makefile | |
parent | 94cf74b8ae28075496a67c1a83df630bc6cabc7c (diff) | |
download | haskell-61fae1d3fb61c5f53c3fbcb94afe7c548ad31591.tar.gz |
[project @ 2001-12-06 10:45:42 by simonpj]
--------------------------
Fix the instance-decl wart
--------------------------
This commit implements the (proposed) H98 rule for
resolving the class-method name in an instance decl.
module M( C( op1, op2 ) ) where
-- NB: op3 not exported
class C a where
op1, op2, op3 :: a -> a
module N where
import qualified M as P( C )
import qualified M as Q hiding( op2 )
instance P.C Int where
op1 x = x
-- op2, op3 both illegal here
The point is that
a) only methods that can be named are legal
in the instance decl
(so op2, op3 are not legal)
b) but it doesn't matter *how* they can be named
(in this case Q.op1 is in scope, though
the class is called P.C)
The AvailEnv carries the information about what's in scope,
so we now have to carry it around in the monad, so that
instance decl bindings can see it. Quite simple really.
Same deal for export lists. E.g.
module N( P.C( op1 ) ) where
import qualified M as P( C )
import qualified M as Q hiding( op2 )
Actually this is what GHC has always implemented!
Diffstat (limited to 'Makefile')
0 files changed, 0 insertions, 0 deletions