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

Safe HaskellSafe
LanguageHaskell2010

Language.Haskell.Exts.Simple.Syntax

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

Documentation

type Alt = Alt () Source #

type Stmt = Stmt () Source #

type RPat = RPat () Source #

type RPatOp = RPatOp () Source #

type PXAttr = PXAttr () Source #

type Pat = Pat () Source #

type Rule = Rule () Source #

type Safety = Safety () Source #

type Splice = Splice () Source #

type XAttr = XAttr () Source #

type XName = XName () Source #

type Exp = Exp () Source #

type Sign = Sign () Source #

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.

type Asst = Asst () Source #

type FunDep = FunDep () Source #

type Kind = Kind () Source #

Note that Kind is an alias for Type since haskell-src-exts-1.21.

type Type = Type () Source #

type Rhs = Rhs () Source #

type Match = Match () Source #

type IPBind = IPBind () Source #

type Binds = Binds () Source #

type Role = Role () Source #

type Decl = Decl () Source #

type Assoc = Assoc () Source #

type Module = Module () Source #

type CName = CName () Source #

type Op = Op () Source #

type QOp = QOp () Source #

type IPName = IPName () Source #

type Name = Name () Source #

type QName = QName () Source #

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

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

pattern GroupBy :: Exp -> QualStmt Source #

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

pattern ThenTrans :: Exp -> QualStmt Source #

pattern QualStmt :: Stmt -> QualStmt Source #

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

pattern LetStmt :: Binds -> Stmt Source #

pattern Qualifier :: Exp -> Stmt Source #

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

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

pattern RPPat :: Pat -> RPat Source #

pattern RPParen :: RPat -> RPat Source #

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

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

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

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

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

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

pattern RPOptG :: RPatOp Source #

pattern RPOpt :: RPatOp Source #

pattern RPPlusG :: RPatOp Source #

pattern RPPlus :: RPatOp Source #

pattern RPStarG :: RPatOp Source #

pattern RPStar :: RPatOp Source #

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

pattern PBangPat :: Pat -> Pat Source #

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

pattern PSplice :: Splice -> Pat Source #

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

pattern PXPatTag :: Pat -> Pat Source #

pattern PXPcdata :: String -> Pat Source #

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

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

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

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

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

pattern PIrrPat :: Pat -> Pat Source #

pattern PWildCard :: Pat Source #

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

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

pattern PParen :: Pat -> Pat Source #

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

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

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

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

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

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

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

pattern PVar :: Name -> Pat Source #

pattern RuleVar :: Name -> RuleVar Source #

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

pattern Overlap :: Overlap Source #

pattern CApi :: CallConv Source #

pattern Js :: CallConv Source #

pattern Jvm :: CallConv Source #

pattern DotNet :: CallConv Source #

pattern CCall :: CallConv Source #

pattern PlaySafe :: Bool -> Safety Source #

pattern ParenSplice :: Exp -> Splice Source #

pattern IdSplice :: String -> Splice Source #

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

pattern PatBracket :: Pat -> Bracket Source #

pattern ExpBracket :: Exp -> Bracket Source #

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

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

pattern XName :: String -> XName Source #

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

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

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

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

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

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

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

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

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

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

pattern XExpTag :: Exp -> Exp Source #

pattern XPcdata :: String -> Exp Source #

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

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

pattern TypeApp :: Type -> Exp Source #

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

pattern SpliceExp :: Splice -> Exp Source #

pattern BracketExp :: Bracket -> Exp Source #

pattern TypQuote :: QName -> Exp Source #

pattern VarQuote :: QName -> Exp Source #

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

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

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

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

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

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

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

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

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

pattern EnumFrom :: Exp -> Exp Source #

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

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

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

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

pattern Paren :: Exp -> Exp Source #

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

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

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

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

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

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

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

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

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

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

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

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

pattern NegApp :: Exp -> Exp Source #

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

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

pattern Lit :: Literal -> Exp Source #

pattern Con :: QName -> Exp Source #

pattern IPVar :: IPName -> Exp Source #

pattern Var :: QName -> Exp Source #

pattern Negative :: Sign Source #

pattern Signless :: Sign Source #

pattern PrimChar :: Char -> Literal Source #

pattern Frac :: Rational -> Literal Source #

pattern Int :: Integer -> Literal Source #

pattern String :: String -> Literal Source #

pattern Char :: Char -> Literal Source #

pattern ParenA :: Asst -> Asst Source #

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

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

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

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

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

pattern CxEmpty :: Context Source #

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

pattern CxSingle :: Asst -> Context Source #

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

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

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

pattern TySplice :: Splice -> Type Source #

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

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

pattern TyParen :: Type -> Type Source #

pattern TyCon :: QName -> Type Source #

pattern TyVar :: Name -> Type Source #

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

pattern TyParArray :: Type -> Type Source #

pattern TyList :: Type -> Type Source #

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

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

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

pattern TyStar :: Type Source #

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

pattern UnGuardedRhs :: Exp -> Rhs Source #

pattern LazyTy :: BangType Source #

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

pattern InsDecl :: Decl -> InstDecl Source #

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

pattern ClsDecl :: Decl -> ClassDecl Source #

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

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

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

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

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

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

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

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

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

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

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

pattern IHCon :: QName -> InstHead Source #

pattern DHead :: Name -> DeclHead Source #

pattern KindSig :: Kind -> ResultSig Source #

pattern Phantom :: Role Source #

pattern Nominal :: Role Source #

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

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

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

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

pattern InstSig :: InstRule -> Decl Source #

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

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

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

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

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

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

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

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

pattern SpliceDecl :: Exp -> Decl Source #

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

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

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

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

