On Wed, May 16, 2012 at 05:41:33PM +0100, "Philip K. F. Hölzenspies" wrote:
> 
> I'm trying to refactor the types in GHC (working on HEAD). First of all, I 
> want to parameterise HsExpr et al to be parametric in the type representation 
> (to remove the PostTcType type, which can not be instantiated before the type 
> checker).

For what it's worth, I recently looked at doing this, but all the
options seemed to end up very ugly.

The most promising approach was using something like this:

    data None = None

    type family PostTc i t :: *
    type instance PostTc RdrName a = None
    type instance PostTc Name    a = None
    type instance PostTc Id      a = a

    ---

    data ForeignDecl name =
        ...
        | ForeignExport (Located name)
                        (LHsType name)
                        (PostTc name Coercion)

but then you get GHC needing a "Data (PostTc id Coercion)" instance all
over the place, which would result in a lot of noise.

This could potentially be fixed by using DataKinds to close the set of
types that PostTc can return, but that isn't currently possible (see
    http://hackage.haskell.org/trac/ghc/ticket/6074#comment:5
), and even if it was, it would be a few years before we could use it in
GHC.

> The build system resolves the directories in the GHC source tree, so I'm 
> compensating for this by seeing which files I can find. To this end, I first 
> build a name table by seeing what files I can find in the source tree:

I'm a little confused. Why aren't you just setting importPaths (like the
ghc -ifoo flag does)?

> The FIXME poses the problem. If I add the target, GHC panics when it comes to 
> FastString.lhs, saying that "Data.Data" is a package module.

I didn't follow exactly what you're doing, but if ghci does it then it
can often be useful to look at how.


Thanks
Ian


_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to