Skip to content

Commit

Permalink
move Small function isntance to Test.QuickCheck.Function
Browse files Browse the repository at this point in the history
  • Loading branch information
MaximilianAlgehed committed Mar 21, 2024
1 parent 6c4eb24 commit 7e01bf9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 6 additions & 0 deletions src/Test/QuickCheck/Function.hs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ module Test.QuickCheck.Function

import Test.QuickCheck.Arbitrary
import Test.QuickCheck.Poly
import Test.QuickCheck.Modifiers (Small(..))

import Control.Applicative
import Data.Char
Expand Down Expand Up @@ -478,6 +479,11 @@ instance Function OrdB where
instance Function OrdC where
function = functionMap unOrdC OrdC

-- Instances for modifiers

instance Function a => Function (Small a) where
function = functionMap getSmall Small

-- instance Arbitrary

instance (Function a, CoArbitrary a, Arbitrary b) => Arbitrary (a:->b) where
Expand Down
4 changes: 0 additions & 4 deletions src/Test/QuickCheck/Modifiers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ module Test.QuickCheck.Modifiers
import Test.QuickCheck.Gen
import Test.QuickCheck.Arbitrary
import Test.QuickCheck.Exception
import Test.QuickCheck.Function

import Data.List
( sort
Expand Down Expand Up @@ -388,9 +387,6 @@ instance Integral a => Arbitrary (Small a) where
instance CoArbitrary a => CoArbitrary (Small a) where
coarbitrary (Small a) = coarbitrary a

instance Function a => Function (Small a) where
function = functionMap getSmall Small

--------------------------------------------------------------------------
-- | @Shrink2 x@: allows 2 shrinking steps at the same time when shrinking x
newtype Shrink2 a = Shrink2 {getShrink2 :: a}
Expand Down

0 comments on commit 7e01bf9

Please sign in to comment.