From 8c26dafaf5b99705362d7bdbc4098886845608cd Mon Sep 17 00:00:00 2001 From: Maximilian Algehed Date: Thu, 21 Mar 2024 15:16:31 +0100 Subject: [PATCH] Fix `promote` doing an unnecessary split (#373) --- src/Test/QuickCheck/Gen/Unsafe.hs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Test/QuickCheck/Gen/Unsafe.hs b/src/Test/QuickCheck/Gen/Unsafe.hs index 514e8e9f..329497f0 100644 --- a/src/Test/QuickCheck/Gen/Unsafe.hs +++ b/src/Test/QuickCheck/Gen/Unsafe.hs @@ -22,12 +22,11 @@ module Test.QuickCheck.Gen.Unsafe where import Test.QuickCheck.Gen import Control.Monad +import Control.Applicative -- | Promotes a monadic generator to a generator of monadic values. promote :: Monad m => m (Gen a) -> Gen (m a) -promote m = do - eval <- delay - return (liftM eval m) +promote m = flip liftM m <$> delay -- | Randomly generates a function of type @'Gen' a -> a@, which -- you can then use to evaluate generators. Mostly useful in