Make model available to shrinker
edsko opened this issue · 3 comments
At the moment, the type of the shrinker is
shrinker :: cmd Symbolic -> [cmd Symbolic]
This means the shrinker for commands has no context available at all. When we take shrinking serious, this is quite a limitation. I've been trying to workaround this in a million different ways but I get stuck each time.
I propose that we generalize the type to
shrinker :: model Symbolic -> cmd Symbolic -> [cmd Symbolic]
so that the shrinker has the context available. Initially I thought that this would make shrinking more expensive, which is why I didn't go down this route before. But thinking about it more I now realize that this is not actually true: after all, shrinking is always followed by a validation step, so we compute the model anyway for all shrinks.
What this means is that shrinking cannot be the current shrinkList
-then-validCommands
; instead it must combine the two.
@stevana I will start working on a patch to do this. If you think this is a terrible idea, let me know ASAP, but I think it will make the library more general, without making shrinking more expensive.
I think this generalisation makes sense.
Awesome! Then I will work on a patch :)
Fixed in referenced PR.