我可以用dhall --file ...计算dhall表达式,也可以在repl中计算1 + 1,但是在dhall repl中键入let表达式会失败,“输入的意外结束”。
➜ cat test.dhall
let x = 1
let y = 2
in x + y
➜ ~ dhall --file test.dhall
3
➜ ~ dhall repl
Welcome to the Dhall v1.41.0 REPL! Type :help for more information.
⊢ let x = 1
Error: Invalid input
(input):2:1:
|
2 | <empty line>
| ^
unexpected end of input
expecting "→", ->, :, keyword, or whitespace
⊢ 1 + 1
2发布于 2022-02-22 23:01:53
let x = 1本身不是一个有效的表达式。let ... in ...表达式的结构可以从一个或多个let子句开始,但必须以in子句结尾。
如果您只想在REPL中设置一个值,则需要使用特殊的:let命令(它是特定于REPL的,而不是语言的一部分)。
⊢ :let x = 1
x : Natural
⊢ x + 1
2https://stackoverflow.com/questions/71229351
复制相似问题