haskell-src-exts-simple-1.20.0.0: A simplified view on the haskell-src-exts AST

Safe HaskellSafe
LanguageHaskell2010

Language.Haskell.Exts.Simple.Syntax

Contents

Description

This module reexports a simplified view on Language.Haskell.Exts.Syntax. The idea is to expose datatypes like

data Name l = Ident l String | Symbol l String

using ghc's pattern synonyms:

type Name = H.Name ()
pattern Ident a = H.Ident () a
pattern Symbol a = H.Symbol () a

This works nicely for all datatypes with two exception:

  • ImportDecl has a record constructor. Record type synonyms are only supported ghc-8.0 and later, so for ghc-7.10 and earlier, the constructor is exported as a plain constructor, and the record fields as function.
  • Literal has constructors with an extra String argument that is not used by Pretty. This module uses explicitly bidirectional pattern synonyms to support this type, but support for that is only available in ghc-7.10 and later.

IMPORTANT: if you require compatiblity with ghc 7.8, you should use the functions charL, stringL etc. for constructing Literal values!

Synopsis

Datatypes and Constructors

ModuleName

SpecialCon

pattern TupleCon :: Boxed -> Int -> SpecialCon Source #

pattern Cons :: SpecialCon Source #

QName

type QName = QName () Source #

pattern Qual :: ModuleName -> Name -> QName Source #

pattern UnQual :: Name -> QName Source #

Name

type Name = Name () Source #

pattern Ident :: String -> Name Source #

pattern Symbol :: String -> Name Source #

IPName

type IPName = IPName () Source #

pattern IPDup :: String -> IPName Source #

pattern IPLin :: String -> IPName Source #

QOp

type QOp = QOp () Source #

pattern QVarOp :: QName -> QOp Source #

pattern QConOp :: QName -> QOp Source #

Op

type Op = Op () Source #

pattern VarOp :: Name -> Op Source #

pattern ConOp :: Name -> Op Source #

CName

type CName = CName () Source #

pattern VarName :: Name -> CName Source #

pattern ConName :: Name -> CName Source #

Module

type Module = Module () Source #

pattern XmlPage :: ModuleName -> [ModulePragma] -> XName -> [XAttr] -> Maybe Exp -> [Exp] -> Module Source #

pattern XmlHybrid :: Maybe ModuleHead -> [ModulePragma] -> [ImportDecl] -> [Decl] -> XName -> [XAttr] -> Maybe Exp -> [Exp] -> Module Source #

ModuleHead

ExportSpecList

ExportSpec

pattern EVar :: QName -> ExportSpec Source #

EWildcard

Namespace

ImportDecl

pattern ImportDecl :: ModuleName () -> Bool -> Bool -> Bool -> Maybe String -> Maybe (ModuleName ()) -> Maybe (ImportSpecList ()) -> ImportDecl Source #

Note, this is originally a record constructor, and we use a pattern record synonym for ghc-8.0. But for earlier ghc versions, ImportDecl is a plain pattern synonym, and the selectors are exported as functions.

ImportSpecList

ImportSpec

pattern IVar :: Name -> ImportSpec Source #

pattern IThingWith :: Name -> [CName] -> ImportSpec Source #

Assoc

type Assoc = Assoc () Source #

pattern AssocNone :: Assoc Source #

pattern AssocLeft :: Assoc Source #

Decl

type Decl = Decl () Source #

pattern TypeDecl :: DeclHead -> Type -> Decl Source #

pattern TypeInsDecl :: Type -> Type -> Decl Source #

pattern InfixDecl :: Assoc -> Maybe Int -> [Op] -> Decl Source #

pattern DefaultDecl :: [Type] -> Decl Source #

pattern SpliceDecl :: Exp -> Decl Source #

pattern TypeSig :: [Name] -> Type -> Decl Source #

pattern FunBind :: [Match] -> Decl Source #

pattern PatBind :: Pat -> Rhs -> Maybe Binds -> Decl Source #

pattern ForExp :: CallConv -> Maybe String -> Name -> Type -> Decl Source #

pattern RulePragmaDecl :: [Rule] -> Decl Source #

pattern DeprPragmaDecl :: [([Name], String)] -> Decl Source #

pattern WarnPragmaDecl :: [([Name], String)] -> Decl Source #

pattern SpecSig :: Maybe Activation -> QName -> [Type] -> Decl Source #

pattern InstSig :: InstRule -> Decl Source #

pattern RoleAnnotDecl :: QName -> [Role] -> Decl Source #

