stil4m / elm-syntax / Elm.Syntax.Node

Represents a Node of the AST (Abstract Syntax Tree).

The purpose of this type is to add the information of the Range, i.e. where in the source code the element of the tree was found.

Types


type Node a
    = Node Elm.Syntax.Range.Range a

Base representation for a syntax node in a source file.

Functions

empty : a -> Node a

Create a Node with an empty range.

combine : (Node a -> Node b -> c) -> Node a -> Node b -> Node c

Combine two nodes, constructing a new node which will have the outer most range of the child nodes

range : Node a -> Elm.Syntax.Range.Range

Extract the range out of a Node a

value : Node a -> a

Extract the value (a) out of a Node a

map : (a -> b) -> Node a -> Node b

Map the value within a node leaving the range untouched

Serialization

encode : (a -> Json.Encode.Value) -> Node a -> Json.Encode.Value

Encode a Node into JSON

decoder : Json.Decode.Decoder a -> Json.Decode.Decoder (Node a)

A JSON decoder for Node