Skip to content

Cogen.cogenMap should not require ordering on the values #356

@joroKr21

Description

@joroKr21

Keys in a Map are always distinct. Therefore sorting by the keys should be sufficient:

implicit def cogenMap[K: Cogen: Ordering, V: Cogen]: Cogen[Map[K, V]] =
  Cogen.it(_.toVector.sortBy(_._1).iterator)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions