[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 22:13:01 UTC 2023



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


Commits:
26004715 by Alan Zimmerman at 2023-08-01T23:12:46+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
=====================================
@@ -925,8 +925,8 @@ class HasLoc a where
 instance HasLoc (Located a) where
   getHasLoc (L l _) = l
 
-instance HasLoc (LocatedAn t a) where
-  getHasLoc (L la _) = locA la
+instance HasLoc (GenLocated (SrcSpanAnn' a) e) where
+  getHasLoc (L (SrcSpanAnn _ l) _) = l
 
 getHasLocList :: HasLoc a => [a] -> SrcSpan
 getHasLocList [] = noSrcSpan
@@ -962,9 +962,8 @@ reAnnL anns cs (L l a) = L (SrcSpanAnn (EpAnn (spanAsAnchor l) anns cs) l) a
 getLocAnn :: Located a  -> SrcSpanAnnA
 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/260047154c6733db87de695f68dc0f4ea6c447d2

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/260047154c6733db87de695f68dc0f4ea6c447d2
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/8a655b32/attachment-0001.html>


More information about the ghc-commits mailing list