stil4m/elm-syntax/7.0.4

NOTE: the latest version is 7.3.9

Elm.Syntax.Expression

Expression Syntax

This syntax represens all that you can express in Elm. Although it is a easy and simple language, you can express a lot! See the Expression type for all the things you can express.

Types

= UnitExpr
| Application (List (Node Expression))
| OperatorApplication
String
| FunctionOrValue ModuleName String
| PrefixOperator String
| Operator String
| Integer Int
| Hex Int
| Floatable Float
| Negation (Node Expression)
| Literal String
| CharLiteral Char
| TupledExpression (List (Node Expression))
| ParenthesizedExpression (Node Expression)
| LetExpression LetBlock
| CaseExpression CaseBlock
| LambdaExpression Lambda
| RecordExpr (List (Node RecordSetter))
| ListExpr (List (Node Expression))
| RecordAccess (Node Expression) (Node String)
| RecordAccessFunction String
| RecordUpdateExpression (Node String) (List (Node RecordSetter))
| GLSLExpression String

Wrapper type for an expresion on a certain range

type alias Lambda =
{ args : List (Node Pattern)
, expression : Node Expression
}

Expression for a lambda

type alias LetBlock =
{ declarations : List (Node LetDeclaration)
, expression : Node Expression
}

Expression for a let block

= LetFunction Function
| LetDestructuring (Node Pattern) (Node Expression)

Union type for all possible declations in a let block

type alias RecordSetter =
( Node String, Node Expression )

Expression for setting a record field

type alias CaseBlock =
{ expression : Node Expression
, cases : Cases
}

Expression for a case block

type alias Cases =
List Case

Type alias for a list of cases

type alias Case =

A case in a case block

type alias Function =
{ documentation : Maybe (Node Documentation)
, signature : Maybe (Node Signature)
, declaration : Node FunctionImplementation
}

Type alias for a full function

{ name : Node String
, arguments : List (Node Pattern)
, expression : Node Expression
}

Type alias for a function's implementation

Functions

functionRange : Function -> Range

Get the full range of a function

Check whether an expression is a lambda-expression

isLet : Expression -> Bool

Check whether an expression is a let-expression

Check whether an expression is an if-else-expression

isCase : Expression -> Bool

Check whether an expression is a case-expression

Check whether an expression is an operator appliation expression

Serialization

encode : Expression -> Value

Encode an Expression syntax element to JSON.

encodeFunction : Function -> Value

Encode a Function syntax element to JSON.

JSON decoder for an Expression syntax element.

functionDecoder : Decoder Function

JSON decoder for an Function syntax element.