Skip to content

Commit

Permalink
added NoShrink modifier
Browse files Browse the repository at this point in the history
  • Loading branch information
BebeSparkelSparkel authored and MaximilianAlgehed committed May 24, 2024
1 parent 72fe941 commit ddb3f7f
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/Test/QuickCheck/Modifiers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ module Test.QuickCheck.Modifiers
, Small(..)
, Smart(..)
, Shrink2(..)
, NoShrink(..)
#ifndef NO_MULTI_PARAM_TYPE_CLASSES
, Shrinking(..)
, ShrinkState(..)
Expand Down Expand Up @@ -412,6 +413,24 @@ instance Arbitrary a => Arbitrary (Shrink2 a) where
where
shrink_x = shrink x

--------------------------------------------------------------------------
-- | @NoShrink x@: no shrinking
newtype NoShrink a = NoShrink {getNoShrink :: a}
deriving ( Eq, Ord, Show, Read
#ifndef NO_NEWTYPE_DERIVING
, Num, Integral, Real, Enum, Ix
#endif
#ifndef NO_TYPEABLE
, Typeable
#endif
)

instance Functor NoShrink where
fmap f (NoShrink x) = NoShrink (f x)

instance Arbitrary a => Arbitrary (NoShrink a) where
arbitrary = fmap NoShrink arbitrary

--------------------------------------------------------------------------
-- | @Smart _ x@: tries a different order when shrinking.
data Smart a =
Expand Down

0 comments on commit ddb3f7f

Please sign in to comment.