GraphQL v0.2.0 GraphQL.Lang.AST.Visitor protocol

Implementations of Visitor are used by the ASTReducer to transform a GraphQL AST into an arbitrary value.

The value can be the result of validations, or a transformation of the AST into a new AST, for example.

The fallback implementations of ‘enter’ and ‘leave’ return the accumulator untouched.

Summary

Functions

Called when entering a node of the AST

Called when leaving a node of the AST

Types

t :: term

Functions

enter(visitor, node, accumulator)

Called when entering a node of the AST.

The return value should be:

{next_action, acc}

where next_action is either :break or :continue and acc is the new value of the accumulator.

:break will abort the visitor and AST traversal will cease returning the current value of the accumulator.

leave(visitor, node, accumulator)

Called when leaving a node of the AST.

The return value should be:

{next_action, acc}

where next_action is either :break or :continue and acc is the new value of the accumulator.

:break will abort the visitor and AST traversal will cease returning the current value of the accumulator.