stil4m/elm-syntax/7.2.1

NOTE: the latest version is 7.3.9

Elm.Syntax.Declaration

Declarations Syntax

Syntax for the different top-level declarations in Elm. These can be one of the following (all declared in Declaration):

  • Functions: add x y = x + y
  • Custom types: type Color = Blue | Red
  • Type aliases: type alias Status = Int
  • Port declaration: port sendMessage: String -> Cmd msg
  • Destructuring: {name, age} = person
  • Infix declarations. You will probably not need this, while only core packages can define these.

Types

= FunctionDeclaration Function
| AliasDeclaration TypeAlias
| CustomTypeDeclaration Type
| PortDeclaration Signature
| InfixDeclaration Infix
| Destructuring (Node Pattern) (Node Expression)

Custom type that represents all different top-level declarations.

Serialization

encode : Declaration -> Value

Encode a Declaration syntax element to JSON.

JSON decoder for a Declaration syntax element.