Temporarily overriding Data.Generic

Sorry for those who receive this who have already gotten it from haskell-cafe. --- Hi I'm currently working on "hacking" Data.Generics for my master thesis. I'm basically trying to find out whether it can be made any faster using e.g. rewrite rules. The problem I'm having is that I need an easy way to import my own modified version of Data.Generics (currently located in the same directory as my testing program) without unregistering or hiding syb-0.1.0.0 as base seems to depend on it. I've read the GHC user manual trying to find nice ways to do this using a bunch of different parameters to ghc, but I can't figure it out. Does anyone here know? Any help appreciated, Deniz

On Thu, 2009-02-05 at 00:11 +0100, Deniz Dogan wrote:
I'm currently working on "hacking" Data.Generics for my master thesis. I'm basically trying to find out whether it can be made any faster using e.g. rewrite rules. The problem I'm having is that I need an easy way to import my own modified version of Data.Generics (currently located in the same directory as my testing program) without unregistering or hiding syb-0.1.0.0 as base seems to depend on it.
This should just work. If ./Data/Generics.hs exists in / relative to the current directory then by default that overrides the module of the same name from the syb package. There's clearly some specific problem you're hitting, can you tell us more about it? When you say "currently located in the same directory as my testing program" do you mean you've got Generics.hs in the same dir as your Test.hs module or do you mean you've got ./Test.hs and ./Data/Generics.hs, ie in a subdirectory? The problems you're likely to run into will be with other code that already uses the syb:Data.Generics module as the types are necessarily not substitutable for each other.
I've read the GHC user manual trying to find nice ways to do this using a bunch of different parameters to ghc, but I can't figure it out. Does anyone here know?
The command line options for controlling the module search path are basically the -package flags and the -i flag. The default if you don't say anything is -i. meaning look first in the current directory. Duncan

Hi Duncan
2009/2/5 Duncan Coutts
On Thu, 2009-02-05 at 00:11 +0100, Deniz Dogan wrote:
I'm currently working on "hacking" Data.Generics for my master thesis. I'm basically trying to find out whether it can be made any faster using e.g. rewrite rules. The problem I'm having is that I need an easy way to import my own modified version of Data.Generics (currently located in the same directory as my testing program) without unregistering or hiding syb-0.1.0.0 as base seems to depend on it.
This should just work. If ./Data/Generics.hs exists in / relative to the current directory then by default that overrides the module of the same name from the syb package. There's clearly some specific problem you're hitting, can you tell us more about it?
You're right of course, it does work. I must have been so convinced it wouldn't work that I completely disregarded that GHC even told me it compiled Data.Generics and all of the other modules. That was silly! Thanks!

Hi Deniz,
On Thu, Feb 5, 2009 at 00:11, Deniz Dogan
Sorry for those who receive this who have already gotten it from haskell-cafe.
---
Hi
I'm currently working on "hacking" Data.Generics for my master thesis. I'm basically trying to find out whether it can be made any faster using e.g. rewrite rules.
Great! Please let us know of the results when you have them :-)
The problem I'm having is that I need an easy way to import my own modified version of Data.Generics (currently located in the same directory as my testing program) without unregistering or hiding syb-0.1.0.0 as base seems to depend on it.
I've read the GHC user manual trying to find nice ways to do this using a bunch of different parameters to ghc, but I can't figure it out. Does anyone here know?
I've had my own problems while developing a successor version of the syb package. For starters, cabal fails to install the package:
cabal install Resolving dependencies... cabal: dependencies conflict: base-3.0.3.0 requires syb ==0.1.0.0 however syb-0.1.0.0 was excluded because syb-0.2.0.0 was selected instead syb-0.1.0.0 was excluded because of the top level dependency syb ==0.2.0.0
Note that this package explicitly requires base >= 4.0. Anyway, runghc Setup.hs install does it, though. However, after having it installed I can't use it, getting this when any module imports Data.Generics: Bad interface file: C:\Program Files (x86)\Haskell\syb-0.2.0.0\ghc-6.10.1\Data\Generics.hi Something is amiss; requested module syb:Data.Generics differs from name found in the interface file syb-0.2.0.0:Data.Generics Failed, modules loaded: none. I talked about this on IRC before and remember this might have had something to do with syb having been unversioned in the release of GHC 6.10.1. But I hope someone can clarify this better... Cheers, Pedro
Any help appreciated, Deniz _______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
participants (3)
-
Deniz Dogan
-
Duncan Coutts
-
José Pedro Magalhães