Skip to content

Better UX for constant output function for Sel.Hashing #105

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

Open
Kleidukos opened this issue Aug 31, 2023 · 5 comments
Open

Better UX for constant output function for Sel.Hashing #105

Kleidukos opened this issue Aug 31, 2023 · 5 comments
Labels
enhancement New feature or request sel Sel package

Comments

@Kleidukos
Copy link
Member

Kleidukos commented Aug 31, 2023

Sel.Hashing uses a Maybe HashKey parameter to hashByteString.
However this is not fantastic in terms of readability.

I'd like to avoid Maybe-blindness by having a sum type like data KeyParma = Key <hashkey> | NoKey (or Constant).

@Kleidukos Kleidukos added enhancement New feature or request sel Sel package labels Aug 31, 2023
@Kleidukos Kleidukos changed the title Constant output function for Sel.Hashing Better UX for constant output function for Sel.Hashing Aug 31, 2023
@Kleidukos
Copy link
Member Author

@divarvel @kozross @a-02 your input would be appreciated. :)

@kozross
Copy link
Contributor

kozross commented Aug 31, 2023

I'm OK either way: I don't really feel this is confusing or less readable.

@divarvel
Copy link

divarvel commented Sep 3, 2023

Key / NoKey does not improve readability compared to Maybe Key imo.
Is there a canonical name for when the operation is ran without a key? (eg deterministic or something). Using this name in a sum type could make things clearer.

Also, if the presence/ absence of key changes semantics too much, then maybe two functions would work better by not conflating different operations.

That being said:

  • I haven't use these operations so I might be off the mark
  • I think Maybe is okay anyway, I understand it's a matter of making things better, but the existing state of things is not horrible either.

@Kleidukos
Copy link
Member Author

@divarvel Well, the change of semantics is "same input gives same output", which makes sense when one has been diving into this kind of API for a while. Not sure about outsiders though.

@Kleidukos
Copy link
Member Author

It appears that the Blake2 paper uses "Keyed"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request sel Sel package
Projects
None yet
Development

No branches or pull requests

3 participants