PatternSynDirection

TypeEqn

pattern TypeEqn :: Type -> Type -> TypeEqn Source #

Annotation

pattern Ann :: Name -> Exp -> Annotation Source #

pattern TypeAnn :: Name -> Exp -> Annotation Source #

BooleanFormula

Role

type Role = Role () Source #

pattern Nominal :: Role Source #

pattern Phantom :: Role Source #

DataOrNew

InjectivityInfo

ResultSig

pattern KindSig :: Kind -> ResultSig Source #

DeclHead

pattern DHead :: Name -> DeclHead Source #

InstRule

InstHead

pattern IHCon :: QName -> InstHead Source #

pattern IHInfix :: Type -> QName -> InstHead Source #

pattern IHApp :: InstHead -> Type -> InstHead Source #

Deriving

DerivStrategy

Binds

type Binds = Binds () Source #

pattern BDecls :: [Decl] -> Binds Source #

pattern IPBinds :: [IPBind] -> Binds Source #

IPBind

type IPBind = IPBind () Source #

pattern IPBind :: IPName -> Exp -> IPBind Source #

Match

type Match = Match () Source #

pattern Match :: Name -> [Pat] -> Rhs -> Maybe Binds -> Match Source #

pattern InfixMatch :: Pat -> Name -> [Pat] -> Rhs -> Maybe Binds -> Match Source #

QualConDecl

ConDecl

pattern ConDecl :: Name -> [Type] -> ConDecl Source #

pattern InfixConDecl :: Type -> Name -> Type -> ConDecl Source #

pattern RecDecl :: Name -> [FieldDecl] -> ConDecl Source #

FieldDecl

pattern FieldDecl :: [Name] -> Type -> FieldDecl Source #

GadtDecl

ClassDecl

pattern ClsDecl :: Decl -> ClassDecl Source #

pattern ClsDefSig :: Name -> Type -> ClassDecl Source #

InstDecl

pattern InsDecl :: Decl -> InstDecl Source #

pattern InsType :: Type -> Type -> InstDecl Source #

BangType

pattern LazyTy :: BangType Source #

Unpackedness

Rhs

type Rhs = Rhs () Source #

pattern UnGuardedRhs :: Exp -> Rhs Source #

GuardedRhs

pattern GuardedRhs :: [Stmt] -> Exp -> GuardedRhs Source #

Type

type Type = Type () Source #

pattern TyFun :: Type -> Type -> Type Source #

pattern TyTuple :: Boxed -> [Type] -> Type Source #

pattern TyUnboxedSum :: [Type] -> Type Source #

pattern TyList :: Type -> Type Source #

pattern TyParArray :: Type -> Type Source #

pattern TyApp :: Type -> Type -> Type Source #

pattern TyVar :: Name -> Type Source #

pattern TyCon :: QName -> Type Source #

pattern TyParen :: Type -> Type Source #

pattern TyKind :: Type -> Kind -> Type Source #

pattern TyEquals :: Type -> Type -> Type Source #

pattern TySplice :: Splice -> Type Source #

MaybePromotedName

Promoted

pattern PromotedList :: Bool -> [Type] -> Promoted Source #

TyVarBind

pattern KindedVar :: Name -> Kind -> TyVarBind Source #

Kind

type Kind = Kind () Source #

pattern KindStar :: Kind Source #

pattern KindFn :: Kind -> Kind -> Kind Source #

pattern KindParen :: Kind -> Kind Source #

pattern KindVar :: QName -> Kind Source #

pattern KindApp :: Kind -> Kind -> Kind Source #

pattern KindTuple :: [Kind] -> Kind Source #

pattern KindList :: Kind -> Kind Source #

FunDep

type FunDep = FunDep () Source #

pattern FunDep :: [Name] -> [Name] -> FunDep Source #

Context

pattern CxSingle :: Asst -> Context Source #

pattern CxTuple :: [Asst] -> Context Source #

pattern CxEmpty :: Context Source #

Asst

type Asst = Asst () Source #

pattern ClassA :: QName -> [Type] -> Asst Source #

pattern AppA :: Name -> [Type] -> Asst Source #

pattern InfixA :: Type -> QName -> Type -> Asst Source #

pattern IParam :: IPName -> Type -> Asst Source #

pattern EqualP :: Type -> Type -> Asst Source #

pattern ParenA :: Asst -> Asst Source #

Literal

type Literal = Literal () Source #

Beware that the constructors only work in a pattern context in ghc-7.8, because that version does not support explicitly bidirectional pattern synonyms.

