Skip to content

Define laws for Traversable #373

@sideeffffect

Description

@sideeffffect

Difficulty: Advanced, requires familiarity with the concept of algebraic laws and testing them

Traversable currently doesn't have any laws (only inherits those from Covariant). Figure out which laws should ZIO Prelude's Traversable abide. Then write those tests down in Traversable.laws. Add tests for the missing instances in TraversableSpec (tests for some basic instances, like Option or List are already present).

As an inspiration, have a look Cats or ScalaZ or Haskell Travers/able and their laws:

https://github.com/typelevel/cats/blob/master/laws/src/main/scala/cats/laws/TraverseLaws.scala#L9
https://github.com/scalaz/scalaz/blob/master/core/src/main/scala/scalaz/Traverse.scala#L162
https://hackage.haskell.org/package/base-4.14.0.0/docs/Data-Traversable.html#t:Traversable

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions