roc/test/snapshots/expr/lambda_simple.md
2025-11-23 01:22:01 -05:00

45 lines
629 B
Markdown

# META
~~~ini
description=Lambda expression
type=expr
~~~
# SOURCE
~~~roc
|x| x + 1
~~~
# EXPECTED
NIL
# PROBLEMS
NIL
# TOKENS
~~~zig
OpBar,LowerIdent,OpBar,LowerIdent,OpPlus,Int,
EndOfFile,
~~~
# PARSE
~~~clojure
(e-lambda
(args
(p-ident (raw "x")))
(e-binop (op "+")
(e-ident (raw "x"))
(e-int (raw "1"))))
~~~
# FORMATTED
~~~roc
NO CHANGE
~~~
# CANONICALIZE
~~~clojure
(e-lambda
(args
(p-assign (ident "x")))
(e-binop (op "add")
(e-lookup-local
(p-assign (ident "x")))
(e-num (value "1"))))
~~~
# TYPES
~~~clojure
(expr (type "a -> a where [a.from_numeral : Numeral -> Try(a, [InvalidNumeral(Str)])]"))
~~~