Language.Haskell.Exts.Annotated.Simplify

haskell-src-exts-1.17.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
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
- sPatSyn :: SrcInfo l => PatternSynDirection l -> PatternSynDirection
- sTypeEqn :: SrcInfo l => TypeEqn l -> TypeEqn
- sAnnotation :: SrcInfo loc => Annotation loc -> Annotation
- sBooleanFormula :: SrcInfo loc => BooleanFormula loc -> BooleanFormula
- sRole :: Role l -> Role
- 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])
- sNamespace :: Namespace l -> Namespace
- sImportSpec :: ImportSpec l -> ImportSpec
- sAssoc :: Assoc l -> Assoc
- sDeclHead :: DeclHead l -> (Name, [TyVarBind])
- sInstRule :: SrcInfo l => InstRule l -> ([TyVarBind], [Asst], (QName, [Type]))
- sInstHead :: SrcInfo l => InstHead l -> (QName, [Type])
- sDataOrNew :: DataOrNew l -> DataOrNew
- sDeriving :: SrcInfo l => 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 :: SrcInfo l => ConDecl l -> ConDecl
- sFieldDecl :: SrcInfo l => FieldDecl l -> ([Name], Type)
- sGadtDecl :: SrcInfo loc => GadtDecl loc -> GadtDecl
- sClassDecl :: SrcInfo loc => ClassDecl loc -> ClassDecl
- sRecFields :: SrcInfo l => [FieldDecl l] -> [([Name], Type)]
- sInstDecl :: SrcInfo loc => InstDecl loc -> InstDecl
- sBangType :: SrcInfo l => BangType l -> BangType
- sRhs :: SrcInfo loc => Rhs loc -> Rhs
- sGuardedRhs :: SrcInfo loc => GuardedRhs loc -> GuardedRhs
- sType :: SrcInfo l => Type l -> Type
- sPromoted :: SrcInfo l => Promoted l -> Promoted
- sTyVarBind :: TyVarBind l -> TyVarBind
- sKind :: Kind l -> Kind
- sFunDep :: FunDep l -> FunDep
- sContext :: SrcInfo l => Context l -> Context
- sAsst :: SrcInfo l => Asst l -> Asst
- sLiteral :: Literal l -> Literal
- sSign :: Sign l -> Sign
- 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
- sOverlap :: SrcInfo loc => Overlap loc -> Overlap
- sActivation :: Activation l -> Activation
- sRule :: SrcInfo loc => Rule loc -> Rule
- sRuleVar :: SrcInfo l => 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

# 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.

sPatSyn :: SrcInfo l => PatternSynDirection l -> PatternSynDirection

sTypeEqn :: SrcInfo l => TypeEqn l -> TypeEqn

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

sBooleanFormula :: SrcInfo loc => BooleanFormula loc -> BooleanFormula

sRole :: Role l -> Role

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])

sNamespace :: Namespace l -> Namespace

sImportSpec :: ImportSpec l -> ImportSpec

sAssoc :: Assoc l -> Assoc

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

sInstRule :: SrcInfo l => InstRule l -> ([TyVarBind], [Asst], (QName, [Type]))

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

sDataOrNew :: DataOrNew l -> DataOrNew

sDeriving :: SrcInfo l => 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 :: SrcInfo l => ConDecl l -> ConDecl

sFieldDecl :: SrcInfo l => FieldDecl l -> ([Name], Type)

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

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

sRecFields :: SrcInfo l => [FieldDecl l] -> [([Name], Type)]

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

sBangType :: SrcInfo l => BangType l -> BangType

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

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

sType :: SrcInfo l => Type l -> Type

sPromoted :: SrcInfo l => Promoted l -> Promoted

sTyVarBind :: TyVarBind l -> TyVarBind

sKind :: Kind l -> Kind

sFunDep :: FunDep l -> FunDep

sContext :: SrcInfo l => Context l -> Context

sAsst :: SrcInfo l => Asst l -> Asst

sLiteral :: Literal l -> Literal

sSign :: Sign l -> Sign

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

sOverlap :: SrcInfo loc => Overlap loc -> Overlap

sActivation :: Activation l -> Activation

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

sRuleVar :: SrcInfo l => 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