Skip to content

Commit

Permalink
Merge pull request #28 from purescript/eff
Browse files Browse the repository at this point in the history
Fix issue with instance selection in PSCi.
  • Loading branch information
paf31 committed Jul 17, 2015
2 parents 0401a18 + 5444e46 commit 3e46bda
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions pursuit.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions src/Test/QuickCheck.purs
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,18 @@ import Test.QuickCheck.Gen
import Test.QuickCheck.LCG

-- | A type synonym which represents the effects used by the `quickCheck` function.
type QC a = forall eff. Eff (console :: CONSOLE, random :: RANDOM, err :: EXCEPTION | eff) a
type QC eff a = Eff (console :: CONSOLE, random :: RANDOM, err :: EXCEPTION | eff) a

-- | Test a property.
-- |
-- | This function generates a new random seed, runs 100 tests and
-- | prints the test results to the console.
quickCheck :: forall prop. (Testable prop) => prop -> QC Unit
quickCheck :: forall eff prop. (Testable prop) => prop -> QC eff Unit
quickCheck prop = quickCheck' 100 prop

-- | A variant of the `quickCheck` function which accepts an extra parameter
-- | representing the number of tests which should be run.
quickCheck' :: forall prop. (Testable prop) => Int -> prop -> QC Unit
quickCheck' :: forall eff prop. (Testable prop) => Int -> prop -> QC eff Unit
quickCheck' n prop = do
seed <- randomSeed
let results = quickCheckPure seed n prop
Expand All @@ -51,7 +51,7 @@ quickCheck' n prop = do

where

throwOnFirstFailure :: Int -> List Result -> QC Unit
throwOnFirstFailure :: Int -> List Result -> QC eff Unit
throwOnFirstFailure _ Nil = return unit
throwOnFirstFailure n (Cons (Failed msg) _) = throwException $ error $ "Test " ++ show n ++ " failed: \n" ++ msg
throwOnFirstFailure n (Cons _ rest) = throwOnFirstFailure (n + one) rest
Expand Down

0 comments on commit 3e46bda

Please sign in to comment.