Skip to content

Rename Imp test helper functions for consistency #4760

Open
@lehins

Description

"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)

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions