Skip to content

Added discipline tests for the new Traverse laws - #4283

Merged
armanbilge merged 1 commit into
typelevel:mainfrom
nikololiahim:tests_for_laws
Aug 17, 2022
Merged

Added discipline tests for the new Traverse laws#4283
armanbilge merged 1 commit into
typelevel:mainfrom
nikololiahim:tests_for_laws

Conversation

@nikololiahim

Copy link
Copy Markdown

Added laws tests for methods added in #4248 and #4245. @armanbilge can you take a look?

@armanbilge armanbilge added this to the 2.9.0 milestone Aug 17, 2022
@armanbilge armanbilge changed the title Added laws tests for the new Traverse methods Added discipline tests for the new Traverse laws Aug 17, 2022

@armanbilge armanbilge left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fast fix!

Comment on lines 85 to +92
"traverse ref mapAccumulate" -> forAll(laws.mapAccumulateRef[M, A, C] _),
"traverse ref mapWithIndex" -> forAll(laws.mapWithIndexRef[A, C] _),
"traverse ref traverseWithIndexM" -> forAll(laws.traverseWithIndexMRef[Option, A, C] _),
"traverse ref zipWithIndex" -> forAll(laws.zipWithIndexRef[A, C] _)
"traverse ref zipWithIndex" -> forAll(laws.zipWithIndexRef[A, C] _),
"traverse ref zipWithLongIndex" -> forAll(laws.zipWithLongIndexRef[A, C] _),
"traverse ref mapWithLongIndex" -> forAll(laws.mapWithLongIndexRef[A, C] _),
"traverse ref traverseWithLongIndexM" -> forAll(laws.traverseWithLongIndexMRef[Option, A, C] _),
"traverse ref updated" -> forAll(laws.updatedRef[A, A](_, _, _))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, the naming of these law tests seems to be inconsistent in Cats 🤔

"get reference" -> forAll(laws.getRef[A] _),
"fold reference" -> forAll(laws.foldRef[A] _),
"toList reference" -> forAll(laws.toListRef[A] _),
"filter_ reference" -> forAll(laws.filter_Ref[A] _),
"takeWhile_ reference" -> forAll(laws.takeWhile_Ref[A] _),
"dropWhile_ reference" -> forAll(laws.dropWhile_Ref[A] _),
"collectFirstSome reference" -> forAll(laws.collectFirstSome_Ref[A, B] _),
"collectFirst reference" -> forAll(laws.collectFirst_Ref[A, B] _),

@johnynek

Copy link
Copy Markdown
Contributor

the boilerplate here has always annoyed me.

@armanbilge
armanbilge merged commit 06f798e into typelevel:main Aug 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants