Skip to content

[#705] Parameterize generators with a Range

Nikolay Yakimov requested to merge lierdakil/#705-ranged-generators into master

Description

Problem: Cleveland exposes many hedgehog generators. For some types, like Mutez, we provide two generators. One that generates an arbitrary value among all possible values (genMutez) and another that lets the user specify the range (genMutez'). We should do this across the board, where it makes sense. Additionally, it might be good to avoid duplicating the interface.

Solution: Define instances Default (Range a) for types of interest (occasionally wrapped in newtypes). Add range parameters to generators where it makes sense.

Additionally, I've discovered that genValidType doesn't use its mustBeValid argument, so that's been removed.

Related issue(s)

Resolves #705 (closed)

Checklist for your Merge Request

Related changes (conditional)

  • Tests (see short guidelines)

    • If I added new functionality, I added tests covering it.
    • If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.
  • Documentation

    • I checked whether I should update the docs and did so if necessary:
    • I updated changelog files of all affected packages released to Hackage if my changes are externally visible.

Stylistic guide (mandatory)

Edited by Nikolay Yakimov

Merge request reports