Folks,

Iavor has made two excellent points, upon which I have been
ruminating (and consulting).  Consider

        module Foo( M.Ix( index ) ) where
          import qualified Ix as M( Ix )
          import qualified Ix as T( index )

          instance M.Ix MyType where
            index a = ...

          index v = ... -- A local declaration

Notice that:
  * The Ix class is in scope as "M.Ix", but
    its index method is in scope ias "T.index".  

  * Nevertheless, it's 100% clear what we mean in the
        instance declaration

  *  It's also 100% clear what we mean in the export list
        M.Ix( index )
     (The report is currently silent about whether this is legal.)

  * These two situations are very similar, and should be 
        resolved in the same way

   * I think we all agree that it woudl be illegal to mention
        the 'range' method of the Ix class, either in the
        instance cecl, or in theexport list.
        Why?  Because 'range' is not imported.


I therefore want to propose:

1.  "subordinate" names in export lists are always unqualified
Thus, we can have M.Ix( index ), but not M.Ix( T.index ).

2.  A subordinate name in an export list is legal if the entity (class
operation or data constructor) is in scope in the module, regardless
of whether it is in scope under a qualified or unqualified name.  
(In the example, T.index.)

3.  The exact same rule is used to determine whether the class method
name on the LHS of an instance-decl binding is legal.


This time I have implemented the rule first, and it seems fine.

These are basically clarifications.   Objections?  Comments?
I'd like to find a better wording for (2) above.

Simon

_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to