type Expr meta
= Expr meta (ExprF (Expr meta))
Represents an expression node in an AST with some accompanying metadata. We
might have Expr Type
to represent a typed expression, or Expr Span
to know
where an expression exists in the source code.
type ExprF expr
= Access expr (List String)
| Application expr (List expr)
| Annotation expr Ren.Data.Type.Type
| Block (List ( String, expr )) expr
| Conditional expr expr expr
| Error (Maybe Error)
| Identifier Identifier
| Infix Operator expr expr
| Lambda (List Pattern) expr
| Literal (Literal expr)
| Match expr (List ( Pattern, Maybe expr, expr ))
type Error = MissingElement
| MissingSymbol String
| UnexpectedSymbol String
type Identifier = Local String
| Scoped String Identifier
| Placeholder (Maybe String)
type Literal expr
= Array (List expr)
| Boolean Basics.Bool
| Number Basics.Float
| Record (List ( String, expr ))
| String String
| Template (List (Data.Either.Either String expr))
| Undefined
| Variant String (List expr)
type Operator = Pipe
| Compose
| Add
| Sub
| Mul
| Div
| Pow
| Mod
| Eq
| NotEq
| Lt
| Lte
| Gt
| Gte
| And
| Or
| Cons
| Join
type Pattern = ArrayDestructure (List Pattern)
| LiteralPattern (Literal Basics.Never)
| Name String
| RecordDestructure (List ( String, Maybe Pattern ))
| Spread String
| TemplateDestructure (List (Data.Either.Either String Pattern))
| Typeof String Pattern
| VariantDestructure String (List Pattern)
| Wildcard (Maybe String)
annotation : Expr meta -> meta
references : Identifier -> Expr meta -> Basics.Bool
shadows : Identifier -> Expr meta -> Basics.Bool
bound : Pattern -> List String
binds : String -> Pattern -> Basics.Bool
Checks to see if a Pattern introduces a new binding with a name that matches
the argument. This is necessary in, for example, the references
check because
a binding may shadow the name we're checking is referenced and we don't want a
false positive.
map : (a -> b) -> ExprF a -> ExprF b
mapAnnotation : (a -> b) -> Expr a -> Expr b
erase : Expr a -> Expr ()
wrap : meta -> ExprF (Expr meta) -> Expr meta
unwrap : Expr meta -> ExprF (Expr meta)
cata : (meta -> ExprF a -> a) -> Expr meta -> a
para : (ExprF ( Expr meta, a ) -> a) -> Expr meta -> a
coerceToNumber : ExprF a -> Maybe Basics.Float
coerceToBoolean : ExprF a -> Maybe Basics.Bool
internalOperatorName : Operator -> String