File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -80,8 +80,8 @@ newtype Sqrt a = Sqrt { unSqrt :: a }
80
80
81
81
instance Arbitrary a => Arbitrary (Sqrt a ) where
82
82
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
85
85
shrink = map Sqrt . shrink . unSqrt
86
86
87
87
instance Arbitrary T. Text where
@@ -96,9 +96,11 @@ newtype BigInt = Big Integer
96
96
deriving (Eq , Show )
97
97
98
98
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)
100
102
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
102
104
103
105
newtype NotEmpty a = NotEmpty { notEmpty :: a }
104
106
deriving (Eq , Ord , Show )
You can’t perform that action at this time.
0 commit comments