Skip to content
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

Migration advice for hashable-1.4 #232

Open
sjakobi opened this issue Nov 1, 2021 · 3 comments
Open

Migration advice for hashable-1.4 #232

sjakobi opened this issue Nov 1, 2021 · 3 comments

Comments

@sjakobi
Copy link
Member

sjakobi commented Nov 1, 2021

What's the best way to make code -Wredundant-constraints-clean with hashable-1.4 while retaining compatibility with hashable < 1.4?

In unordered-containers, I'd rather not have CPP-conditionals on every function that so far required both Eq and Hashable, like this:

f ::
#if MIN_VERSION_hashable(1,4,0)
  (Hashable k)
#else 
  (Eq k, Hashable k)
#endif
  => bla k

Is there a recommended way to achieve the same effect with less visual noise?

(CC @treeowl)

@phadej
Copy link
Contributor

phadej commented Nov 1, 2021

@sjakobi don't try. Turn the warning off for time being. That's why I suggested to do (another alterntative) release soon, with hashable >=1.4 lower bound.

@phadej
Copy link
Contributor

phadej commented Nov 1, 2021

a CPP hack is to do

#if MIN_VERSION_hashable(1,4,0)
#define HASHABLE(k) Hashable k
#else
#define HASHABLE(k) Eq k, Hashable k
#endif

f :: (HASHABLE(k)) => bla k

but the sooner you get rid of it, the saner you'll be.

@sjakobi
Copy link
Member Author

sjakobi commented Nov 1, 2021

Thanks for the advice, @phadej! Indeed it seems best not to change the constraints for now. We can consider requiring hashable >= 1.4 in a few months.

Maybe leave this issue open for a bit, so other users with similar questions can find it more easily.

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

No branches or pull requests

2 participants