[nhc-bugs] deriving Ix

Malcolm Wallace Malcolm.Wallace@cs.york.ac.uk
Wed, 26 Sep 2001 11:08:06 +0100


>   import Ix
> 
>   newtype Name = Name Int
> 	       deriving (Eq, Ord, Ix)
> 
>   main = print 42
> 
> gives me
> 
> 	  Error when renaming::
>   Identifier Ix._tupleRange used at 4:33 is not defined.
>   Identifier Ix.inRange used at 4:33 is not defined.
>   Identifier Ix.range used at 4:33 is not defined.
>   Type class Ix.Ix used at 4:33 is not defined.
>   Identifier Ix._tupleIndex used at 4:33 is not defined.
>   Identifier Ix.index used at 4:33 is not defined.
> 
> which IMO contradicts the definition of the Standard Libraries.

Yes, there is a serious bug in the way imported namespaces are handled
in nhc98 at the moment.  (It is only revealed in this release because
we moved the Ix class out of its previous location in the Prelude
and into the Ix library where it should always have been.)

I began to fix this bug some weeks ago, but it necessitates a complete
rewrite of the import mechanism, and is not yet complete.

In the meantime, a workaround is to import and use Ix qualified.
e.g.

    import qualified Ix
  
    newtype Name = Name Int
  	       deriving (Eq, Ord, Ix.Ix)

Regards,
    Malcolm