haskell-tools-ast-1.1.1.0: Haskell AST for efficient tooling

Safe HaskellNone
LanguageHaskell2010

Language.Haskell.Tools.AST.Helpers

Contents

Description

Helper functions for using the AST.

Synopsis

Documentation

importIsExact :: Ann UImportDecl dom stage -> Bool Source #

Does the import declaration import only the explicitly listed elements?

importIsHiding :: Ann UImportDecl dom stage -> Bool Source #

Does the import declaration import all elements that are not excluded explicitly?

bindingName :: Simple Traversal (Ann UValueBind dom stage) (Ann UQualifiedName dom stage) Source #

Accesses the name of a function or value binding

declHeadNames :: Simple Traversal (Ann UDeclHead dom stage) (Ann UQualifiedName dom stage) Source #

Accesses that name of a declaration through the declaration head.

typeParams :: Simple Traversal (Ann UType dom stage) (Ann UType dom stage) Source #

A reference to access type arguments to a type constructor call that may be universally qualified or parenthesized.

valBindPats :: Simple Traversal (Ann UValueBind dom stage) (Ann UPattern dom stage) Source #

semantics :: Simple Lens (Ann elem dom stage) (SemanticInfo dom elem) Source #

Access the semantic information of an AST node.

nodesContaining :: (HasRange (inner dom stage), Biplate (node dom stage) (inner dom stage)) => RealSrcSpan -> Simple Traversal (node dom stage) (inner dom stage) Source #

Get all nodes that contain a given source range

isInside :: HasRange (inner dom stage) => RealSrcSpan -> inner dom stage -> Bool Source #

Return true if the node contains a given range

nodesContained :: (HasRange (inner dom stage), Biplate (node dom stage) (inner dom stage)) => RealSrcSpan -> Simple Traversal (node dom stage) (inner dom stage) Source #

Get all nodes that are contained in a given source range

isContained :: HasRange (inner dom stage) => RealSrcSpan -> inner dom stage -> Bool Source #

Return true if the node contains a given range

nodesWithRange :: (Biplate (Ann node dom stage) (Ann inner dom stage), SourceInfo stage) => RealSrcSpan -> Simple Traversal (Ann node dom stage) (Ann inner dom stage) Source #

Get the nodes that have exactly the given range

getNodeContaining :: (Biplate (Ann node dom stage) (Ann inner dom stage), SourceInfo stage, HasRange (Ann inner dom stage)) => RealSrcSpan -> Ann node dom stage -> Maybe (Ann inner dom stage) Source #

Get the shortest source range that contains the given

compareRangeLength :: SrcSpan -> SrcSpan -> Ordering Source #

Compares two source spans based on their lengths. Can only used for NESTED spans.

class NamedElement elem where Source #

A class to access the names of named elements. Have to locate where does the AST element store its name. The returned name will be the one that was marked isDefining.

Methods

elementName :: Simple Traversal (Ann elem dom st) (Ann UQualifiedName dom st) Source #

Instances
NamedElement ULocalBind Source # 
Instance details

Defined in Language.Haskell.Tools.AST.Helpers

Methods

elementName :: Simple Traversal (Ann ULocalBind dom st) (Ann UQualifiedName dom st) Source #

NamedElement UDecl Source # 
Instance details

Defined in Language.Haskell.Tools.AST.Helpers

Methods

elementName :: Simple Traversal (Ann UDecl dom st) (Ann UQualifiedName dom st) Source #

Pattern synonyms for annotated lists and maybes

pattern AnnList :: [Ann elem dom stage] -> AnnListG elem dom stage Source #

pattern AnnNothing :: AnnMaybeG elem dom stage Source #

pattern AnnJust :: Ann elem dom stage -> AnnMaybeG elem dom stage Source #