From 371c5ecf6898294f4e5bf91784dc794e7e16b7cc Mon Sep 17 00:00:00 2001 From: romes Date: Tue, 14 Jun 2022 00:14:16 +0200 Subject: TTG for HsTyLit Add TTG parameter to `HsTyLit` to move the GHC-specific `SourceText` fields to the extension point and out of the base AST. Progress towards #21592 --- compiler/Language/Haskell/Syntax/Extension.hs | 7 +++++++ compiler/Language/Haskell/Syntax/Type.hs | 15 ++++++--------- 2 files changed, 13 insertions(+), 9 deletions(-) (limited to 'compiler/Language/Haskell/Syntax') diff --git a/compiler/Language/Haskell/Syntax/Extension.hs b/compiler/Language/Haskell/Syntax/Extension.hs index 74cdbb07e0..7bc4685194 100644 --- a/compiler/Language/Haskell/Syntax/Extension.hs +++ b/compiler/Language/Haskell/Syntax/Extension.hs @@ -661,6 +661,13 @@ type family XTyLit x type family XWildCardTy x type family XXType x +-- --------------------------------------------------------------------- +-- HsTyLit type families +type family XNumTy x +type family XStrTy x +type family XCharTy x +type family XXTyLit x + -- --------------------------------------------------------------------- -- HsForAllTelescope type families type family XHsForAllVis x diff --git a/compiler/Language/Haskell/Syntax/Type.hs b/compiler/Language/Haskell/Syntax/Type.hs index 9bd8aa90e2..8d3ed8b4dc 100644 --- a/compiler/Language/Haskell/Syntax/Type.hs +++ b/compiler/Language/Haskell/Syntax/Type.hs @@ -63,7 +63,6 @@ import {-# SOURCE #-} Language.Haskell.Syntax.Expr ( HsUntypedSplice ) import Language.Haskell.Syntax.Extension import Language.Haskell.Syntax.Basic -import GHC.Types.SourceText import GHC.Types.Name.Reader ( RdrName ) import GHC.Core.DataCon( HsSrcBang(..), HsImplBang(..), SrcStrictness(..), SrcUnpackedness(..) ) @@ -885,7 +884,7 @@ data HsType pass -- For details on above see Note [exact print annotations] in GHC.Parser.Annotation - | HsTyLit (XTyLit pass) HsTyLit -- A promoted numeric literal. + | HsTyLit (XTyLit pass) (HsTyLit pass) -- A promoted numeric literal. -- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : None -- For details on above see Note [exact print annotations] in GHC.Parser.Annotation @@ -909,14 +908,12 @@ data HsType pass type HsCoreTy = Type --- Note [Literal source text] in GHC.Types.Basic for SourceText fields in --- the following -- | Haskell Type Literal -data HsTyLit - = HsNumTy SourceText Integer - | HsStrTy SourceText FastString - | HsCharTy SourceText Char - deriving Data +data HsTyLit pass + = HsNumTy (XNumTy pass) Integer + | HsStrTy (XStrTy pass) FastString + | HsCharTy (XCharTy pass) Char + | XTyLit !(XXTyLit pass) -- | Denotes the type of arrows in the surface language data HsArrow pass -- cgit v1.2.1