For code that needs to work with ghc-7.8, we provide functions charL, stringL, intL, fracL, etc. for constructing Literal values.

pattern Char :: Char -> Literal Source #

pattern String :: String -> Literal Source #

pattern Int :: Integer -> Literal Source #

pattern Frac :: Rational -> Literal Source #

pattern PrimChar :: Char -> Literal Source #

Sign

type Sign = Sign () Source #

pattern Signless :: Sign Source #

pattern Negative :: Sign Source #

Exp

type Exp = Exp () Source #

pattern Var :: QName -> Exp Source #

pattern IPVar :: IPName -> Exp Source #

pattern Con :: QName -> Exp Source #

pattern Lit :: Literal -> Exp Source #

pattern InfixApp :: Exp -> QOp -> Exp -> Exp Source #

pattern App :: Exp -> Exp -> Exp Source #

pattern NegApp :: Exp -> Exp Source #

pattern Lambda :: [Pat] -> Exp -> Exp Source #

pattern Let :: Binds -> Exp -> Exp Source #

pattern If :: Exp -> Exp -> Exp -> Exp Source #

pattern MultiIf :: [GuardedRhs] -> Exp Source #

pattern Case :: Exp -> [Alt] -> Exp Source #

pattern Do :: [Stmt] -> Exp Source #

pattern MDo :: [Stmt] -> Exp Source #

pattern Tuple :: Boxed -> [Exp] -> Exp Source #

pattern UnboxedSum :: Int -> Int -> Exp -> Exp Source #

pattern TupleSection :: Boxed -> [Maybe Exp] -> Exp Source #

pattern List :: [Exp] -> Exp Source #

pattern ParArray :: [Exp] -> Exp Source #

pattern Paren :: Exp -> Exp Source #

pattern LeftSection :: Exp -> QOp -> Exp Source #

pattern RightSection :: QOp -> Exp -> Exp Source #

pattern RecConstr :: QName -> [FieldUpdate] -> Exp Source #

pattern RecUpdate :: Exp -> [FieldUpdate] -> Exp Source #

pattern EnumFrom :: Exp -> Exp Source #

pattern EnumFromTo :: Exp -> Exp -> Exp Source #

pattern EnumFromThen :: Exp -> Exp -> Exp Source #

pattern EnumFromThenTo :: Exp -> Exp -> Exp -> Exp Source #

pattern ParArrayFromTo :: Exp -> Exp -> Exp Source #

pattern ParArrayFromThenTo :: Exp -> Exp -> Exp -> Exp Source #

pattern ListComp :: Exp -> [QualStmt] -> Exp Source #

pattern ParComp :: Exp -> [[QualStmt]] -> Exp Source #

pattern ParArrayComp :: Exp -> [[QualStmt]] -> Exp Source #

pattern ExpTypeSig :: Exp -> Type -> Exp Source #

pattern VarQuote :: QName -> Exp Source #

pattern TypQuote :: QName -> Exp Source #

pattern BracketExp :: Bracket -> Exp Source #

pattern SpliceExp :: Splice -> Exp Source #

pattern QuasiQuote :: String -> String -> Exp Source #

pattern TypeApp :: Type -> Exp Source #

pattern XTag :: XName -> [XAttr] -> Maybe Exp -> [Exp] -> Exp Source #

pattern XETag :: XName -> [XAttr] -> Maybe Exp -> Exp Source #

pattern XPcdata :: String -> Exp Source #

pattern XExpTag :: Exp -> Exp Source #

pattern XChildTag :: [Exp] -> Exp Source #

pattern CorePragma :: String -> Exp -> Exp Source #

pattern SCCPragma :: String -> Exp -> Exp Source #

pattern GenPragma :: String -> (Int, Int) -> (Int, Int) -> Exp -> Exp Source #

pattern Proc :: Pat -> Exp -> Exp Source #

pattern LeftArrApp :: Exp -> Exp -> Exp Source #

pattern RightArrApp :: Exp -> Exp -> Exp Source #

pattern LeftArrHighApp :: Exp -> Exp -> Exp Source #

pattern RightArrHighApp :: Exp -> Exp -> Exp Source #

pattern LCase :: [Alt] -> Exp Source #

XName

type XName = XName () Source #

pattern XName :: String -> XName Source #

pattern XDomName :: String -> String -> XName Source #

XAttr

type XAttr = XAttr () Source #

pattern XAttr :: XName -> Exp -> XAttr Source #

Bracket

