diff options
Diffstat (limited to 'libraries/template-haskell/Language/Haskell/TH/Syntax.hs')
-rw-r--r-- | libraries/template-haskell/Language/Haskell/TH/Syntax.hs | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs index 227d24290c..60fb9d37ca 100644 --- a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs +++ b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs @@ -3,7 +3,7 @@ RankNTypes, RoleAnnotations, ScopedTypeVariables, MagicHash, KindSignatures, PolyKinds, TypeApplications, DataKinds, GADTs, UnboxedTuples, UnboxedSums, TypeInType, - Trustworthy #-} + Trustworthy, DeriveFunctor #-} {-# OPTIONS_GHC -fno-warn-inline-rule-shadowing #-} @@ -2065,19 +2065,19 @@ data Range = FromR Exp | FromThenR Exp Exp data Dec = FunD Name [Clause] -- ^ @{ f p1 p2 = b where decs }@ | ValD Pat Body [Dec] -- ^ @{ p = b where decs }@ - | DataD Cxt Name [TyVarBndr] + | DataD Cxt Name [TyVarBndr ()] (Maybe Kind) -- Kind signature (allowed only for GADTs) [Con] [DerivClause] -- ^ @{ data Cxt x => T x = A x | B (T x) -- deriving (Z,W) -- deriving stock Eq }@ - | NewtypeD Cxt Name [TyVarBndr] + | NewtypeD Cxt Name [TyVarBndr ()] (Maybe Kind) -- Kind signature Con [DerivClause] -- ^ @{ newtype Cxt x => T x = A (B x) -- deriving (Z,W Q) -- deriving stock Eq }@ - | TySynD Name [TyVarBndr] Type -- ^ @{ type T x = (x,x) }@ - | ClassD Cxt Name [TyVarBndr] + | TySynD Name [TyVarBndr ()] Type -- ^ @{ type T x = (x,x) }@ + | ClassD Cxt Name [TyVarBndr ()] [FunDep] [Dec] -- ^ @{ class Eq a => Ord a where ds }@ | InstanceD (Maybe Overlap) Cxt Type [Dec] -- ^ @{ instance {\-\# OVERLAPS \#-\} @@ -2093,18 +2093,18 @@ data Dec | PragmaD Pragma -- ^ @{ {\-\# INLINE [1] foo \#-\} }@ -- | data families (may also appear in [Dec] of 'ClassD' and 'InstanceD') - | DataFamilyD Name [TyVarBndr] + | DataFamilyD Name [TyVarBndr ()] (Maybe Kind) -- ^ @{ data family T a b c :: * }@ - | DataInstD Cxt (Maybe [TyVarBndr]) Type + | DataInstD Cxt (Maybe [TyVarBndr ()]) Type (Maybe Kind) -- Kind signature [Con] [DerivClause] -- ^ @{ data instance Cxt x => T [x] -- = A x | B (T x) -- deriving (Z,W) -- deriving stock Eq }@ - | NewtypeInstD Cxt (Maybe [TyVarBndr]) Type -- Quantified type vars + | NewtypeInstD Cxt (Maybe [TyVarBndr ()]) Type -- Quantified type vars (Maybe Kind) -- Kind signature Con [DerivClause] -- ^ @{ newtype instance Cxt x => T [x] -- = A (B x) @@ -2217,7 +2217,7 @@ type PatSynType = Type -- @TypeFamilyHead@ is defined to be the elements of the declaration -- between @type family@ and @where@. data TypeFamilyHead = - TypeFamilyHead Name [TyVarBndr] FamilyResultSig (Maybe InjectivityAnn) + TypeFamilyHead Name [TyVarBndr ()] FamilyResultSig (Maybe InjectivityAnn) deriving( Show, Eq, Ord, Data, Generic ) -- | One equation of a type family instance or closed type family. The @@ -2237,7 +2237,7 @@ data TypeFamilyHead = -- ('AppT' ('AppKindT' ('ConT' ''Foo) ('VarT' k)) ('VarT' a)) -- ('VarT' a) -- @ -data TySynEqn = TySynEqn (Maybe [TyVarBndr]) Type Type +data TySynEqn = TySynEqn (Maybe [TyVarBndr ()]) Type Type deriving( Show, Eq, Ord, Data, Generic ) data FunDep = FunDep [Name] [Name] @@ -2257,7 +2257,7 @@ data Safety = Unsafe | Safe | Interruptible data Pragma = InlineP Name Inline RuleMatch Phases | SpecialiseP Name Type (Maybe Inline) Phases | SpecialiseInstP Type - | RuleP String (Maybe [TyVarBndr]) [RuleBndr] Exp Exp Phases + | RuleP String (Maybe [TyVarBndr ()]) [RuleBndr] Exp Exp Phases | AnnP AnnTarget Exp | LineP Int String | CompleteP [Name] (Maybe Name) @@ -2346,7 +2346,7 @@ data DecidedStrictness = DecidedLazy data Con = NormalC Name [BangType] -- ^ @C Int a@ | RecC Name [VarBangType] -- ^ @C { v :: Int, w :: a }@ | InfixC BangType Name BangType -- ^ @Int :+ a@ - | ForallC [TyVarBndr] Cxt Con -- ^ @forall a. Eq a => C [a]@ + | ForallC [TyVarBndr Specificity] Cxt Con -- ^ @forall a. Eq a => C [a]@ | GadtC [Name] [BangType] Type -- See Note [GADT return type] -- ^ @C :: a -> b -> T b Int@ @@ -2415,8 +2415,8 @@ data PatSynArgs | RecordPatSyn [Name] -- ^ @pattern P { {x,y,z} } = p@ deriving( Show, Eq, Ord, Data, Generic ) -data Type = ForallT [TyVarBndr] Cxt Type -- ^ @forall \<vars\>. \<ctxt\> => \<type\>@ - | ForallVisT [TyVarBndr] Type -- ^ @forall \<vars\> -> \<type\>@ +data Type = ForallT [TyVarBndr Specificity] Cxt Type -- ^ @forall \<vars\>. \<ctxt\> => \<type\>@ + | ForallVisT [TyVarBndr ()] Type -- ^ @forall \<vars\> -> \<type\>@ | AppT Type Type -- ^ @T a b@ | AppKindT Type Kind -- ^ @T \@k t@ | SigT Type Kind -- ^ @t :: k@ @@ -2446,14 +2446,18 @@ data Type = ForallT [TyVarBndr] Cxt Type -- ^ @forall \<vars\>. \<ctxt\> => \<t | ImplicitParamT String Type -- ^ @?x :: t@ deriving( Show, Eq, Ord, Data, Generic ) -data TyVarBndr = PlainTV Name -- ^ @a@ - | KindedTV Name Kind -- ^ @(a :: k)@ +data Specificity = SpecifiedSpec -- ^ @a@ + | InferredSpec -- ^ @{a}@ deriving( Show, Eq, Ord, Data, Generic ) +data TyVarBndr flag = PlainTV Name flag -- ^ @a@ + | KindedTV Name flag Kind -- ^ @(a :: k)@ + deriving( Show, Eq, Ord, Data, Generic, Functor ) + -- | Type family result signature data FamilyResultSig = NoSig -- ^ no signature | KindSig Kind -- ^ @k@ - | TyVarSig TyVarBndr -- ^ @= r, = (r :: k)@ + | TyVarSig (TyVarBndr ()) -- ^ @= r, = (r :: k)@ deriving( Show, Eq, Ord, Data, Generic ) -- | Injectivity annotation |