Skip to content

Commit d72cf35

Browse files
committed
Tests.QuickCheckUtils: m clean-up
1 parent ccaa346 commit d72cf35

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

tests/Tests/QuickCheckUtils.hs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ newtype Sqrt a = Sqrt { unSqrt :: a }
8080

8181
instance Arbitrary a => Arbitrary (Sqrt a) where
8282
arbitrary = fmap Sqrt $ sized $ \n -> resize (smallish n) arbitrary
83-
where
84-
smallish = round . (sqrt :: Double -> Double) . fromIntegral . abs
83+
where
84+
smallish = round . (sqrt :: Double -> Double) . fromIntegral . abs
8585
shrink = map Sqrt . shrink . unSqrt
8686

8787
instance Arbitrary T.Text where
@@ -96,9 +96,11 @@ newtype BigInt = Big Integer
9696
deriving (Eq, Show)
9797

9898
instance Arbitrary BigInt where
99-
arbitrary = choose (1::Int,200) >>= \e -> Big <$> choose (10^(e-1),10^e)
99+
arbitrary = do
100+
e <- choose (1::Int,200)
101+
Big <$> choose (10^(e-1),10^e)
100102
shrink (Big a) = [Big (a `div` 2^(l-e)) | e <- shrink l]
101-
where l = truncate (log (fromIntegral a) / log 2 :: Double) :: Integer
103+
where l = truncate (logBase 2 (fromIntegral a) :: Double) :: Integer
102104

103105
newtype NotEmpty a = NotEmpty { notEmpty :: a }
104106
deriving (Eq, Ord, Show)

0 commit comments

Comments
 (0)