pattern AssocLeft :: Assoc Source #

pattern AssocNone :: Assoc Source #

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

pattern IVar :: Name -> ImportSpec Source #

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.

pattern EVar :: QName -> ExportSpec Source #

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

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

pattern ConName :: Name -> CName Source #

pattern VarName :: Name -> CName Source #

pattern ConOp :: Name -> Op Source #

pattern VarOp :: Name -> Op Source #

pattern QConOp :: QName -> QOp Source #

pattern QVarOp :: QName -> QOp Source #

pattern IPLin :: String -> IPName Source #

pattern IPDup :: String -> IPName Source #

pattern Symbol :: String -> Name Source #

pattern Ident :: String -> Name Source #

pattern UnQual :: Name -> QName Source #

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

pattern Cons :: SpecialCon Source #

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

data Boxed #

Flag denoting whether a tuple is boxed or unboxed.

Constructors

Boxed 
Unboxed 
Instances
Eq Boxed 
Instance details

Defined in Language.Haskell.Exts.Syntax

Methods

(==) :: Boxed -> Boxed -> Bool #

(/=) :: Boxed -> Boxed -> Bool #

Data Boxed 
Instance details

Defined in Language.Haskell.Exts.Syntax

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Boxed -> c Boxed #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Boxed #

toConstr :: Boxed -> Constr #

dataTypeOf :: Boxed -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Boxed) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Boxed) #

gmapT :: (forall b. Data b => b -> b) -> Boxed -> Boxed #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Boxed -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Boxed -> r #

gmapQ :: (forall d. Data d => d -> u) -> Boxed -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Boxed -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Boxed -> m Boxed #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Boxed -> m Boxed #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Boxed -> m Boxed #

Ord Boxed 
Instance details

Defined in Language.Haskell.Exts.Syntax

Methods

compare :: Boxed -> Boxed -> Ordering #

(<) :: Boxed -> Boxed -> Bool #

(<=) :: Boxed -> Boxed -> Bool #

(>) :: Boxed -> Boxed -> Bool #

(>=) :: Boxed -> Boxed -> Bool #

max :: Boxed -> Boxed -> Boxed #

min :: Boxed -> Boxed -> Boxed #

Show Boxed 
Instance details

Defined in Language.Haskell.Exts.Syntax

Methods

showsPrec :: Int -> Boxed -> ShowS #

show :: Boxed -> String #

showList :: [Boxed] -> ShowS #

Generic Boxed 
Instance details

Defined in Language.Haskell.Exts.Syntax

Associated Types

type Rep Boxed :: Type -> Type #

Methods

from :: Boxed -> Rep Boxed x #

to :: Rep Boxed x -> Boxed #

type Rep Boxed 
Instance details

Defined in Language.Haskell.Exts.Syntax

type Rep Boxed = D1 (MetaData "Boxed" "Language.Haskell.Exts.Syntax" "haskell-src-exts-1.21.0-1MqMUIJU7y29AVS9NHxlR4" False) (C1 (MetaCons "Boxed" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "Unboxed" PrefixI False) (U1 :: Type -> Type))

data Tool #

Recognised tools for OPTIONS pragmas.

Instances
Eq Tool 
Instance details

Defined in Language.Haskell.Exts.Syntax

Methods

(==) :: Tool -> Tool -> Bool #

(/=) :: Tool -> Tool -> Bool #

Data Tool 
Instance details

Defined in Language.Haskell.Exts.Syntax

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Tool -> c Tool #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Tool #

toConstr :: Tool -> Constr #

dataTypeOf :: Tool -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Tool) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Tool) #

gmapT :: (forall b. Data b => b -> b) -> Tool -> Tool #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Tool -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Tool -> r #

gmapQ :: (forall d. Data d => d -> u) -> Tool -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Tool -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Tool -> m Tool #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Tool -> m Tool #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Tool -> m Tool #

Ord Tool 
Instance details

Defined in Language.Haskell.Exts.Syntax

Methods

compare :: Tool -> Tool -> Ordering #

(<) :: Tool -> Tool -> Bool #

(<=) :: Tool -> Tool -> Bool #

(>) :: Tool -> Tool -> Bool #

(>=) :: Tool -> Tool -> Bool #

max :: Tool -> Tool -> Tool #

min :: Tool -> Tool -> Tool #

Show Tool 
Instance details

Defined in Language.Haskell.Exts.Syntax

Methods

showsPrec :: Int -> Tool -> ShowS #

show :: Tool -> String #

showList :: [Tool] -> ShowS #

Generic Tool 
Instance details

Defined in Language.Haskell.Exts.Syntax

Associated Types

type Rep Tool :: Type -> Type #

Methods

from :: Tool -> Rep Tool x #

to :: Rep Tool x -> Tool #

Pretty Tool 
Instance details

Defined in Language.Haskell.Exts.Pretty

Methods

pretty :: Tool -> Doc

prettyPrec :: Int -> Tool -> Doc

type Rep Tool 
Instance details

Defined in Language.Haskell.Exts.Syntax

type Rep Tool = D1 (MetaData "Tool" "Language.Haskell.Exts.Syntax" "haskell-src-exts-1.21.0-1MqMUIJU7y29AVS9NHxlR4" False) ((C1 (MetaCons "GHC" PrefixI False) (U1 :: Type -> Type) :+: (C1 (MetaCons "HUGS" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "NHC98" PrefixI False) (U1 :: Type -> Type))) :+: (C1 (MetaCons "YHC" PrefixI False) (U1 :: Type -> Type) :+: (C1 (MetaCons "HADDOCK" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "UnknownTool" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String)))))