I myself am fairly new to Haskell and I'm trying to understand Monads better myself, but maybe this could help?
http://user.cs.tu-berlin.de/~magr/pub/Transformers.en.html
It's a little out of date and won't compile cleanly on newer instances of GHC without changing all the instances of Map.lookup ... to return $ fromJust Map.lookup, but once you make that small change it works fine.
Also, I'm not familiar with the QuickCheck package, but I browsed through it quickly and Test.QuickCheck.Monadic caught my eye. Perhaps a State or StateT combined with IdM or PropertyM would do what you want?

On Tue, Sep 15, 2009 at 5:56 PM, Alexander MacDonald <alexmac@adobe.com> wrote:
Hi guys, Iıve been using quickcheck for a while and Iım having no problem
making generators for my data types, however recently I stumbled upon a
situation where I need to maintain State inside the quickcheck generator
functions. Here's a simple example, imagine I've got a basic language which
only has two features, variable definitions and assignments:

type Script = [Statement]

data Name = Name String
   deriving (Show,Eq)

data Statement = Def Name Int | Assign Name Name
   deriving Show

Generating random scripts is easy enough, just make each type an instance of
Arbitrary with a suitable generator function, however I want to make sure
that the generated scripts are syntactically valid. In this case that means
no "Name" can be used in an "Assign" statement unless it has previously been
defined by a "Def" statement.

My knowledge of using monads is somewhat basic so I'm struggling to figure
out how to use the State monad with QuickCheck. I've pasted my current
effort on the web: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=9412

If anyone could spare a moment to glance at my code and give me a push in
the right direction that would be much appreciated!

Thanks,
Alex Mac

_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners