Skip to content

Restore stability for sorting, add tests #197

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Dec 29, 2020

Conversation

pete-murphy
Copy link
Contributor

@pete-murphy pete-murphy commented Dec 26, 2020

Fixes #196

@pete-murphy pete-murphy force-pushed the pm/sort-stability-tests branch 4 times, most recently from 099c9a5 to 84b3e91 Compare December 28, 2020 01:30
@pete-murphy pete-murphy changed the title Add sortBy/sortWith stability tests Restore stability for sorting, add tests Dec 28, 2020
Copy link
Member

@kl0tl kl0tl left a comment

Choose a reason for hiding this comment

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

Similar changes need to be applied to src/Data/Array/ST.js and test/Test/Data/Array/ST.purs.

Could you also add a comment to sort, sortBy and sortWith in Data.Array and Data.Array.ST to document their stability? I think something along the lines of “Sorting is stable: the order of equal elements is preserved.” should be enough.

@kl0tl
Copy link
Member

kl0tl commented Dec 28, 2020

I updated the compiler version specified in the .github/workflows/ci.yml on master, the CI build should pass after a rebase.

@pete-murphy pete-murphy force-pushed the pm/sort-stability-tests branch from 8efca25 to 23ab0fa Compare December 28, 2020 13:22
Copy link
Member

@kl0tl kl0tl left a comment

Choose a reason for hiding this comment

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

This looks quite good to me (the build failure is fixed by #198 on master), thank you very much!

@JordanMartinez
Copy link
Contributor

CI is failing with this error because I forgot to update group''s definition in #164. I'm fixing that mistake in #200:

[1/1 UserDefinedWarning] src/Data/Array/NonEmpty.purs:356:1

  356  group' :: forall a. Ord a => NonEmptyArray a -> NonEmptyArray (NonEmptyArray a)
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  
  A custom warning occurred while solving type class constraints:
  
    'group'' is deprecated, use groupAll instead
  
  in value declaration group'

           Src   Lib   All
Warnings   0     0/4   0/4
Errors     1     0     1 

@JordanMartinez
Copy link
Contributor

CI is now failing with this error. I've submitted purescript/purescript-identity#23 to fix identity:

* Building project in /home/runner/work/purescript-arrays/purescript-arrays
[1/1 ExtraneousClassMember] bower_components/purescript-identity/src/Data/Identity.purs:90:3

  90    fold1 (Identity x) = x
        ^^^^^^^^^^^^^^^^^^^^^^
  
  fold1 is not a member of type class Data.Semigroup.Foldable.Foldable1
  
  in type class instance
  
    Data.Semigroup.Foldable.Foldable1 Identity

           Src   Lib   All
Warnings   0     0/4   0/4
Errors     0     1     1  

@thomashoneyman
Copy link
Member

@JordanMartinez we also need to remove the fold1 implementation. Sorry for the churn, @ptrfrncsmrph 😅

@JordanMartinez JordanMartinez merged commit a5afe3d into purescript:master Dec 29, 2020
@JordanMartinez
Copy link
Contributor

Finally! Thanks @ptrfrncsmrph!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Restore stability for sorting
4 participants