[GHC] #11019: ApiAnnotations: Make all RdrName occurences Located
GHC
ghc-devs at haskell.org
Fri Nov 20 06:21:18 UTC 2015
#11019: ApiAnnotations: Make all RdrName occurences Located
-------------------------------------+-------------------------------------
Reporter: alanz | Owner: alanz
Type: bug | Status: new
Priority: normal | Milestone: 8.0.1
Component: Compiler | Version: 7.10.2
Resolution: | Keywords:
| ApiAnnotations
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by alanz):
Example code from HaRe to enable changing a name
{{{#!hs
nameSybTransform :: (Monad m,SYB.Typeable t)
=> (GHC.Located GHC.RdrName -> m (GHC.Located GHC.RdrName))
-> t -> m t
nameSybTransform changer = q
where
q = SYB.mkM worker
`SYB.extM` workerBind
`SYB.extM` workerExpr
`SYB.extM` workerLIE
`SYB.extM` workerHsTyVarBndr
`SYB.extM` workerLHsType
worker (pnt :: (GHC.Located GHC.RdrName))
= changer pnt
workerBind (GHC.L l (GHC.VarPat name))
= do
(GHC.L _ n) <- changer (GHC.L l name)
return (GHC.L l (GHC.VarPat n))
workerBind x = return x
workerExpr ((GHC.L l (GHC.HsVar name)))
= do
(GHC.L _ n) <- changer (GHC.L l name)
return (GHC.L l (GHC.HsVar n))
workerExpr x = return x
workerLIE ((GHC.L l (GHC.IEVar (GHC.L ln name))) :: (GHC.LIE
GHC.RdrName))
= do
(GHC.L _ n) <- changer (GHC.L ln name)
return (GHC.L l (GHC.IEVar (GHC.L ln n)))
workerLIE x = return x
workerHsTyVarBndr (GHC.L l (GHC.UserTyVar name))
= do
(GHC.L _ n) <- changer (GHC.L l name)
return (GHC.L l (GHC.UserTyVar n))
workerHsTyVarBndr x = return x
workerLHsType (GHC.L l (GHC.HsTyVar name))
= do
(GHC.L _ n) <- changer (GHC.L l name)
return (GHC.L l (GHC.HsTyVar n))
workerLHsType x = return x
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11019#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list