Add "monadicST" to QuickCheck

Patrick Perry patperry at
Thu Jun 10 01:33:58 EDT 2010

I sent a patch to Koen Claessen a year-and-a-half ago to add a
"monadicST" function to Test.QuickCheck.Monadic, and it looks like
it's fallen through the cracks.  In the hopes that someone new can
take care of adding it, here are the lines that need to get added to

unsafePropertySTToPropertyIO :: (forall s. PropertyM (ST s) a) -> PropertyM IO a
unsafePropertySTToPropertyIO pm = MkPropertyM $ \f ->
  let m  = unPropertyM pm
      f' = \a -> liftM unsafeIOToST $ f a
  in liftM unsafeSTToIO $ m f'

monadicST :: (forall s. PropertyM (ST s) a) -> Property
monadicST = monadicIO . unsafePropertySTToPropertyIO

This is a bit of a hack, but it works.  Judging by the cruft in the
file (MonadS, MonadS', monadicS, IdM-- do these types/functions have
uses?), others have tried and failed implement monadicST before.

Could someone please take care of adding the function to the next
release of QuickCheck?



More information about the QuickCheck mailing list