Skip to content

Semantics for maximumOn & friends #362

Description

@Shimuuar

This is followup to #356. I stumbled on it while writing doctests. in #180 maximumBy definition was changed.

Data.List & vector0.13

  • minimumBy returns first tie
  • maximumBy returns last tie

vector-0.12

  • minimumBy returns first tie
  • maximumBy returns first tie

maximumOn should I think match behavior of maximumBy. Question is whether we should match functions for lists which aren't very consistent or should revert to 0.12

P.S. Data.Foldable.maximumBy function definition doesn't make any promises on ties

Activity

  1. Bodigrim commented on Jan 18, 2021

    @Bodigrim
    Contributor

    I think we should clearly document existing behaviour of all four functions, but do not modify maximumOn to follow deprecated behaviour of maximumBy. Doing otherwise will just increase an amount of potential breakage in 0.13.

  2. Shimuuar commented on Jan 18, 2021

    @Shimuuar
    ContributorAuthor

    I don't understand what do you mean by this. maximumOn & maximumBy should behave identically otherwise we'll have two function that do same thing but slightly differently.

    Real question is whether we should keep change to maximumBy from return first to return last, or should we revert to definition from 0.12 (return first).

  3. Bodigrim commented on Feb 13, 2021

    @Bodigrim
    Contributor

    Real question is whether we should keep change to maximumBy from return first to return last, or should we revert to definition from 0.12 (return first).

    I'm in favor of reverting #180.

    base does not specify tie behaviour of minimumBy / maximumBy, and theoretically can change it in any major release (which happens pretty often). We should not be chase compatibility with it entirely at our own expense. #180 introduced a dangerous silent breaking change, and I do not think that the motivation was strong enough.

  4. Shimuuar commented on Feb 17, 2021

    @Shimuuar
    ContributorAuthor

    Looks like consensus is to revert and document behavior. I'll update #364 accordingly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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