Skip to content

Combinator naming principles #366

@jmid

Description

@jmid

Before setting out on "The Great Combinator Renaming" ™️ we should document the naming principles.

Here's a cleaned up version distilled from past lessons in #223 and #243:

  • Generator names should align with type names (bool, char, ... list, option) - to be as predictable as possible
  • We should have short, unparameterized generators (int, string, ...) to lower the barrier to entry
  • Specialized generators also start with the type name, but use a consistent suffix (_pos, _neg, _size, _of, ...) as this will help find them, also when using tab-completion
  • We may include a few shorthand names for convenience (int_pos->nat, option->opt, ...)
  • Overall we aim to be as consistent as possible, e.g., offering similar signatures across generator interfaces (QCheck.Gen, QCheck.arbitrary, QCheck2.Gen)

We've already used these principles, e.g., in naming the bytes and string combinators in #245 as well as in #307 and #308,
so they should not come as a surprise.

Finally: I plan to add these naming principles to the documentation.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions