Skip to content

Commit

Permalink
wip: Use IsList
Browse files Browse the repository at this point in the history
  • Loading branch information
pgujjula committed Dec 13, 2024
1 parent ea5e0e2 commit d893d4b
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions test/Test/Data/List/ApplyMerge/New.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit d893d4b

Please sign in to comment.