[Git][ghc/ghc][wip/az/epa-getloca-as-gethasloc] EPA make getLocA a synonym for getHasLoc

Alan Zimmerman (@alanz) gitlab at gitlab.haskell.org
Tue Aug 1 21:54:32 UTC 2023



Alan Zimmerman pushed to branch wip/az/epa-getloca-as-gethasloc at Glasgow Haskell Compiler / GHC


Commits:
871ab315 by Alan Zimmerman at 2023-08-01T22:54:20+01:00
EPA make getLocA a synonym for getHasLoc

This is basically a no-op change, but allows us to make future changes
that can rely on the HasLoc instances

- - - - -


1 changed file:

- compiler/GHC/Parser/Annotation.hs


Changes:

=====================================
compiler/GHC/Parser/Annotation.hs
=====================================
@@ -922,8 +922,8 @@ class HasLoc a where
   -- ^ conveniently calculate locations for things without locations attached
   getHasLoc :: a -> SrcSpan
 
-instance HasLoc (Located a) where
-  getHasLoc (L l _) = l
+instance HasLoc (GenLocated (SrcSpanAnn' a) e) where
+  getHasLoc (L (SrcSpanAnn _ l) _) = l
 
 instance HasLoc (LocatedAn t a) where
   getHasLoc (L la _) = locA la
@@ -964,7 +964,7 @@ getLocAnn (L l _) = SrcSpanAnn EpAnnNotUsed l
 
 
 getLocA :: GenLocated (SrcSpanAnn' a) e -> SrcSpan
-getLocA (L (SrcSpanAnn _ l) _) = l
+getLocA = getHasLoc
 
 noLocA :: a -> LocatedAn an a
 noLocA = L (SrcSpanAnn EpAnnNotUsed noSrcSpan)



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/871ab3154417c04eabdf9d834b8065ef7da1245a

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/871ab3154417c04eabdf9d834b8065ef7da1245a
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230801/c996cad2/attachment-0001.html>


More information about the ghc-commits mailing list