2

What is the correct idiom for assignments in Haddock REPL examples? Specifically, should I use let

>>> let x = 5
>>> x + 2
7

(as is — still — expected by GHCi) or omit it

>>> x = 5
>>> x + 2
7

(as I can in IHaskell)?

4

1 回答 1

7

我相信您应该为 GHCi 编写代码片段,这实际上是标准的 REPL。就目前而言,这意味着使用let. 有点武断的例子:Control.Foldl文档(Gabriella Gonzalez 的图书馆提供了很好的“黑线鳕做得好”的例子)。

于 2015-09-22T21:00:37.787 回答