Haskell 98 Revised
Karl-Filip Faxen
kff@it.kth.se
Wed, 05 Dec 2001 14:13:43 +0100
Hi!
For whatever that is worth, my semantics agrees with Simon's point here,
ie in the example code
module M( C(op1) ) where -- NB: op2 not exported
class C a where
op1 :: a->a
op2 :: a->a
module N where
import M
instance C Int where
op1 = ...
op2 = ... -- Is this ok?
the method binding for op2 is not allowed.
But then there *is* a scope issue with instance declarations. What about
the following example:
module M( C(..) ) where -- NB: both methods exported ...
class C a where
op1 :: a->a
op2 :: a->a
module N where
import M hiding (op2) -- ... but op2 is not imported
instance C Int where
op1 = ...
op2 = ... -- Is this ok?
As far as I've understood, the current revision of the Report states that
a 'hiding' clause affects the qualified names as well as the unqualified
names. Then 'op2' is not visible either qualified or unqualified.
So, should it be legal to make a method declaration for it?
Cheers,
/kff