haskell-src-exts-1.14.0.1: Manipulating Haskell source: abstract syntax, lexer, parser, and pretty-printer

Copyright | (c) Niklas Broberg 2009
License | BSD-style (see the file LICENSE.txt)
Maintainer | Niklas Broberg, d00nibro@chalmers.se
Stability | experimental
Portability | portable
Safe Haskell | Safe-Inferred
Language | Haskell98

Language.Haskell.Exts.Annotated.Simplify

Description

This module contains code for translating from the annotated complex AST in Language.Haskell.Exts.Annotated.Syntax to the simpler, sparsely annotated AST in Language.Haskell.Exts.Syntax.

A function `sXYZ` translates an annotated AST node of type `XYZ l` into a simple AST node of type `XYZ`. I would have prefered to use a MPTC with an fd/type family to get a single exported function name, but I wish to stay Haskell 2010 compliant. Let's hope for Haskell 2011.

Synopsis

- sModule :: SrcInfo loc => Module loc -> Module
- sDecl :: SrcInfo loc => Decl loc -> Decl
- sAnnotation :: SrcInfo loc => Annotation loc -> Annotation
- sModuleName :: ModuleName l -> ModuleName
- sSpecialCon :: SpecialCon l -> SpecialCon
- sQName :: QName l -> QName
- sName :: Name l -> Name
- sIPName :: IPName l -> IPName
- sQOp :: QOp l -> QOp
- sOp :: Op l -> Op
- sCName :: CName l -> CName
- sModuleHead :: Maybe (ModuleHead l) -> (ModuleName, Maybe WarningText, Maybe [ExportSpec])
- sExportSpecList :: ExportSpecList l -> [ExportSpec]
- sExportSpec :: ExportSpec l -> ExportSpec
- sImportDecl :: SrcInfo loc => ImportDecl loc -> ImportDecl
- sImportSpecList :: ImportSpecList l -> (Bool, [ImportSpec])
- sImportSpec :: ImportSpec l -> ImportSpec
- sAssoc :: Assoc l -> Assoc
- sDeclHead :: DeclHead l -> (Name, [TyVarBind])
- sInstHead :: InstHead l -> (QName, [Type])
- sDataOrNew :: DataOrNew l -> DataOrNew
- sDeriving :: Deriving l -> [(QName, [Type])]
- sBinds :: SrcInfo loc => Binds loc -> Binds
- sIPBind :: SrcInfo loc => IPBind loc -> IPBind
- sMatch :: SrcInfo loc => Match loc -> Match
- sQualConDecl :: SrcInfo loc => QualConDecl loc -> QualConDecl
- sConDecl :: ConDecl l -> ConDecl
- sFieldDecl :: FieldDecl l -> ([Name], BangType)
- sGadtDecl :: SrcInfo loc => GadtDecl loc -> GadtDecl
- sClassDecl :: SrcInfo loc => ClassDecl loc -> ClassDecl
- sInstDecl :: SrcInfo loc => InstDecl loc -> InstDecl
- sBangType :: BangType l -> BangType
- sRhs :: SrcInfo loc => Rhs loc -> Rhs
- sGuardedRhs :: SrcInfo loc => GuardedRhs loc -> GuardedRhs
- sType :: Type l -> Type
- sTyVarBind :: TyVarBind l -> TyVarBind
- sKind :: Kind l -> Kind
- sFunDep :: FunDep l -> FunDep
- sContext :: Context l -> Context
- sAsst :: Asst l -> Asst
- sLiteral :: Literal l -> Literal
- sExp :: SrcInfo loc => Exp loc -> Exp
- sXName :: XName l -> XName
- sXAttr :: SrcInfo loc => XAttr loc -> XAttr
- sBracket :: SrcInfo loc => Bracket loc -> Bracket
- sSplice :: SrcInfo loc => Splice loc -> Splice
- sSafety :: Safety l -> Safety
- sCallConv :: CallConv l -> CallConv
- sModulePragma :: SrcInfo loc => ModulePragma loc -> ModulePragma
- sActivation :: Activation l -> Activation
- sRule :: SrcInfo loc => Rule loc -> Rule
- sRuleVar :: RuleVar l -> RuleVar
- sWarningText :: WarningText l -> WarningText
- sPat :: SrcInfo loc => Pat loc -> Pat
- sPXAttr :: SrcInfo loc => PXAttr loc -> PXAttr
- sRPatOp :: RPatOp l -> RPatOp
- sRPat :: SrcInfo loc => RPat loc -> RPat
- sPatField :: SrcInfo loc => PatField loc -> PatField
- sStmt :: SrcInfo loc => Stmt loc -> Stmt
- sQualStmt :: SrcInfo loc => QualStmt loc -> QualStmt
- sFieldUpdate :: SrcInfo loc => FieldUpdate loc -> FieldUpdate
- sAlt :: SrcInfo loc => Alt loc -> Alt
- sGuardedAlts :: SrcInfo loc => GuardedAlts loc -> GuardedAlts
- sGuardedAlt :: SrcInfo loc => GuardedAlt loc -> GuardedAlt

