well-typed / falsify

Other
38 stars 6 forks source link

Improve separation of concerns between `Function` and `Perturb` #28

Closed edsko closed 1 year ago

edsko commented 1 year ago

Currently when generating a Fun Char .., we need both Perturb Char and Function Char: the Perturb is necessary to generate the original random function, and Function is necessary to then reify this function. The strange thing is that when we then shrink the reified function, we might end up Perturbing at a different type (in this case, Int, because the Function instance for Char is defined in terms of the Function instance for Int.

This is confusing and annoying; for example, it might be beneficial to improve the Perturb instance for Char so that common characters get a shorter Focus; but that's not possible, since the instance for Char is only used for the initial value of the function, not during shrinking, so we're not actually getting much benefit.

edsko commented 1 year ago

Closed in #29 (Perburb is now gone entirely).