Yes, in principle Core certainly allows shadowing. It's very hard to guaranteed 
that it's avoided, unless you do a sweep that does nothing but eliminate it.  
That said, the Simplifier does remove as much shadowing as it can, as it goes.

I've no objection to allowing shadowing in External Core.

Simon

| -----Original Message-----
| From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
| Behalf Of Tim Chevalier
| Sent: 09 April 2008 00:44
| To: [email protected]
| Subject: Name shadowing in types in Core
|
| Hi all,
|
| When compiling the Data.Generics.Basics library module to External
| Core, the resulting .hcr file includes the following data declaration:
|
| %data base:DataziGenericsziBasics.ZCTData a =
|   {base:DataziGenericsziBasics.ZCDData (^base:DataziTypeable.ZCTTypeable
|                                          a)
|                                         (%forall (c::(*->*)) .
| (%forall a b . base:DataziGenericsziBasics.ZCTData
|
| a
|
| ->
|
|        c (a -> b) ->
|
|        a -> c b)
|                                                                ->
|
| (%forall g . g -> c g) -> a -> c a)
| [remainder of type snipped to prevent brain damage]
| }
|
| The point to notice is that the outer declaration of the tyvar "a" (as
| an argument to ZCTData) is shadowed by the inner forall binding of a.
|
| The External Core document says External Core doesn't allow name
| shadowing in either terms or types. So I thought about modifying the
| External Core printer within GHC to uniquely rename types, but that
| would be tedious; instead, I'm inclined to just change the
| documentation to say that name shadowing is allowed in types but not
| in terms. Before I do that, though, I thought I would ask: Is type
| variable name shadowing supposed to be allowed in internal Core? Or
| does this reflect a bug in GHC?
|
| Cheers,
| Tim
|
| --
| Tim Chevalier * http://cs.pdx.edu/~tjc * Often in error, never in doubt
| "and there's too much darkness in an endless night to be afraid of the
| way we feel" -- Bob Franke
|
| _______________________________________________
| Cvs-ghc mailing list
| [email protected]
| http://www.haskell.org/mailman/listinfo/cvs-ghc

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

Reply via email to