Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Types to pretty-print certain parts of Haskell codes.
We define new types to pretty-print AST nodes rather than define
functions to print comments easily using the Pretty
implementation of
GenLocated
.
Synopsis
- newtype InfixExpr = InfixExpr (LHsExpr GhcPs)
- newtype InfixOp = InfixOp RdrName
- newtype PrefixOp = PrefixOp RdrName
- data InfixApp = InfixApp {}
- data GRHSsExpr = GRHSsExpr {}
- data GRHSExpr = GRHSExpr {}
- newtype GRHSProc = GRHSProc (GRHS GhcPs (LHsCmd GhcPs))
- newtype RecConPat = RecConPat (HsRecFields GhcPs (LPat GhcPs))
- newtype RecConField = RecConField (HsFieldBind (LFieldOcc GhcPs) (LPat GhcPs))
- data HsSigType' = HsSigType' {}
- pattern HsSigTypeInsideInstDecl :: HsSigType GhcPs -> HsSigType'
- pattern HsSigTypeInsideVerticalFuncSig :: HsSigType GhcPs -> HsSigType'
- pattern HsSigTypeInsideDeclSig :: HsSigType GhcPs -> HsSigType'
- data HsType' = HsType' {}
- pattern HsTypeInsideVerticalFuncSig :: HsType GhcPs -> HsType'
- pattern HsTypeInsideDeclSig :: HsType GhcPs -> HsType'
- pattern HsTypeInsideInstDecl :: HsType GhcPs -> HsType'
- pattern HsTypeWithVerticalAppTy :: HsType GhcPs -> HsType'
- data DataFamInstDecl' = DataFamInstDecl' {}
- pattern DataFamInstDeclTopLevel :: DataFamInstDecl GhcPs -> DataFamInstDecl'
- pattern DataFamInstDeclInsideClassInst :: DataFamInstDecl GhcPs -> DataFamInstDecl'
- data FamEqn' = FamEqn' {}
- pattern FamEqnTopLevel :: FamEqn GhcPs (HsDataDefn GhcPs) -> FamEqn'
- pattern FamEqnInsideClassInst :: FamEqn GhcPs (HsDataDefn GhcPs) -> FamEqn'
- newtype StmtLRInsideVerticalList = StmtLRInsideVerticalList (StmtLR GhcPs GhcPs (LHsExpr GhcPs))
- newtype ParStmtBlockInsideVerticalList = ParStmtBlockInsideVerticalList (ParStmtBlock GhcPs GhcPs)
- newtype DeclSig = DeclSig (Sig GhcPs)
- newtype TopLevelTyFamInstDecl = TopLevelTyFamInstDecl (TyFamInstDecl GhcPs)
- newtype Context = Context (LHsContext GhcPs)
- newtype HorizontalContext = HorizontalContext (LHsContext GhcPs)
- newtype VerticalContext = VerticalContext (LHsContext GhcPs)
- newtype ModuleNameWithPrefix = ModuleNameWithPrefix ModuleName
- newtype PatInsidePatDecl = PatInsidePatDecl (Pat GhcPs)
- data LambdaCase = LambdaCase {}
- newtype ModuleDeprecatedPragma = ModuleDeprecatedPragma (WarningTxt GhcPs)
- data ListComprehension = ListComprehension {}
- data DoExpression = DoExpression {}
- data DoOrMdo
- data LetIn = LetIn {}
- data NodeComments = NodeComments {}
- data GRHSExprType
- data GRHSProcType
- data HsTypeFor
- data HsTypeDir
- data CaseOrCases
- data DataFamInstDeclFor
Documentation
LHsExpr
used as a infix operator
Instances
CommentExtraction InfixExpr Source # | |
Defined in HIndent.Pretty.NodeComments nodeComments :: InfixExpr -> NodeComments Source # |
Instances
CommentExtraction InfixOp Source # | |
Defined in HIndent.Pretty.NodeComments nodeComments :: InfixOp -> NodeComments Source # |
A wrapper type for printing an identifier as a prefix operator.
Printing a PrefixOp
value containing a symbol operator wraps it with
parentheses.
Instances
CommentExtraction PrefixOp Source # | |
Defined in HIndent.Pretty.NodeComments nodeComments :: PrefixOp -> NodeComments Source # |
An infix operator application.
immediatelyAfterDo
is True
if an application is next to a `do`
keyword. It needs an extra indent in such cases because
do a * b
is not a valid Haskell code.
Instances
CommentExtraction InfixApp Source # | |
Defined in HIndent.Pretty.NodeComments nodeComments :: InfixApp -> NodeComments Source # |
GRHSs
with a label indicating in which context the RHS is located
in.
Instances
CommentExtraction GRHSsExpr Source # | |
Defined in HIndent.Pretty.NodeComments nodeComments :: GRHSsExpr -> NodeComments Source # |
GRHS
for a normal binding.
Instances
CommentExtraction GRHSExpr Source # | |
Defined in HIndent.Pretty.NodeComments nodeComments :: GRHSExpr -> NodeComments Source # |
GRHS
for a proc
binding.
Instances
CommentExtraction GRHSProc Source # | |
Defined in HIndent.Pretty.NodeComments nodeComments :: GRHSProc -> NodeComments Source # |
A pattern match against a record.
Instances
CommentExtraction RecConPat Source # | |
Defined in HIndent.Pretty.NodeComments nodeComments :: RecConPat -> NodeComments Source # |
newtype RecConField Source #
A record field in a pattern match.
Instances
data HsSigType' Source #
A wrapper for HsSigType
.
HsSigType' | |
|
Instances
pattern HsSigTypeInsideInstDecl :: HsSigType GhcPs -> HsSigType' Source #
HsSigType'
for instance declarations.
pattern HsSigTypeInsideVerticalFuncSig :: HsSigType GhcPs -> HsSigType' Source #
HsSigType'
for function declarations; printed horizontally.
pattern HsSigTypeInsideDeclSig :: HsSigType GhcPs -> HsSigType' Source #
HsSigType'
for a top-level function signature.
A wrapper for HsType
.
Instances
CommentExtraction HsType' Source # | |
Defined in HIndent.Pretty.NodeComments nodeComments :: HsType' -> NodeComments Source # |
pattern HsTypeInsideVerticalFuncSig :: HsType GhcPs -> HsType' Source #
HsType'
inside a function signature declaration; printed horizontally.
pattern HsTypeInsideDeclSig :: HsType GhcPs -> HsType' Source #
HsType'
inside a top-level function signature declaration.
pattern HsTypeInsideInstDecl :: HsType GhcPs -> HsType' Source #
HsType'
inside a instance signature declaration.
data DataFamInstDecl' Source #
A wrapper of DataFamInstDecl
.
DataFamInstDecl' | |
|
Instances
pattern DataFamInstDeclTopLevel :: DataFamInstDecl GhcPs -> DataFamInstDecl' Source #
DataFamInstDecl'
wrapping a DataFamInstDecl
representing
a top-level data family instance.
pattern DataFamInstDeclInsideClassInst :: DataFamInstDecl GhcPs -> DataFamInstDecl' Source #
DataFamInstDecl'
wrapping a DataFamInstDecl
representing a data
family instance inside a class instance.
A wrapper for FamEqn
.
FamEqn' | |
|
Instances
CommentExtraction FamEqn' Source # | |
Defined in HIndent.Pretty.NodeComments nodeComments :: FamEqn' -> NodeComments Source # |
pattern FamEqnTopLevel :: FamEqn GhcPs (HsDataDefn GhcPs) -> FamEqn' Source #
pattern FamEqnInsideClassInst :: FamEqn GhcPs (HsDataDefn GhcPs) -> FamEqn' Source #
newtype ParStmtBlockInsideVerticalList Source #
ParStmtBlock
inside a vertically printed list.
Instances
A top-level function signature.
Instances
CommentExtraction DeclSig Source # | |
Defined in HIndent.Pretty.NodeComments nodeComments :: DeclSig -> NodeComments Source # |
A wrapper type for type class constraints; e.g., (Eq a, Ord a) of (Eq
a, Ord a) => [a] -> [a]. Either HorizontalContext
or VerticalContext
is used internally.
Instances
CommentExtraction Context Source # | |
Defined in HIndent.Pretty.NodeComments nodeComments :: Context -> NodeComments Source # |
newtype ModuleNameWithPrefix Source #
A wrapper type for pretty-printing a value of ModuleName
with the
module
prefix.
Pretty-printing it via (string "module " >> pretty (name ::
ModuleName))
locates comments before name
in the same line as module
and the name will be in the next line. This type is to avoid the
problem.
Instances
newtype PatInsidePatDecl Source #
A wrapper for LPat
inside a pattern declaration. Here, all infix
patterns have extra spaces around the operators, like x : xs.
Instances
data LambdaCase Source #
Lambda case.
Instances
data ListComprehension Source #
Use this type to pretty-print a list comprehension.
ListComprehension | |
|
Instances
Use this type to pretty-print a let ... in ...
expression.
Instances
CommentExtraction LetIn Source # | |
Defined in HIndent.Pretty.NodeComments nodeComments :: LetIn -> NodeComments Source # |
data NodeComments Source #
Comments belonging to an AST node.
data GRHSExprType Source #
Values indicating in which context a RHS is located.
Instances
Eq GRHSExprType Source # | |
Defined in HIndent.Pretty.Types (==) :: GRHSExprType -> GRHSExprType -> Bool # (/=) :: GRHSExprType -> GRHSExprType -> Bool # |
data GRHSProcType Source #
Values indicating in which context a RHS in a proc expression is located.
Values indicating in which context a HsType
is located.
Values indicating how a node should be printed; either horizontally or vertically.
data DataFamInstDeclFor Source #
Values indicating where a data family instance is declared.