# Documentation

sModule :: SrcInfo loc => Module loc -> Module

Translate an annotated AST node representing a Haskell module, into a simpler version that retains (almost) only abstract information. In particular, XML and hybrid XML pages enabled by the XmlSyntax extension are translated into standard Haskell modules with a `page` function.

sDecl :: SrcInfo loc => Decl loc -> Decl

Translate an annotated AST node representing a Haskell declaration into a simpler version. Note that in the simpler version, all declaration nodes are still annotated by `SrcLoc`s.

sAnnotation :: SrcInfo loc => Annotation loc -> Annotation

sModuleName :: ModuleName l -> ModuleName

sSpecialCon :: SpecialCon l -> SpecialCon

sQName :: QName l -> QName

sName :: Name l -> Name

sIPName :: IPName l -> IPName

sQOp :: QOp l -> QOp

sOp :: Op l -> Op

sCName :: CName l -> CName

sModuleHead :: Maybe (ModuleHead l) -> (ModuleName, Maybe WarningText, Maybe [ExportSpec])

sExportSpecList :: ExportSpecList l -> [ExportSpec]

sExportSpec :: ExportSpec l -> ExportSpec

sImportDecl :: SrcInfo loc => ImportDecl loc -> ImportDecl

sImportSpecList :: ImportSpecList l -> (Bool, [ImportSpec])

sImportSpec :: ImportSpec l -> ImportSpec

sAssoc :: Assoc l -> Assoc

sDeclHead :: DeclHead l -> (Name, [TyVarBind])

sInstHead :: InstHead l -> (QName, [Type])

sDataOrNew :: DataOrNew l -> DataOrNew

sDeriving :: Deriving l -> [(QName, [Type])]

sBinds :: SrcInfo loc => Binds loc -> Binds

sIPBind :: SrcInfo loc => IPBind loc -> IPBind

sMatch :: SrcInfo loc => Match loc -> Match

sQualConDecl :: SrcInfo loc => QualConDecl loc -> QualConDecl

sConDecl :: ConDecl l -> ConDecl

sFieldDecl :: FieldDecl l -> ([Name], BangType)

sGadtDecl :: SrcInfo loc => GadtDecl loc -> GadtDecl

sClassDecl :: SrcInfo loc => ClassDecl loc -> ClassDecl

sInstDecl :: SrcInfo loc => InstDecl loc -> InstDecl

sBangType :: BangType l -> BangType

sRhs :: SrcInfo loc => Rhs loc -> Rhs

sGuardedRhs :: SrcInfo loc => GuardedRhs loc -> GuardedRhs

sType :: Type l -> Type

sTyVarBind :: TyVarBind l -> TyVarBind

sKind :: Kind l -> Kind

sFunDep :: FunDep l -> FunDep

sContext :: Context l -> Context

sAsst :: Asst l -> Asst

sLiteral :: Literal l -> Literal

sExp :: SrcInfo loc => Exp loc -> Exp

sXName :: XName l -> XName

sXAttr :: SrcInfo loc => XAttr loc -> XAttr

sBracket :: SrcInfo loc => Bracket loc -> Bracket

sSplice :: SrcInfo loc => Splice loc -> Splice

sSafety :: Safety l -> Safety

sCallConv :: CallConv l -> CallConv

sModulePragma :: SrcInfo loc => ModulePragma loc -> ModulePragma

sActivation :: Activation l -> Activation

sRule :: SrcInfo loc => Rule loc -> Rule

sRuleVar :: RuleVar l -> RuleVar

sWarningText :: WarningText l -> WarningText

sPat :: SrcInfo loc => Pat loc -> Pat

sPXAttr :: SrcInfo loc => PXAttr loc -> PXAttr

sRPatOp :: RPatOp l -> RPatOp

sRPat :: SrcInfo loc => RPat loc -> RPat

sPatField :: SrcInfo loc => PatField loc -> PatField

sStmt :: SrcInfo loc => Stmt loc -> Stmt

sQualStmt :: SrcInfo loc => QualStmt loc -> QualStmt

sFieldUpdate :: SrcInfo loc => FieldUpdate loc -> FieldUpdate

sAlt :: SrcInfo loc => Alt loc -> Alt

sGuardedAlts :: SrcInfo loc => GuardedAlts loc -> GuardedAlts

sGuardedAlt :: SrcInfo loc => GuardedAlt loc -> GuardedAlt