{-# LANGUAGE CPP, DeriveDataTypeable, DeriveGeneric #-}
module Language.Haskell.TH.Desugar.AST where
import Data.Data hiding (Fixity)
import GHC.Generics hiding (Fixity)
import Language.Haskell.TH
import Language.Haskell.TH.Desugar.Util (ForallVisFlag)
data DExp = DVarE Name
| DConE Name
| DLitE Lit
| DAppE DExp DExp
| DAppTypeE DExp DType
| DLamE [Name] DExp
| DCaseE DExp [DMatch]
| DLetE [DLetDec] DExp
| DSigE DExp DType
| DStaticE DExp
deriving (Eq, Show, Typeable, Data, Generic)
data DPat = DLitP Lit
| DVarP Name
| DConP Name [DPat]
| DTildeP DPat
| DBangP DPat
| DSigP DPat DType
| DWildP
deriving (Eq, Show, Typeable, Data, Generic)
data DType = DForallT ForallVisFlag [DTyVarBndr] DType
| DConstrainedT DCxt DType
| DAppT DType DType
| DAppKindT DType DKind
| DSigT DType DKind
| DVarT Name
| DConT Name
| DArrowT
| DLitT TyLit
| DWildCardT
deriving (Eq, Show, Typeable, Data, Generic)
type DKind = DType
type DPred = DType
type DCxt = [DPred]
data DTyVarBndr = DPlainTV Name
| DKindedTV Name DKind
deriving (Eq, Show, Typeable, Data, Generic)
data DMatch = DMatch DPat DExp
deriving (Eq, Show, Typeable, Data, Generic)
data DClause = DClause [DPat] DExp
deriving (Eq, Show, Typeable, Data, Generic)
data DLetDec = DFunD Name [DClause]
| DValD DPat DExp
| DSigD Name DType
| DInfixD Fixity Name
| DPragmaD DPragma
deriving (Eq, Show, Typeable, Data, Generic)
data NewOrData = Newtype
| Data
deriving (Eq, Show, Typeable, Data, Generic)
data DDec = DLetDec DLetDec
| DDataD NewOrData DCxt Name [DTyVarBndr] (Maybe DKind) [DCon] [DDerivClause]
| DTySynD Name [DTyVarBndr] DType
| DClassD DCxt Name [DTyVarBndr] [FunDep] [DDec]
| DInstanceD (Maybe Overlap) (Maybe [DTyVarBndr]) DCxt DType [DDec]
| DForeignD DForeign
| DOpenTypeFamilyD DTypeFamilyHead
| DClosedTypeFamilyD DTypeFamilyHead [DTySynEqn]
| DDataFamilyD Name [DTyVarBndr] (Maybe DKind)
| DDataInstD NewOrData DCxt (Maybe [DTyVarBndr]) DType (Maybe DKind)
[DCon] [DDerivClause]
| DTySynInstD DTySynEqn
| DRoleAnnotD Name [Role]
| DStandaloneDerivD (Maybe DDerivStrategy) (Maybe [DTyVarBndr]) DCxt DType
| DDefaultSigD Name DType
| DPatSynD Name PatSynArgs DPatSynDir DPat
| DPatSynSigD Name DPatSynType
| DKiSigD Name DKind
deriving (Eq, Show, Typeable, Data, Generic)
#if __GLASGOW_HASKELL__ < 711
data Overlap = Overlappable | Overlapping | Overlaps | Incoherent
deriving (Eq, Ord, Show, Typeable, Data, Generic)
#endif
data DPatSynDir = DUnidir
| DImplBidir
| DExplBidir [DClause]
deriving (Eq, Show, Typeable, Data, Generic)
type DPatSynType = DType
#if __GLASGOW_HASKELL__ < 801
data PatSynArgs
= PrefixPatSyn [Name]
| InfixPatSyn Name Name
| RecordPatSyn [Name]
deriving (Eq, Show, Typeable, Data, Generic)
#endif
data DTypeFamilyHead = DTypeFamilyHead Name [DTyVarBndr] DFamilyResultSig
(Maybe InjectivityAnn)
deriving (Eq, Show, Typeable, Data, Generic)
data DFamilyResultSig = DNoSig
| DKindSig DKind
| DTyVarSig DTyVarBndr
deriving (Eq, Show, Typeable, Data, Generic)
#if __GLASGOW_HASKELL__ <= 710
data InjectivityAnn = InjectivityAnn Name [Name]
deriving (Eq, Ord, Show, Typeable, Data, Generic)
#endif
data DCon = DCon [DTyVarBndr] DCxt Name DConFields
DType
deriving (Eq, Show, Typeable, Data, Generic)
data DConFields = DNormalC DDeclaredInfix [DBangType]
| DRecC [DVarBangType]
deriving (Eq, Show, Typeable, Data, Generic)
type DDeclaredInfix = Bool
type DBangType = (Bang, DType)
type DVarBangType = (Name, Bang, DType)
#if __GLASGOW_HASKELL__ <= 710
data SourceUnpackedness = NoSourceUnpackedness
| SourceNoUnpack
| SourceUnpack
deriving (Eq, Ord, Show, Typeable, Data, Generic)
data SourceStrictness = NoSourceStrictness
| SourceLazy
| SourceStrict
deriving (Eq, Ord, Show, Typeable, Data, Generic)
data Bang = Bang SourceUnpackedness SourceStrictness
deriving (Eq, Ord, Show, Typeable, Data, Generic)
#endif
data DForeign = DImportF Callconv Safety String Name DType
| DExportF Callconv String Name DType
deriving (Eq, Show, Typeable, Data, Generic)
data DPragma = DInlineP Name Inline RuleMatch Phases
| DSpecialiseP Name DType (Maybe Inline) Phases
| DSpecialiseInstP DType
| DRuleP String (Maybe [DTyVarBndr]) [DRuleBndr] DExp DExp Phases
| DAnnP AnnTarget DExp
| DLineP Int String
| DCompleteP [Name] (Maybe Name)
deriving (Eq, Show, Typeable, Data, Generic)
data DRuleBndr = DRuleVar Name
| DTypedRuleVar Name DType
deriving (Eq, Show, Typeable, Data, Generic)
data DTySynEqn = DTySynEqn (Maybe [DTyVarBndr]) DType DType
deriving (Eq, Show, Typeable, Data, Generic)
data DInfo = DTyConI DDec (Maybe [DInstanceDec])
| DVarI Name DType (Maybe Name)
| DTyVarI Name DKind
| DPrimTyConI Name Int Bool
| DPatSynI Name DPatSynType
deriving (Eq, Show, Typeable, Data, Generic)
type DInstanceDec = DDec
data DDerivClause = DDerivClause (Maybe DDerivStrategy) DCxt
deriving (Eq, Show, Typeable, Data, Generic)
data DDerivStrategy = DStockStrategy
| DAnyclassStrategy
| DNewtypeStrategy
| DViaStrategy DType
deriving (Eq, Show, Typeable, Data, Generic)