-
Notifications
You must be signed in to change notification settings - Fork 70
Use Ord by default for nub, difference, etc #91
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
Comments
|
I think this is another reason in favor of purescript-deprecated/purescript-sets#46 |
On further thought, it's not clear to me that |
I've taken a shot at |
Currently |
addresses purescript#91 O(n*logn)
addresses purescript#91 O(n*logn)
addresses purescript#91 O(n*logn)
Resolved in the 0.12 branch |
Currently we use an
Eq
constraint for functions likenub
anddifference
. However this gives a poor asymptotic complexity; see https://github.com/nh2/haskell-ordnub.Of course, there are some types which have
Eq
but notOrd
instances so it makes sense to makeEq
versions of these functions available. However, most types do haveOrd
instances so I think the default version should useOrd
. That is, I'd prefer to havenub :: forall a. Ord a => Array a -> Array a
and additionallynubEq
which is the same except with only anEq
constraint.This is a little bit difficult with respect to dependencies because we would probably want to depend on
sets
to do this, butmaps
(which is a dependency ofsets
) already depends onarrays
. So that's one issue to sort out, if we do agree that we want to do this.The text was updated successfully, but these errors were encountered: