From d893d4bdf2c6fab86e6d3f83c954acb32a743899 Mon Sep 17 00:00:00 2001 From: Preetham Gujjula Date: Fri, 13 Dec 2024 12:49:42 -0800 Subject: [PATCH] wip: Use IsList --- test/Test/Data/List/ApplyMerge/New.hs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/test/Test/Data/List/ApplyMerge/New.hs b/test/Test/Data/List/ApplyMerge/New.hs index b8a42df..7217e08 100644 --- a/test/Test/Data/List/ApplyMerge/New.hs +++ b/test/Test/Data/List/ApplyMerge/New.hs @@ -20,6 +20,7 @@ import Data.List.ApplyMerge qualified as List (applyMerge, applyMergeBy, applyMe import Data.List.NonEmpty (NonEmpty ((:|))) import Data.List.NonEmpty qualified as NonEmpty import Data.List.NonEmpty.ApplyMerge qualified as NonEmpty +import GHC.Exts (IsList, toList) import Numeric.Natural (Natural) import Test.QuickCheck.Instances.Natural () import Test.QuickCheck.Instances.Text () @@ -158,8 +159,8 @@ testListFunctions label am funcs op = let limit = 100 pure . QC.counterexample fName $ \(getOrderedList op -> xs) (getOrderedList op -> ys) -> - let actual = am f xs ys - expected = sort $ on (liftA2 f) (take limit) xs ys + let actual = toList (am f xs ys) + expected = sort $ on (liftA2 f) (take limit . toList) xs ys in on (===) (take limit) actual expected testNonEmptyFunctions :: TestFunctions NonEmpty @@ -169,9 +170,9 @@ testNonEmptyFunctions label am funcs op = let limit = 100 pure . QC.counterexample fName $ \(getOrderedNonEmpty op -> xs) (getOrderedNonEmpty op -> ys) -> - let actual = am f xs ys - expected = NonEmpty.sort $ on (liftA2 f) (take1 limit) xs ys - in on (===) (NonEmpty.take limit) actual expected + let actual = toList (am f xs ys) + expected = sort $ on (liftA2 f) (take limit . toList) xs ys + in on (===) (take limit) actual expected class HasPossiblyInfinite (a :: Type) where type PossiblyInfinite a :: Type