Skip to content

Commit 14197cf

Browse files
committed
tidy-up: change order in file
1 parent aeee997 commit 14197cf

File tree

1 file changed

+18
-16
lines changed
  • lambda-buffers-compiler/src/LambdaBuffers/Compiler/ProtoCompat

1 file changed

+18
-16
lines changed

lambda-buffers-compiler/src/LambdaBuffers/Compiler/ProtoCompat/Types.hs

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -207,22 +207,6 @@ data CompilerResult
207207
| RCompilerOutput CompilerOutput
208208
deriving stock (Show, Eq, Ord, Generic)
209209

210-
instance Arbitrary a => Arbitrary (NonEmpty a) where
211-
arbitrary = sized f
212-
where
213-
f :: (Num t, Ord t) => t -> Gen (NonEmpty a)
214-
f n
215-
| n <= 0 = do
216-
x <- arbitrary @a
217-
pure $ x :| []
218-
| otherwise = do
219-
x <- arbitrary
220-
xs <- f (n - 1)
221-
pure $ x <| xs
222-
223-
instance Arbitrary Text where
224-
arbitrary = pack <$> arbitrary
225-
226210
instance Arbitrary SourceInfo where
227211
arbitrary = SourceInfo <$> arbitrary <*> arbitrary <*> arbitrary
228212

@@ -344,3 +328,21 @@ instance Arbitrary CompilerResult where
344328
[ RCompilerFailure <$> arbitrary
345329
, RCompilerOutput <$> arbitrary
346330
]
331+
332+
-- Orphan Instances
333+
334+
instance Arbitrary a => Arbitrary (NonEmpty a) where
335+
arbitrary = sized f
336+
where
337+
f :: (Num t, Ord t) => t -> Gen (NonEmpty a)
338+
f n
339+
| n <= 0 = do
340+
x <- arbitrary @a
341+
pure $ x :| []
342+
| otherwise = do
343+
x <- arbitrary
344+
xs <- f (n - 1)
345+
pure $ x <| xs
346+
347+
instance Arbitrary Text where
348+
arbitrary = pack <$> arbitrary

0 commit comments

Comments
 (0)