Fabian Ruch
unread,Feb 10, 2015, 2:42:58 PM2/10/15Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to af...@googlegroups.com
Hi,
during today's question time two or three groups asked me what the lab
description means when it says "Replace the IO monad with a State
monad". I promised an answer by e-mail because I hadn't read the
assignment carefully enough before and the queue for answers was
unexpectedly long today.
The others will hopefully correct me if I'm wrong, but this task is only
concerned with the testing framework and the task is not to replace the
IO monad in the definition of `Replay`, which probably caused the confusion.
Instead, you would like to automatically check your implementation using
QuickCheck. A quick look at the provided `Test.hs` reveals that a test
function `checkTestCase` has already been defined but doesn't have the
right type to be `Testable`. In fact, the test result is wrapped up in
the IO monad because the testing framework uses a variable to count the
number of times a `tick` function is called by the tested programs.
To answer your question, the task is to use the generalised interface
and change the underlying monad so that `tick` invocations can be
counted without forcing `checkTestCase` into having a monadic return type.
Hope that helps,
Fabian