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