Any good tool to write Haskell documents including tests?

Hello, I have been a forgetful person, and lots of things I have only pretended to understand. I want to change this. So, to educate myself, I'd like to write documented tests for many libraries I meet, and also publish them onto the web so that others may find them useful or find mistakes for me. OK, blog articles are good, but they have no (forced) tests. Maybe some of you have practiced this or developping such tools. I see some candidate tools, too. What is your suggestion for this? I have tried doctest, because of its read–eval–print loop (REPL) style I liked. https://github.com/nushio3/practice/tree/master/control-monad-loop It produces html as attached to this mail. It's pretty, but I'd like to have more control on HTML. Maybe Gitit + Doctest in Pandoc is a good alternative? I'd also like to know what is a good way to publish a small executable examples with automated dependency install capability. Can you point out any problems with following Makefile + cabal ? What are better ways to do this? https://github.com/nushio3/practice/blob/master/control-monad-loop/Loop.caba... https://github.com/nushio3/practice/blob/master/control-monad-loop/Makefile Thanks in advance, -- Takayuki MURANUSHI The Hakubi Center for Advanced Research, Kyoto University http://www.hakubi.kyoto-u.ac.jp/02_mem/h22/muranushi.html

On 10/07/2012, Takayuki Muranushi
Hello,
I have been a forgetful person, and lots of things I have only pretended to understand. I want to change this. So, to educate myself, I'd like to write documented tests for many libraries I meet, and also publish them onto the web so that others may find them useful or find mistakes for me. OK, blog articles are good, but they have no (forced) tests.
Maybe some of you have practiced this or developping such tools. I see some candidate tools, too. What is your suggestion for this?
I like SmallCheck myself. Define testable properties of the library, and SmallCheck will verify them for all cases to a given depth. The tests can be documented with Haddock like any Haskell code. http://hackage.haskell.org/package/smallcheck Another similar option is QuickCheck, which will randomly generate rather than enumerate. http://hackage.haskell.org/package/QuickCheck Cheers, Strake

Thank you for your quick response!
I have used QuickCheck, but SmallCheck I didn't. Thank you! Then I'll
try to build such tests into Gitit.
2012/7/11 Strake
On 10/07/2012, Takayuki Muranushi
wrote: Hello,
I have been a forgetful person, and lots of things I have only pretended to understand. I want to change this. So, to educate myself, I'd like to write documented tests for many libraries I meet, and also publish them onto the web so that others may find them useful or find mistakes for me. OK, blog articles are good, but they have no (forced) tests.
Maybe some of you have practiced this or developping such tools. I see some candidate tools, too. What is your suggestion for this?
I like SmallCheck myself. Define testable properties of the library, and SmallCheck will verify them for all cases to a given depth. The tests can be documented with Haddock like any Haskell code.
http://hackage.haskell.org/package/smallcheck
Another similar option is QuickCheck, which will randomly generate rather than enumerate.
http://hackage.haskell.org/package/QuickCheck
Cheers, Strake
-- Takayuki MURANUSHI The Hakubi Center for Advanced Research, Kyoto University http://www.hakubi.kyoto-u.ac.jp/02_mem/h22/muranushi.html

On 07/10/12 10:20, Takayuki Muranushi wrote:
Hello,
I have been a forgetful person, and lots of things I have only pretended to understand. I want to change this. So, to educate myself, I'd like to write documented tests for many libraries I meet, and also publish them onto the web so that others may find them useful or find mistakes for me. OK, blog articles are good, but they have no (forced) tests.
Maybe some of you have practiced this or developping such tools. I see some candidate tools, too. What is your suggestion for this?
I have tried doctest, because of its read–eval–print loop (REPL) style I liked.
https://github.com/nushio3/practice/tree/master/control-monad-loop
It produces html as attached to this mail. It's pretty, but I'd like to have more control on HTML. Maybe Gitit + Doctest in Pandoc is a good alternative?
I know this isn't what you asked for, but: please submit these tests upstream when you're done. The lack of basic examples for library functions is a huge barrier-to-entry for almost every library on hackage. I think it would be a big help -- the fact that the code actually executes and can be checked automatically makes it easy for the maintainer to include them.
participants (3)
-
Michael Orlitzky
-
Strake
-
Takayuki Muranushi