Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions hedgehog/hedgehog.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ library
Hedgehog.Range

Hedgehog.Internal.Barbie
Hedgehog.Internal.Check
Hedgehog.Internal.Config
Hedgehog.Internal.Discovery
Hedgehog.Internal.Distributive
Expand Down
3 changes: 2 additions & 1 deletion hedgehog/src/Hedgehog.hs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ import Data.Functor.Classes (Eq1, eq1, Ord1, compare1, Show1, showsPre

import Hedgehog.Internal.Barbie (FunctorB(..), TraversableB(..), Rec(..))
import Hedgehog.Internal.Distributive (distributeT)
import Hedgehog.Internal.Check (check)
import Hedgehog.Internal.Gen (Gen, GenT, MonadGen(..))
import Hedgehog.Internal.HTraversable (HTraversable(..))
import Hedgehog.Internal.Opaque (Opaque(..))
Expand All @@ -194,7 +195,7 @@ import Hedgehog.Internal.Property (Test, TestT, property, test)
import Hedgehog.Internal.Property (TestLimit, withTests)
import Hedgehog.Internal.Property (collect, label)
import Hedgehog.Internal.Range (Range, Size(..))
import Hedgehog.Internal.Runner (check, recheck, recheckAt, checkSequential, checkParallel)
import Hedgehog.Internal.Runner (recheck, recheckAt, checkSequential, checkParallel)
import Hedgehog.Internal.Seed (Seed(..))
import Hedgehog.Internal.State (Command(..), Callback(..))
import Hedgehog.Internal.State (Action, Sequential(..), Parallel(..))
Expand Down
65 changes: 65 additions & 0 deletions hedgehog/src/Hedgehog/Internal/Check.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{-# LANGUAGE NoImplicitPrelude #-}

module Hedgehog.Internal.Check
( check
) where

import Control.Monad.IO.Class (MonadIO(..))
import Hedgehog.Internal.Config
import Hedgehog.Internal.Prelude
import Hedgehog.Internal.Property
import Hedgehog.Internal.Region
import Hedgehog.Internal.Report
import Hedgehog.Internal.Runner (checkReport)
import Hedgehog.Range (Size)

checkRegion ::
MonadIO m
=> Region
-> UseColor
-> Maybe PropertyName
-> Size
-> Seed
-> Property
-> m (Report Result)
checkRegion region color name size seed prop =

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You forgot to remove it from hedgehog/src/Hedgehog/Internal/Runner.hs

Copy link
Author

@newhoggy newhoggy Jul 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot remove those because they are needed by other functions in the Runner module.

liftIO $ do
result <-
checkReport (propertyConfig prop) size seed (propertyTest prop) $ \progress -> do
ppprogress <- renderProgress color name progress
case reportStatus progress of
Running ->
setRegion region ppprogress
Shrinking _ ->
openRegion region ppprogress

ppresult <- renderResult color name result
case reportStatus result of
Failed _ ->
openRegion region ppresult
GaveUp ->
openRegion region ppresult
OK ->
setRegion region ppresult

pure result

checkNamed ::
MonadIO m
=> Region
-> UseColor
-> Maybe PropertyName
-> Maybe Seed
-> Property
-> m (Report Result)
checkNamed region color name mseed prop = do
seed <- resolveSeed mseed
checkRegion region color name 0 seed prop

-- | Check a property.
--
check :: MonadIO m => Property -> m Bool
check prop = do
color <- detectColor
liftIO . displayRegion $ \region ->
(== OK) . reportStatus <$> checkNamed region color Nothing Nothing prop
13 changes: 1 addition & 12 deletions hedgehog/src/Hedgehog/Internal/Runner.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@

module Hedgehog.Internal.Runner (
-- * Running Individual Properties
check
, recheck
recheck
, recheckAt

-- * Running Groups of Properties
Expand All @@ -23,8 +22,6 @@ module Hedgehog.Internal.Runner (

-- * Internal
, checkReport
, checkRegion
, checkNamed
) where

import Control.Concurrent.STM (TVar, atomically)
Expand Down Expand Up @@ -420,14 +417,6 @@ checkNamed region color name mseed prop = do
seed <- resolveSeed mseed
checkRegion region color name 0 seed prop

-- | Check a property.
--
check :: MonadIO m => Property -> m Bool
check prop = do
color <- detectColor
liftIO . displayRegion $ \region ->
(== OK) . reportStatus <$> checkNamed region color Nothing Nothing prop

-- | Check a property using a specific size and seed.
--
recheck :: MonadIO m => Size -> Seed -> Property -> m ()
Expand Down
Loading