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

Rename Imp test helper functions for consistency #4760

Open
lehins opened this issue Nov 18, 2024 · 0 comments
Open

Rename Imp test helper functions for consistency #4760

lehins opened this issue Nov 18, 2024 · 0 comments

Comments

@lehins
Copy link
Collaborator

lehins commented Nov 18, 2024

"unsafe" is a bad prefix, because unsafe in Haskell usually describes things that violate some invariant and lead to dangerous situations like segfaults or other unpredictable behavior. Functions that throw errors when something goes wrong are called partial instead of unsafe. Considering that these function don't deal with anything unsafe there names should follow the common convention that is used in other libraries:

  • lookup to mean a total function that returns a Maybe
  • try to mean a recovery from failure that returns an Either
  • something like get or partial to indicate a runtime error.

So, the names I propose are:

  • change lookup[Reward|KeyPair|...] to indicate a total function that returns Maybe
  • make partial functions prefixed with get[Reward|KeyPair|..]

Originally posted by @lehins in #4756 (comment)

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

No branches or pull requests

1 participant