scion-0.1.0.1: Haskell IDE librarySource codeContentsIndex
Scion.Inspect.Find
Portabilityportable
Stabilityexperimental
Maintainernominolo@gmail.com
Description
Find things in a syntax tree.
Synopsis
findHsThing :: Search id a => (SrcSpan -> Bool) -> a -> SearchResults id
data SearchResult id
= FoundBind SrcSpan (HsBind id)
| FoundPat SrcSpan (Pat id)
| FoundType SrcSpan (HsType id)
| FoundExpr SrcSpan (HsExpr id)
| FoundStmt SrcSpan (Stmt id)
| FoundId Id
| FoundName Name
| FoundCon SrcSpan DataCon
| FoundLit SrcSpan HsLit
type SearchResults id = PosForest (SearchResult id)
data PosTree a = Node {
val :: a
children :: PosForest a
}
type PosForest a = Set (PosTree a)
deepestLeaf :: Ord a => PosTree a -> a
pathToDeepest :: Ord a => PosForest a -> Maybe (a, [a])
surrounds :: SrcSpan -> SrcSpan -> Bool
overlaps :: SrcSpan -> SrcSpan -> Bool
Documentation
findHsThing :: Search id a => (SrcSpan -> Bool) -> a -> SearchResults idSource
Lookup all the things in a certain region.
data SearchResult id Source
Constructors
FoundBind SrcSpan (HsBind id)
FoundPat SrcSpan (Pat id)
FoundType SrcSpan (HsType id)
FoundExpr SrcSpan (HsExpr id)
FoundStmt SrcSpan (Stmt id)
FoundId Id
FoundName Name
FoundCon SrcSpan DataCon
FoundLit SrcSpan HsLit
show/hide Instances
type SearchResults id = PosForest (SearchResult id)Source
data PosTree a Source
Constructors
Node
val :: a
children :: PosForest a
show/hide Instances
type PosForest a = Set (PosTree a)Source
deepestLeaf :: Ord a => PosTree a -> aSource
pathToDeepest :: Ord a => PosForest a -> Maybe (a, [a])Source
Returns the deepest leaf, together with the path to this leaf. For example, for the following tree with root A: A -+- B --- C '- D --- E --- F this function will return: (F, [E, D, A]) If F were missing the result is either (C, [B,A]) or (E, [D,A]).
surrounds :: SrcSpan -> SrcSpan -> BoolSource
overlaps :: SrcSpan -> SrcSpan -> BoolSource
Produced by Haddock version 2.4.2