[Git][ghc/ghc][wip/kirchner/ast] ttg: move TopLevelFlag into Language.Haskell.Syntax.Basic

Fabian Kirchner (@kirchner) gitlab at gitlab.haskell.org
Sun Jun 9 12:40:39 UTC 2024



Fabian Kirchner pushed to branch wip/kirchner/ast at Glasgow Haskell Compiler / GHC


Commits:
458eeb35 by Fabian Kirchner at 2024-06-09T14:39:47+02:00
ttg: move TopLevelFlag into Language.Haskell.Syntax.Basic

Progress towards #21592

- - - - -


3 changed files:

- compiler/GHC/Types/Basic.hs
- compiler/Language/Haskell/Syntax/Basic.hs
- compiler/Language/Haskell/Syntax/Decls.hs


Changes:

=====================================
compiler/GHC/Types/Basic.hs
=====================================
@@ -132,7 +132,7 @@ import GHC.Utils.Binary
 import GHC.Types.SourceText
 import qualified GHC.LanguageExtensions as LangExt
 import {-# SOURCE #-} Language.Haskell.Syntax.Type (PromotionFlag(..), isPromoted)
-import Language.Haskell.Syntax.Basic (Boxity(..), isBoxed, ConTag)
+import Language.Haskell.Syntax.Basic (Boxity(..), isBoxed, ConTag, TopLevelFlag(..), isTopLevel, isNotTopLevel)
 import {-# SOURCE #-} Language.Haskell.Syntax.Expr (HsDoFlavour)
 
 import Control.DeepSeq ( NFData(..) )
@@ -542,19 +542,6 @@ pprRuleName rn = doubleQuotes (ftext rn)
 ************************************************************************
 -}
 
-data TopLevelFlag
-  = TopLevel
-  | NotTopLevel
-  deriving Data
-
-isTopLevel, isNotTopLevel :: TopLevelFlag -> Bool
-
-isNotTopLevel NotTopLevel = True
-isNotTopLevel TopLevel    = False
-
-isTopLevel TopLevel     = True
-isTopLevel NotTopLevel  = False
-
 instance Outputable TopLevelFlag where
   ppr TopLevel    = text "<TopLevel>"
   ppr NotTopLevel = text "<NotTopLevel>"


=====================================
compiler/Language/Haskell/Syntax/Basic.hs
=====================================
@@ -96,3 +96,25 @@ data SrcUnpackedness = SrcUnpack -- ^ {-# UNPACK #-} specified
                      | SrcNoUnpack -- ^ {-# NOUNPACK #-} specified
                      | NoSrcUnpack -- ^ no unpack pragma
      deriving (Eq, Data)
+
+
+{-
+************************************************************************
+*                                                                      *
+Top-level/not-top level flag
+*                                                                      *
+************************************************************************
+-}
+
+data TopLevelFlag
+  = TopLevel
+  | NotTopLevel
+  deriving Data
+
+isTopLevel, isNotTopLevel :: TopLevelFlag -> Bool
+
+isNotTopLevel NotTopLevel = True
+isNotTopLevel TopLevel    = False
+
+isTopLevel TopLevel     = True
+isTopLevel NotTopLevel  = False


=====================================
compiler/Language/Haskell/Syntax/Decls.hs
=====================================
@@ -97,10 +97,10 @@ import {-# SOURCE #-} Language.Haskell.Syntax.Expr
 import Language.Haskell.Syntax.Binds
 import Language.Haskell.Syntax.Extension
 import Language.Haskell.Syntax.Type
-import Language.Haskell.Syntax.Basic (Role)
+import Language.Haskell.Syntax.Basic (Role, TopLevelFlag)
 import Language.Haskell.Syntax.Specificity (Specificity)
 
-import GHC.Types.Basic (TopLevelFlag, OverlapMode, RuleName, Activation
+import GHC.Types.Basic (OverlapMode, RuleName, Activation
                        ,TyConFlavour(..), TypeOrData(..))
 import GHC.Types.ForeignCall (CType, CCallConv, Safety, Header, CLabelString, CCallTarget, CExportSpec)
 import GHC.Types.Fixity (LexicalFixity)



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/458eeb35ba9b92ef2400f2385553912570465e65

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/458eeb35ba9b92ef2400f2385553912570465e65
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/20240609/dfd9d63a/attachment-0001.html>


More information about the ghc-commits mailing list