pattern ExpBracket :: Exp -> Bracket Source #

pattern PatBracket :: Pat -> Bracket Source #

pattern DeclBracket :: [Decl] -> Bracket Source #

Splice

type Splice = Splice () Source #

pattern IdSplice :: String -> Splice Source #

pattern ParenSplice :: Exp -> Splice Source #

Safety

type Safety = Safety () Source #

pattern PlaySafe :: Bool -> Safety Source #

CallConv

pattern CCall :: CallConv Source #

pattern DotNet :: CallConv Source #

pattern Jvm :: CallConv Source #

pattern Js :: CallConv Source #

pattern CApi :: CallConv Source #

ModulePragma

Overlap

pattern Overlap :: Overlap Source #

Activation

Rule

type Rule = Rule () Source #

pattern Rule :: String -> Maybe Activation -> Maybe [RuleVar] -> Exp -> Exp -> Rule Source #

RuleVar

pattern RuleVar :: Name -> RuleVar Source #

WarningText

Pat

type Pat = Pat () Source #

pattern PVar :: Name -> Pat Source #

pattern PLit :: Sign -> Literal -> Pat Source #

pattern PNPlusK :: Name -> Integer -> Pat Source #

pattern PInfixApp :: Pat -> QName -> Pat -> Pat Source #

pattern PApp :: QName -> [Pat] -> Pat Source #

pattern PTuple :: Boxed -> [Pat] -> Pat Source #

pattern PUnboxedSum :: Int -> Int -> Pat -> Pat Source #

pattern PList :: [Pat] -> Pat Source #

pattern PParen :: Pat -> Pat Source #

pattern PRec :: QName -> [PatField] -> Pat Source #

pattern PAsPat :: Name -> Pat -> Pat Source #

pattern PWildCard :: Pat Source #

pattern PIrrPat :: Pat -> Pat Source #

pattern PatTypeSig :: Pat -> Type -> Pat Source #

pattern PViewPat :: Exp -> Pat -> Pat Source #

pattern PRPat :: [RPat] -> Pat Source #

pattern PXTag :: XName -> [PXAttr] -> Maybe Pat -> [Pat] -> Pat Source #

pattern PXETag :: XName -> [PXAttr] -> Maybe Pat -> Pat Source #

pattern PXPcdata :: String -> Pat Source #

pattern PXPatTag :: Pat -> Pat Source #

pattern PXRPats :: [RPat] -> Pat Source #

pattern PSplice :: Splice -> Pat Source #

pattern PQuasiQuote :: String -> String -> Pat Source #

pattern PBangPat :: Pat -> Pat Source #

PXAttr

type PXAttr = PXAttr () Source #

pattern PXAttr :: XName -> Pat -> PXAttr Source #

RPatOp

type RPatOp = RPatOp () Source #

pattern RPStar :: RPatOp Source #

pattern RPStarG :: RPatOp Source #

pattern RPPlus :: RPatOp Source #

pattern RPPlusG :: RPatOp Source #

pattern RPOpt :: RPatOp Source #

pattern RPOptG :: RPatOp Source #

RPat

type RPat = RPat () Source #

pattern RPOp :: RPat -> RPatOp -> RPat Source #

pattern RPEither :: RPat -> RPat -> RPat Source #

pattern RPSeq :: [RPat] -> RPat Source #

pattern RPGuard :: Pat -> [Stmt] -> RPat Source #

pattern RPCAs :: Name -> RPat -> RPat Source #

pattern RPAs :: Name -> RPat -> RPat Source #

pattern RPParen :: RPat -> RPat Source #

pattern RPPat :: Pat -> RPat Source #

PatField

pattern PFieldPat :: QName -> Pat -> PatField Source #

Stmt

type Stmt = Stmt () Source #

pattern Generator :: Pat -> Exp -> Stmt Source #

pattern Qualifier :: Exp -> Stmt Source #

pattern LetStmt :: Binds -> Stmt Source #

pattern RecStmt :: [Stmt] -> Stmt Source #

QualStmt

pattern QualStmt :: Stmt -> QualStmt Source #

pattern ThenTrans :: Exp -> QualStmt Source #

pattern ThenBy :: Exp -> Exp -> QualStmt Source #

pattern GroupBy :: Exp -> QualStmt Source #

pattern GroupByUsing :: Exp -> Exp -> QualStmt Source #

FieldUpdate

Alt

type Alt = Alt () Source #

pattern Alt :: Pat -> Rhs -> Maybe Binds -> Alt Source #

Functions