[Hat] Problems with hat-trans and Edison

Malcolm Wallace hat@haskell.org
Thu, 3 Apr 2003 17:24:55 +0100


Stephen Pitts <smpitts@ou.edu> writes:

> I'm trying to use hat to analyze a program I wrote that uses the Edison 
> libraries, but hat is choking on part of Edison. hat-trans on the 
> attached file seems to work OK, but ghc barfs when compiling the 
> generated output:

> Hat/Sequence.hs:1:
>      Multiple declarations of `Hat.Sequence.sreverse'
>          Hat/Sequence.hs:62
>          Hat/Sequence.hs:283

OK, it looks like hat-trans does not deal with "import X hiding (...)"
quite correctly in this case, where the hidden entity is redefined
as a class method and the original entity was an ordinary variable.

For instance while
    import Prelude hiding (reverse)
is translated here to
    import Hat.Prelude hiding (greverse)
in fact it should become
    import Hat.Prelude hiding (greverse,sreverse)
and likewise for the other names that are reported as errors.

I believe the attached patch for hat-trans will help solve the problem.
After applying it, you just need to rebuild hat-trans and re-install
its executable:

    make hat-trans && \
    cp lib/`script/harch`/hat-trans /usr/local/lib/hat/`script/harch`/

Regards,
    Malcolm


Index: src/hattrans/TraceTrans.hs
===================================================================
RCS file: /home/cvs/root/hat/src/hattrans/TraceTrans.hs,v
retrieving revision 1.58
diff -u -r1.58 TraceTrans.hs
--- src/hattrans/TraceTrans.hs	2 Apr 2003 16:21:52 -0000	1.58
+++ src/hattrans/TraceTrans.hs	3 Apr 2003 16:19:06 -0000
@@ -203,7 +203,7 @@
   : case arity id of
       Just a | a > 0 -> [EntityVar pos (nameTraceInfoGlobalVar id)
                         ,EntityVar pos (nameWorker id)]
-      _              -> []
+      _              -> [EntityVar pos (nameShare id)]
 tEntity traced (EntityConClsAll pos id) =
   case tyClsInfo id of
     Ty cons labels -> (EntityConClsSome pos (nameTransTyConCls id)