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)?

orome
  • 45,163
  • 57
  • 202
  • 418

1 Answers1

7

I believe you should write your snippets for GHCi, which de facto is the standard REPL. As it stands, that means using let. Somewhat arbitrary example: Control.Foldl documentation (libraries by Gabriella Gonzalez provide good examples of "haddocks done right").

duplode
  • 33,731
  • 7
  • 79
  • 150