Skip to content

Commit c8a3da5

Browse files
committed
Rename WithSerialised's constructor
I noticed the constructor was called `TestKey`, but `WithSerialised` is probably nicer. In any case, it's a minor renaming that I thought would be uncontroversial.
1 parent 6434e1b commit c8a3da5

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src-extras/Database/LSMTree/Extras/Generators.hs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -184,24 +184,24 @@ instance Arbitrary2 Entry where
184184
--
185185
-- Also useful for failing tests that have keys as inputs, because the printed
186186
-- 'WithSerialised' values will show both keys and their serialised form.
187-
data WithSerialised k = TestKey k SerialisedKey
187+
data WithSerialised k = WithSerialised k SerialisedKey
188188
deriving stock Show
189189

190190
instance Eq k => Eq (WithSerialised k) where
191-
TestKey k1 _ == TestKey k2 _ = k1 == k2
191+
WithSerialised k1 _ == WithSerialised k2 _ = k1 == k2
192192

193193
instance Ord k => Ord (WithSerialised k) where
194-
TestKey k1 _ `compare` TestKey k2 _ = k1 `compare` k2
194+
WithSerialised k1 _ `compare` WithSerialised k2 _ = k1 `compare` k2
195195

196196
instance (Arbitrary k, SerialiseKey k) => Arbitrary (WithSerialised k) where
197197
arbitrary = do
198198
x <- arbitrary
199-
pure $ TestKey x (serialiseKey x)
200-
shrink (TestKey k _) = [TestKey k' (serialiseKey k') | k' <- shrink k]
199+
pure $ WithSerialised x (serialiseKey x)
200+
shrink (WithSerialised k _) = [WithSerialised k' (serialiseKey k') | k' <- shrink k]
201201

202202
instance SerialiseKey k => SerialiseKey (WithSerialised k) where
203-
serialiseKey (TestKey _ (SerialisedKey bytes)) = bytes
204-
deserialiseKey bytes = TestKey (S.Class.deserialiseKey bytes) (SerialisedKey bytes)
203+
serialiseKey (WithSerialised _ (SerialisedKey bytes)) = bytes
204+
deserialiseKey bytes = WithSerialised (S.Class.deserialiseKey bytes) (SerialisedKey bytes)
205205

206206
{-------------------------------------------------------------------------------
207207
Other number newtypes

0 commit comments

Comments
 (0)