ast-path-0.2.0: vocabulary representation for predicting program properties

Safe HaskellSafe
LanguageHaskell2010

Data.ASTPath

Description

AST-path is a representation for predicting program properties.

Synopsis

Documentation

type ASTPath = (String, HalfPath, HalfPath) Source #

(top node, [..., start node], [..., end node])

astPath :: AST a => a -> [ASTPath] Source #

Generate AST-paths from tree.

class AST a where Source #

Typeclass for tree or terminal node.

Minimal complete definition

astPathWithHalf

Methods

astPathWithHalf Source #

Arguments

:: a

current tree

-> String

label of current root node

-> ([ASTPath], [HalfPath])

paths and half paths

Generate paths and half paths for recursion.

astPathWithHalf Source #

Arguments

:: (Generic a, AST' (Rep a)) 
=> a

current tree

-> String

label of current root node

-> ([ASTPath], [HalfPath])

paths and half paths

Generate paths and half paths for recursion.

Instances
AST a => AST [a] Source #

Constructor of list type is ignored, same as generic product type. Hence list type itself cannot be used with astPath. If want to use, supply root node label.

Instance details

Defined in Data.ASTPath

Methods

astPathWithHalf :: [a] -> String -> ([ASTPath], [HalfPath]) Source #

treePath :: forall a. (Generic a, AST' (Rep a)) => a -> String -> ([ASTPath], [HalfPath]) Source #

Default implementation for tree type.

terminalPath :: (a -> String) -> a -> String -> ([ASTPath], [HalfPath]) Source #

Typical implementation for terminal node type.

nullPath :: a -> String -> ([ASTPath], [HalfPath]) Source #

No path implementation for auxiliary data type.

class AST' f where Source #

Class of generic representation types that can be parsed into paths.

Methods

astPathWithHalf' :: f a -> String -> ([ASTPath], [HalfPath]) Source #

Default implementation for generic instances of AST.

Instances
AST' (V1 :: Type -> Type) Source # 
Instance details

Defined in Data.ASTPath

Methods

astPathWithHalf' :: V1 a -> String -> ([ASTPath], [HalfPath]) Source #

AST' (U1 :: Type -> Type) Source # 
Instance details

Defined in Data.ASTPath

Methods

astPathWithHalf' :: U1 a -> String -> ([ASTPath], [HalfPath]) Source #

AST a => AST' (K1 i a :: Type -> Type) Source # 
Instance details

Defined in Data.ASTPath

Methods

astPathWithHalf' :: K1 i a a0 -> String -> ([ASTPath], [HalfPath]) Source #

(AST' f, AST' g) => AST' (f :+: g) Source # 
Instance details

Defined in Data.ASTPath

Methods

astPathWithHalf' :: (f :+: g) a -> String -> ([ASTPath], [HalfPath]) Source #

(AST' f, AST' g) => AST' (f :*: g) Source # 
Instance details

Defined in Data.ASTPath

Methods

astPathWithHalf' :: (f :*: g) a -> String -> ([ASTPath], [HalfPath]) Source #

(AST' f, Datatype d) => AST' (D1 d f) Source # 
Instance details

Defined in Data.ASTPath

Methods

astPathWithHalf' :: D1 d f a -> String -> ([ASTPath], [HalfPath]) Source #

(AST' f, Constructor c) => AST' (C1 c f) Source # 
Instance details

Defined in Data.ASTPath

Methods

astPathWithHalf' :: C1 c f a -> String -> ([ASTPath], [HalfPath]) Source #

(AST' f, Selector s) => AST' (S1 s f) Source # 
Instance details

Defined in Data.ASTPath

Methods

astPathWithHalf' :: S1 s f a -> String -> ([ASTPath], [HalfPath]) Source #