Add "monadicST" to QuickCheck

Nick Smallbone nick.smallbone at gmail.com
Mon Aug 30 22:34:50 EDT 2010


Hi Patrick,

I decided that the current monadic stuff in QuickCheck was just too
icky, and rewrote a load of it today. Anyway, monadicST is in the
darcs repository now, and it doesn't even need any unsafe functions,
hooray!

Nick

On Thu, Jun 10, 2010 at 7:33 AM, Patrick Perry <patperry at gmail.com> wrote:
> 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
> Test/QuickCheck/Monadic.hs:
>
> 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?
>
> Thanks,
>
>
> Patrick
>
> _______________________________________________
> QuickCheck mailing list
> QuickCheck at projects.haskell.org
> http://projects.haskell.org/cgi-bin/mailman/listinfo/quickcheck
>



More information about the QuickCheck mailing list