Hi Dimitry,

I think I have figured out what is going on :)

The deriving clause is expanded in place to give an instance. This
instance refers to things in terms of Data.Ix directly, with a fully
qualified module name. Unfortunately import Ix does not make Data.Ix
available as a fully qualified name. I think the solution would be to
do:

module Ix(module Data.Ix) where

import Data.Ix

That may work, but I'm not 100% sure.

I guess the real solution would be on seeing deriving Ix to add import
Data.Ix as Yhc.Internal.Data.Ix at the top of the module, then refer
to Yhc.Internal.Data.Ix everywhere in the instance. That is too hard
to implement in Yhc as it stands, sadly - the renaming stage is black
voodoo magic. Both me and Tom have tried to tweak it, and we both
failed miserably.

As it happens, GHC has a similar issue with this - you can't do
deriving Data without import Data.Generics.

Thanks

Neil

On 1/12/07, Dimitry Golubovsky <[EMAIL PROTECTED]> wrote:
Hi,

I am not sure if this is a known problem, but here's an example

There is a module which imports Ix (from haskell98) and has some
datatype deriving (Ix)

This module does not compile with the following message:

=================
Compiling Geometry         (
../../../home/dima/ext/workdirs/Fudgets/hsrc/utils/Geometry.hs )
yhc: -- during when renaming
Error: Identifier Data.Ix._tupleRange used at 7:35-7:36 is not defined.
Error: Identifier Data.Ix.inRange used at 7:35-7:36 is not defined.
Error: Identifier Data.Ix.range used at 7:35-7:36 is not defined.
Error: Type class Data.Ix.Ix used at 7:35-7:36 is not defined.
Error: Identifier Data.Ix._tupleIndex used at 7:35-7:36 is not defined.
Error: Identifier Data.Ix.index used at 7:35-7:36 is not defined.
=================

line 7 is where deriving (...., Ix ) is located.

If I import Data.Ix instead, everything compiles fine.

The Ix module from haskell98 is:

=================
module Ix ( Ix(range, index, inRange, rangeSize) ) where

import Data.Ix
=================

So, methods of the Ix class are not re-exported.

I am pretty much OK importing Data.Ix (anyway, Fudgets code needs to
be hierarchized, and I did something in this direction in the past),
but this may be a problem in Yhc.

Thanks.

--
Dimitry Golubovsky

Anywhere on the Web
_______________________________________________
Yhc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/yhc

_______________________________________________
Yhc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/yhc

Reply via email to