Elm.CodeGen is a DSL designed to make it easier to write Elm code that generates Elm code.
Documentation is just Strings.
A module name can consist of mulitple Stirngs separated with '.'.
The AST for an Elm module.
The AST for an Elm file.
The AST for a top-level Elm declaration; a function, a value, a type or a type alias.
The AST for an Elm import statement.
The AST for an Elm type annotation.
The AST for an Elm exposing statement.
The AST for a member of an Elm exposing statement.
The AST for an Elm expression.
The AST for a de-structuring Elm pattern matching expression.
Assembles all the components of an Elm file; the module declaration, the comments, the imports and the top-level declarations.
NormalModule DefaultModuleData
PortModule DefaultModuleData
All Range
Explicit (List (Node TopLevelExpose))
InfixExpose String
FunctionExpose String
TypeOrAliasExpose String
TypeExpose ExposedType
Creates an exposing member for a type, exposing all of the types constructors.
Creates an exposing member for an opaque type, exposing none of its constructors.
Creates an Elm import statement; the name of the module, an optional alias name for the module, and an optional list of exposings from the module.
This is useful during code generation where the exact imports and exports are not known in advance but depend on what code is actually generated. Each section of code generation can declare the imports and exposings that it needs and they can be combined and de-duplicated to produce a final list.
Captures lists of imports and exposings of a module, allowing these to be built up dynamically as code generation progresses.
Simplifies the imports and exposings by removing any duplicates.
Creates empty imports and exposings lists.
Adds an import to the list.
Adds an exposing to the list.
FunctionDeclaration Function
AliasDeclaration TypeAlias
CustomTypeDeclaration Type
PortDeclaration Signature
Destructuring (Node Pattern) (Node Expression)
Creates a type signature.
Joins multiple expressions together with the pipe operator |>. An
expression a combined with a list of expressions [b, c, d] results in:
a |> b |> c |> dJoins multiple expressions together with the function chain operator >>. An
expression a combined with a list of expressions [b, c, d] results in:
a >> b >> c >> dUnitExpr
Application (List (Node Expression))
OperatorApplication String InfixDirection (Node Expression) (Node Expression)
FunctionOrValue ModuleName String
Creates a FunctionOrValue with no qualifiying module.
IfBlock (Node Expression) (Node Expression) (Node Expression)
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
AllPattern
UnitPattern
CharPattern Char
StringPattern String
IntPattern Int
HexPattern Int
FloatPattern Float
TuplePattern (List (Node Pattern))
RecordPattern (List (Node String))
UnConsPattern (Node Pattern) (Node Pattern)
ListPattern (List (Node Pattern))
VarPattern String
NamedPattern QualifiedNameRef (List (Node Pattern))
AsPattern (Node Pattern) (Node String)
ParenthesizedPattern (Node Pattern)
GenericType String
Typed (Node ( ModuleName, String )) (List (Node TypeAnnotation))
Unit
Tupled (List (Node TypeAnnotation))
Record RecordDefinition
GenericRecord (Node String) (Node RecordDefinition)
FunctionTypeAnnotation (Node TypeAnnotation) (Node TypeAnnotation)
Comments are just Strings.