Haddock: inserting interactive sessions in the documentation
Hi. What is the suggested (if any) convention for inserting an interactive session in the documentation? Right know I'm doing (in random-shuffle package): -- |Convert a sequence @(e1...en)@ to a complete binary tree. -- -- @ -- System.Random.Shuffle> buildTree ['a','b','c','d','e'] -- Node 5 (Node 4 (Node 2 (Leaf 'a') (Leaf 'b')) -- (Node 2 (Leaf 'c') (Leaf 'd'))) -- (Leaf 'e') -- @ buildTree :: [a] -> Tree a As an example, in Python we use """
3 + 2 5 """
One nice feature of this special syntax is that it can be parsed, using doctest. Thanks Manlio
What is the suggested (if any) convention for inserting an interactive session in the documentation?
You may want to look at: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/DocTest Wouter
Wouter Swierstra ha scritto:
What is the suggested (if any) convention for inserting an interactive session in the documentation?
You may want to look at:
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/DocTest
Ah, ok, thanks. So convention is to just use `-- >`. Manlio
participants (2)
-
Manlio Perillo -
Wouter Swierstra