关闭。这个问题是opinion-based .它目前不接受答案。
想改进这个问题?更新问题,以便 editing this post 可以用事实和引用来回答它.
2年前关闭。
Improve this question
它...有点工作你们(这绝对编译,改编自 https://hackage.haskell.org/package/scotty ):
main :: IO ()
main = (do
(putStrLn "Starting Server....")
(scotty 3000 (do
(get "/hello/:name"
(text ("hello " <> (param "name") <> "!")))
(get "/users"
(json allUsers))
(get "/users/:id"
(json (filter (matchesId (param "id")) allUsers))))))
(我不知道足够的 haskell 将
<>
转换为简单的括号,但聪明的人可以轻松。)我们为什么要这样做?我们可以使用任何 lisp 宏引擎对 Haskell 进行预处理!琐碎!。
想象一下。 HASKELL 和 LISP 在一起。我们可以统治银河!
(我知道你的想法,但我实际上已经考虑过了:在这个例子中,Vader 是 Lisp,Luke 是 Haskell,Yoda 是 Alonzo Church)
(编辑“感谢所有回答和评论的人,我现在聪明多了。
我认为这种技术的最大问题还没有被提及,并且被 friend IRL 指出:如果你编写一些 lispy 预处理器,你会失去 IDE 和工具中的类型检查和语法突出显示和理解。这听起来像是我的一个硬传球。”
“我现在关注 https://github.com/finkel-lang/finkel 项目,这是我想要的 lisp 风格的 haskell 项目!”)
最佳答案
Haskell 的语法是 historically derived来自 ISWIM ,一种出现在 LISP 之后不久的语言,在 Peter J. Landin 的 1966 年文章 The Next 700 Programming Languages 中进行了描述.
第 6 节专门讨论与 LISP 的关系:
ISWIM can be looked on as an attempt to deliver LISP from its eponymous commitment to lists, its reputation for hand-to-mouth storage allocation, the hardware dependent flavor of its pedagogy, its heavy bracketing, and its compromises with tradition.
稍后在同一部分:
The textual appearance of ISWIM is not like LISP's S-expressions. It is nearer to LISP's M-expressions (which constitute an informal language used as an intermediate result in hand-preparing LISP programs). ISWIM has the following additional features: [...]
因此,有明确的意图偏离 LISP 语法,或者至少偏离 S 表达式。
关于haskell - 为什么我们不用 LISP 语法编写 haskell 呢? (我们可以!),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60464090/