
17 Oct
2009
17 Oct
'09
3:29 p.m.
Excerpts from Andrew Coppin's message of Sat Oct 17 15:21:28 -0400 2009:
Suppose we have
newtype Foo x instance Monad Foo runFoo :: Foo x -> IO x
What sort of things can I do to check that I actually implemented this correctly? I mean, ignoring what makes Foo special for a moment, how can I check that it works correctly as a monad.
A proper monad obeys the monad laws: http://www.haskell.org/haskellwiki/Monad_Laws You can probably cook up some quickcheck properties to test for these, but really you should be able to convince yourself by inspection that your monad follows these laws. Cheers, Edward