[Git][ghc/ghc][wip/T22717] Make another set of orphan instances into non-orphans

Simon Peyton Jones (@simonpj) gitlab at gitlab.haskell.org
Tue Jan 24 10:29:02 UTC 2023



Simon Peyton Jones pushed to branch wip/T22717 at Glasgow Haskell Compiler / GHC


Commits:
4828f1a6 by Simon Peyton Jones at 2023-01-24T10:29:27+00:00
Make another set of orphan instances into non-orphans

- - - - -


2 changed files:

- compiler/GHC/Parser/PostProcess.hs
- compiler/GHC/Parser/Types.hs


Changes:

=====================================
compiler/GHC/Parser/PostProcess.hs
=====================================
@@ -1817,11 +1817,6 @@ instance DisambECP (HsExpr GhcPs) where
 hsHoleExpr :: EpAnn EpAnnUnboundVar -> HsExpr GhcPs
 hsHoleExpr anns = HsUnboundVar anns (mkRdrUnqual (mkVarOccFS (fsLit "_")))
 
-type instance Anno (GRHS GhcPs (LocatedA (PatBuilder GhcPs))) = SrcAnn NoEpAnns
-type instance Anno [LocatedA (Match GhcPs (LocatedA (PatBuilder GhcPs)))] = SrcSpanAnnL
-type instance Anno (Match GhcPs (LocatedA (PatBuilder GhcPs))) = SrcSpanAnnA
-type instance Anno (StmtLR GhcPs GhcPs (LocatedA (PatBuilder GhcPs))) = SrcSpanAnnA
-
 instance DisambECP (PatBuilder GhcPs) where
   type Body (PatBuilder GhcPs) = PatBuilder
   ecpFromCmd' (L l c)    = addFatalError $ mkPlainErrorMsgEnvelope (locA l) $ PsErrArrowCmdInPat c


=====================================
compiler/GHC/Parser/Types.hs
=====================================
@@ -61,6 +61,12 @@ data PatBuilder p
   | PatBuilderVar (LocatedN RdrName)
   | PatBuilderOverLit (HsOverLit GhcPs)
 
+-- These instances are here so that they are not orphans
+type instance Anno (GRHS GhcPs (LocatedA (PatBuilder GhcPs)))             = SrcAnn NoEpAnns
+type instance Anno [LocatedA (Match GhcPs (LocatedA (PatBuilder GhcPs)))] = SrcSpanAnnL
+type instance Anno (Match GhcPs (LocatedA (PatBuilder GhcPs)))            = SrcSpanAnnA
+type instance Anno (StmtLR GhcPs GhcPs (LocatedA (PatBuilder GhcPs)))     = SrcSpanAnnA
+
 instance Outputable (PatBuilder GhcPs) where
   ppr (PatBuilderPat p) = ppr p
   ppr (PatBuilderPar _ (L _ p) _) = parens (ppr p)



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4828f1a6c9c0390808941fd418bc187423360719

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4828f1a6c9c0390808941fd418bc187423360719
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/20230124/0ed136c2/attachment-0001.html>


More information about the ghc-commits mailing list