module Language.Haskell.Exts.Syntax (
Module(..), ExportSpec(..),
ImportDecl(..), ImportSpec(..), Assoc(..),
Decl(..), Binds(..), IPBind(..),
ClassDecl(..), InstDecl(..),
GadtDecl(..), ConDecl(..), QualConDecl(..), BangType(..),
Match(..), Rhs(..), GuardedRhs(..), DataOrNew(..),
Context, FunDep(..), Asst(..),
Type(..), Boxed(..), Kind(..), TyVarBind(..),
Exp(..), Stmt(..), FieldUpdate(..),
Alt(..), GuardedAlts(..), GuardedAlt(..),
Pat(..), PatField(..),
Literal(..),
ModuleName(..), QName(..), Name(..), QOp(..), Op(..),
SpecialCon(..), CName(..), IPName(..),
Bracket(..), Splice(..),
RPat(..), RPatOp(..),
XAttr(..), XName(..), PXAttr(..),
Safety(..), CallConv(..),
OptionPragma(..), Tool(..), WarningText(..),
Rule(..), RuleVar(..), Activation(..),
prelude_mod, main_mod,
main_name,
unit_con_name, tuple_con_name, list_cons_name,
unit_con, tuple_con,
as_name, qualified_name, hiding_name, minus_name, pling_name, dot_name, star_name,
export_name, safe_name, unsafe_name, threadsafe_name, stdcall_name, ccall_name,
unit_tycon_name, fun_tycon_name, list_tycon_name, tuple_tycon_name,
unit_tycon, fun_tycon, list_tycon, tuple_tycon,
SrcLoc(..),
) where
#ifdef __GLASGOW_HASKELL__
import Data.Data
#endif
data SrcLoc = SrcLoc {
srcFilename :: String,
srcLine :: Int,
srcColumn :: Int
}
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Ord,Show,Typeable,Data)
#else
deriving (Eq,Ord,Show)
#endif
newtype ModuleName = ModuleName String
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Ord,Show,Typeable,Data)
#else
deriving (Eq,Ord,Show)
#endif
data SpecialCon
= UnitCon
| ListCon
| FunCon
| TupleCon Int
| Cons
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Ord,Show,Typeable,Data)
#else
deriving (Eq,Ord,Show)
#endif
data QName
= Qual ModuleName Name
| UnQual Name
| Special SpecialCon
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Ord,Show,Typeable,Data)
#else
deriving (Eq,Ord,Show)
#endif
data Name
= Ident String
| Symbol String
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Ord,Show,Typeable,Data)
#else
deriving (Eq,Ord,Show)
#endif
data IPName
= IPDup String
| IPLin String
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Ord,Show,Typeable,Data)
#else
deriving (Eq,Ord,Show)
#endif
data QOp
= QVarOp QName
| QConOp QName
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Ord,Show,Typeable,Data)
#else
deriving (Eq,Ord,Show)
#endif
data Op
= VarOp Name
| ConOp Name
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Ord,Show,Typeable,Data)
#else
deriving (Eq,Ord,Show)
#endif
data CName
= VarName Name
| ConName Name
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Ord,Show,Typeable,Data)
#else
deriving (Eq,Ord,Show)
#endif
data Module = Module SrcLoc ModuleName [OptionPragma] (Maybe WarningText)
(Maybe [ExportSpec]) [ImportDecl] [Decl]
#ifdef __GLASGOW_HASKELL__
deriving (Show,Typeable,Data)
#else
deriving (Show)
#endif
data ExportSpec
= EVar QName
| EAbs QName
| EThingAll QName
| EThingWith QName [CName]
| EModuleContents ModuleName
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Show,Typeable,Data)
#else
deriving (Eq,Show)
#endif
data ImportDecl = ImportDecl
{ importLoc :: SrcLoc
, importModule :: ModuleName
, importQualified :: Bool
, importSrc :: Bool
, importAs :: Maybe ModuleName
, importSpecs :: Maybe (Bool,[ImportSpec])
}
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Show,Typeable,Data)
#else
deriving (Eq,Show)
#endif
data ImportSpec
= IVar Name
| IAbs Name
| IThingAll Name
| IThingWith Name [CName]
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Show,Typeable,Data)
#else
deriving (Eq,Show)
#endif
data Assoc
= AssocNone
| AssocLeft
| AssocRight
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Show,Typeable,Data)
#else
deriving (Eq,Show)
#endif
data Decl
= TypeDecl SrcLoc Name [Name] Type
| DataDecl SrcLoc DataOrNew Context Name [Name] [QualConDecl] [QName]
| GDataDecl SrcLoc DataOrNew Context Name [Name] (Maybe Kind) [GadtDecl] [QName]
| TypeFamDecl SrcLoc Name [Name] (Maybe Kind)
| DataFamDecl SrcLoc Context Name [Name] (Maybe Kind)
| TypeInsDecl SrcLoc Type Type
| DataInsDecl SrcLoc DataOrNew Type [QualConDecl] [QName]
| GDataInsDecl SrcLoc DataOrNew Type (Maybe Kind) [GadtDecl] [QName]
| InfixDecl SrcLoc Assoc Int [Op]
| ClassDecl SrcLoc Context Name [Name] [FunDep] [ClassDecl]
| InstDecl SrcLoc Context QName [Type] [InstDecl]
| DerivDecl SrcLoc Context QName [Type]
| DefaultDecl SrcLoc [Type]
| SpliceDecl SrcLoc Splice
| TypeSig SrcLoc [Name] Type
| FunBind [Match]
| PatBind SrcLoc Pat Rhs Binds
| ForImp SrcLoc CallConv Safety String Name Type
| ForExp SrcLoc CallConv String Name Type
| RulePragmaDecl SrcLoc [Rule]
| DeprPragmaDecl SrcLoc [([Name], String)]
| WarnPragmaDecl SrcLoc [([Name], String)]
| InlineSig SrcLoc Bool Activation QName
| SpecSig SrcLoc QName [Type]
| SpecInlineSig SrcLoc Bool Activation QName [Type]
| InstSig SrcLoc Context QName [Type]
| UnknownDeclPragma SrcLoc String String
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Show,Typeable,Data)
#else
deriving (Eq,Show)
#endif
data DataOrNew = DataType | NewType
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Show,Typeable,Data)
#else
deriving (Eq,Show)
#endif
data Binds
= BDecls [Decl]
| IPBinds [IPBind]
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Show,Typeable,Data)
#else
deriving (Eq,Show)
#endif
data IPBind = IPBind SrcLoc IPName Exp
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Show,Typeable,Data)
#else
deriving (Eq,Show)
#endif
data Match
= Match SrcLoc Name [Pat] Rhs Binds
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Show,Typeable,Data)
#else
deriving (Eq,Show)
#endif
data QualConDecl
= QualConDecl SrcLoc
[TyVarBind] Context
ConDecl
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Show,Typeable,Data)
#else
deriving (Eq,Show)
#endif
data GadtDecl
= GadtDecl SrcLoc Name Type
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Show,Typeable,Data)
#else
deriving (Eq,Show)
#endif
data ConDecl
= ConDecl Name [BangType]
| RecDecl Name [([Name],BangType)]
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Show,Typeable,Data)
#else
deriving (Eq,Show)
#endif
data ClassDecl
= ClsDecl Decl
| ClsDataFam SrcLoc Context Name [Name] (Maybe Kind)
| ClsTyFam SrcLoc Name [Name] (Maybe Kind)
| ClsTyDef SrcLoc Type Type
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Show,Typeable,Data)
#else
deriving (Eq,Show)
#endif
data InstDecl
= InsDecl Decl
| InsType SrcLoc Type Type
| InsData SrcLoc DataOrNew Type [QualConDecl] [QName]
| InsGData SrcLoc DataOrNew Type (Maybe Kind) [GadtDecl]
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Show,Typeable,Data)
#else
deriving (Eq,Show)
#endif
data BangType
= BangedTy Type
| UnBangedTy Type
| UnpackedTy Type
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Show,Typeable,Data)
#else
deriving (Eq,Show)
#endif
data Rhs
= UnGuardedRhs Exp
| GuardedRhss [GuardedRhs]
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Show,Typeable,Data)
#else
deriving (Eq,Show)
#endif
data GuardedRhs
= GuardedRhs SrcLoc [Stmt] Exp
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Show,Typeable,Data)
#else
deriving (Eq,Show)
#endif
data Type
= TyForall
(Maybe [TyVarBind])
Context
Type
| TyFun Type Type
| TyTuple Boxed [Type]
| TyApp Type Type
| TyVar Name
| TyCon QName
| TyPred Asst
| TyInfix Type QName Type
| TyKind Type Kind
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Show,Typeable,Data)
#else
deriving (Eq,Show)
#endif
data Boxed = Boxed | Unboxed
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Show,Typeable,Data)
#else
deriving (Eq,Show)
#endif
data TyVarBind
= KindedVar Name Kind
| UnkindedVar Name
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Show,Typeable,Data)
#else
deriving (Eq,Show)
#endif
data Kind
= KindStar
| KindBang
| KindFn Kind Kind
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Show,Typeable,Data)
#else
deriving (Eq,Show)
#endif
data FunDep
= FunDep [Name] [Name]
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Show,Typeable,Data)
#else
deriving (Eq,Show)
#endif
type Context = [Asst]
data Asst = ClassA QName [Type]
| IParam IPName Type
| EqualP Type Type
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Show,Typeable,Data)
#else
deriving (Eq,Show)
#endif
data Literal
= Char Char
| String String
| Int Integer
| Frac Rational
| CharPrim Char
| StringPrim String
| IntPrim Integer
| FloatPrim Rational
| DoublePrim Rational
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Show,Typeable,Data)
#else
deriving (Eq,Show)
#endif
data Exp
= Var QName
| IPVar IPName
| Con QName
| Lit Literal
| InfixApp Exp QOp Exp
| App Exp Exp
| NegApp Exp
| Lambda SrcLoc [Pat] Exp
| Let Binds Exp
| If Exp Exp Exp
| Case Exp [Alt]
| Do [Stmt]
| MDo [Stmt]
| Tuple [Exp]
| List [Exp]
| Paren Exp
| LeftSection Exp QOp
| RightSection QOp Exp
| RecConstr QName [FieldUpdate]
| RecUpdate Exp [FieldUpdate]
| EnumFrom Exp
| EnumFromTo Exp Exp
| EnumFromThen Exp Exp
| EnumFromThenTo Exp Exp Exp
| ListComp Exp [Stmt]
| ExpTypeSig SrcLoc Exp Type
| VarQuote QName
| TypQuote QName
| BracketExp Bracket
| SpliceExp Splice
| XTag SrcLoc XName [XAttr] (Maybe Exp) [Exp]
| XETag SrcLoc XName [XAttr] (Maybe Exp)
| XPcdata String
| XExpTag Exp
| CorePragma String
| SCCPragma String
| GenPragma String (Int, Int) (Int, Int)
| UnknownExpPragma String String
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Show,Typeable,Data)
#else
deriving (Eq,Show)
#endif
data XName
= XName String
| XDomName String String
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Show,Typeable,Data)
#else
deriving (Eq,Show)
#endif
data XAttr = XAttr XName Exp
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Show,Typeable,Data)
#else
deriving (Eq,Show)
#endif
data Bracket
= ExpBracket Exp
| PatBracket Pat
| TypeBracket Type
| DeclBracket [Decl]
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Show,Typeable,Data)
#else
deriving (Eq,Show)
#endif
data Splice
= IdSplice String
| ParenSplice Exp
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Show,Typeable,Data)
#else
deriving (Eq,Show)
#endif
data Safety
= PlayRisky
| PlaySafe Bool
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Show,Typeable,Data)
#else
deriving (Eq,Show)
#endif
data CallConv
= StdCall
| CCall
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Show,Typeable,Data)
#else
deriving (Eq,Show)
#endif
data OptionPragma
= LanguagePragma SrcLoc [Name]
| IncludePragma SrcLoc String
| CFilesPragma SrcLoc String
| OptionsPragma SrcLoc (Maybe Tool) String
| UnknownTopPragma SrcLoc String String
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Show,Typeable,Data)
#else
deriving (Eq,Show)
#endif
data Tool = GHC | HUGS | NHC98 | YHC | HADDOCK | UnknownTool String
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Show,Typeable,Data)
#else
deriving (Eq,Show)
#endif
data Activation
= AlwaysActive
| ActiveFrom Int
| ActiveUntil Int
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Show,Typeable,Data)
#else
deriving (Eq,Show)
#endif
data Rule
= Rule String Activation (Maybe [RuleVar]) Exp Exp
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Show,Typeable,Data)
#else
deriving (Eq,Show)
#endif
data RuleVar
= RuleVar Name
| TypedRuleVar Name Type
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Show,Typeable,Data)
#else
deriving (Eq,Show)
#endif
data WarningText
= DeprText String
| WarnText String
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Show,Typeable,Data)
#else
deriving (Eq,Show)
#endif
data Pat
= PVar Name
| PLit Literal
| PNeg Pat
| PInfixApp Pat QName Pat
| PApp QName [Pat]
| PTuple [Pat]
| PList [Pat]
| PParen Pat
| PRec QName [PatField]
| PAsPat Name Pat
| PWildCard
| PIrrPat Pat
| PatTypeSig SrcLoc Pat Type
| PViewPat Exp Pat
| PRPat [RPat]
| PXTag SrcLoc XName [PXAttr] (Maybe Pat) [Pat]
| PXETag SrcLoc XName [PXAttr] (Maybe Pat)
| PXPcdata String
| PXPatTag Pat
| PXRPats [RPat]
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Show,Typeable,Data)
#else
deriving (Eq,Show)
#endif
data PXAttr = PXAttr XName Pat
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Show,Typeable,Data)
#else
deriving (Eq,Show)
#endif
data RPatOp
= RPStar
| RPStarG
| RPPlus
| RPPlusG
| RPOpt
| RPOptG
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Show,Typeable,Data)
#else
deriving (Eq,Show)
#endif
data RPat
= RPOp RPat RPatOp
| RPEither RPat RPat
| RPSeq [RPat]
| RPGuard Pat [Stmt]
| RPCAs Name RPat
| RPAs Name RPat
| RPParen RPat
| RPPat Pat
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Show,Typeable,Data)
#else
deriving (Eq,Show)
#endif
data PatField
= PFieldPat QName Pat
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Show,Typeable,Data)
#else
deriving (Eq,Show)
#endif
data Stmt
= Generator SrcLoc Pat Exp
| Qualifier Exp
| LetStmt Binds
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Show,Typeable,Data)
#else
deriving (Eq,Show)
#endif
data FieldUpdate
= FieldUpdate QName Exp
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Show,Typeable,Data)
#else
deriving (Eq,Show)
#endif
data Alt
= Alt SrcLoc Pat GuardedAlts Binds
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Show,Typeable,Data)
#else
deriving (Eq,Show)
#endif
data GuardedAlts
= UnGuardedAlt Exp
| GuardedAlts [GuardedAlt]
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Show,Typeable,Data)
#else
deriving (Eq,Show)
#endif
data GuardedAlt
= GuardedAlt SrcLoc [Stmt] Exp
#ifdef __GLASGOW_HASKELL__
deriving (Eq,Show,Typeable,Data)
#else
deriving (Eq,Show)
#endif
prelude_mod, main_mod :: ModuleName
prelude_mod = ModuleName "Prelude"
main_mod = ModuleName "Main"
main_name :: Name
main_name = Ident "main"
unit_con_name :: QName
unit_con_name = Special UnitCon
tuple_con_name :: Int -> QName
tuple_con_name i = Special (TupleCon (i+1))
list_cons_name :: QName
list_cons_name = Special Cons
unit_con :: Exp
unit_con = Con unit_con_name
tuple_con :: Int -> Exp
tuple_con i = Con (tuple_con_name i)
as_name, qualified_name, hiding_name, minus_name, pling_name, dot_name, star_name :: Name
as_name = Ident "as"
qualified_name = Ident "qualified"
hiding_name = Ident "hiding"
minus_name = Symbol "-"
pling_name = Symbol "!"
dot_name = Symbol "."
star_name = Symbol "*"
export_name, safe_name, unsafe_name, threadsafe_name, stdcall_name, ccall_name :: Name
export_name = Ident "export"
safe_name = Ident "safe"
unsafe_name = Ident "unsafe"
threadsafe_name = Ident "threadsafe"
stdcall_name = Ident "stdcall"
ccall_name = Ident "ccall"
unit_tycon_name, fun_tycon_name, list_tycon_name :: QName
unit_tycon_name = unit_con_name
fun_tycon_name = Special FunCon
list_tycon_name = Special ListCon
tuple_tycon_name :: Int -> QName
tuple_tycon_name i = tuple_con_name i
unit_tycon, fun_tycon, list_tycon :: Type
unit_tycon = TyCon unit_tycon_name
fun_tycon = TyCon fun_tycon_name
list_tycon = TyCon list_tycon_name
tuple_tycon :: Int -> Type
tuple_tycon i = TyCon (tuple_tycon_name i)