{-# 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
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 (Show, Typeable, Data, Generic)
data DPat = DLitPa Lit
| DVarPa Name
| DConPa Name [DPat]
| DTildePa DPat
| DBangPa DPat
| DSigPa DPat DType
| DWildPa
deriving (Show, Typeable, Data, Generic)
data DType = DForallT [DTyVarBndr] DCxt DType
| DAppT DType DType
| DSigT DType DKind
| DVarT Name
| DConT Name
| DArrowT
| DLitT TyLit
| DWildCardT
deriving (Show, Typeable, Data, Generic)
type DKind = DType
type DCxt = [DPred]
data DPred = DForallPr [DTyVarBndr] DCxt DPred
| DAppPr DPred DType
| DSigPr DPred DKind
| DVarPr Name
| DConPr Name
| DWildCardPr
deriving (Show, Typeable, Data, Generic)
data DTyVarBndr = DPlainTV Name
| DKindedTV Name DKind
deriving (Show, Typeable, Data, Generic)
data DMatch = DMatch DPat DExp
deriving (Show, Typeable, Data, Generic)
data DClause = DClause [DPat] DExp
deriving (Show, Typeable, Data, Generic)
data DLetDec = DFunD Name [DClause]
| DValD DPat DExp
| DSigD Name DType
| DInfixD Fixity Name
| DPragmaD DPragma
deriving (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) DCxt DType [DDec]
| DForeignD DForeign
| DOpenTypeFamilyD DTypeFamilyHead
| DClosedTypeFamilyD DTypeFamilyHead [DTySynEqn]
| DDataFamilyD Name [DTyVarBndr] (Maybe DKind)
| DDataInstD NewOrData DCxt Name [DType] (Maybe DKind) [DCon] [DDerivClause]
| DTySynInstD Name DTySynEqn
| DRoleAnnotD Name [Role]
| DStandaloneDerivD (Maybe DDerivStrategy) DCxt DType
| DDefaultSigD Name DType
| DPatSynD Name PatSynArgs DPatSynDir DPat
| DPatSynSigD Name DPatSynType
deriving (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 (Show, Typeable, Data, Generic)
type DPatSynType = DType
#if __GLASGOW_HASKELL__ < 801
data PatSynArgs
= PrefixPatSyn [Name]
| InfixPatSyn Name Name
| RecordPatSyn [Name]
deriving (Show, Typeable, Data, Generic)
#endif
data DTypeFamilyHead = DTypeFamilyHead Name [DTyVarBndr] DFamilyResultSig
(Maybe InjectivityAnn)
deriving (Show, Typeable, Data, Generic)
data DFamilyResultSig = DNoSig
| DKindSig DKind
| DTyVarSig DTyVarBndr
deriving (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 (Show, Typeable, Data, Generic)
data DConFields = DNormalC DDeclaredInfix [DBangType]
| DRecC [DVarBangType]
deriving (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 (Show, Typeable, Data, Generic)
data DPragma = DInlineP Name Inline RuleMatch Phases
| DSpecialiseP Name DType (Maybe Inline) Phases
| DSpecialiseInstP DType
| DRuleP String [DRuleBndr] DExp DExp Phases
| DAnnP AnnTarget DExp
| DLineP Int String
| DCompleteP [Name] (Maybe Name)
deriving (Show, Typeable, Data, Generic)
data DRuleBndr = DRuleVar Name
| DTypedRuleVar Name DType
deriving (Show, Typeable, Data, Generic)
data DTySynEqn = DTySynEqn [DType] DType
deriving (Show, Typeable, Data, Generic)
#if __GLASGOW_HASKELL__ < 707
data Role = NominalR | RepresentationalR | PhantomR | InferR
deriving (Show, Typeable, Data, Generic)
data AnnTarget = ModuleAnnotation
| TypeAnnotation Name
| ValueAnnotation Name
deriving (Show, Typeable, Data, Generic)
#endif
data DInfo = DTyConI DDec (Maybe [DInstanceDec])
| DVarI Name DType (Maybe Name)
| DTyVarI Name DKind
| DPrimTyConI Name Int Bool
| DPatSynI Name DPatSynType
deriving (Show, Typeable, Data, Generic)
type DInstanceDec = DDec
data DDerivClause = DDerivClause (Maybe DDerivStrategy) DCxt
deriving (Show, Typeable, Data, Generic)
data DDerivStrategy = DStockStrategy
| DAnyclassStrategy
| DNewtypeStrategy
| DViaStrategy DType
deriving (Show, Typeable, Data, Generic)