leanovate / gopter

GOlang Property TestER
MIT License
599 stars 40 forks source link

Keep Shrinker/Sieve if the in and out types of Map are the same #66

Closed anisjonischkeit closed 4 years ago

anisjonischkeit commented 4 years ago

There's no reason to lose the Shrinker if the types don't change.

untoldwind commented 4 years ago

The shrinker I can understand, but the sieve might be a bit too much. I'd say the one should rather write

gen.Map(func ...).SuchThat(newSieve)

Rather than just taking over whatever sieve gen had.

Maybe you have a concrete example in mind.

anisjonischkeit commented 4 years ago

To be honest, I think I was just thinking whether I could, not whether I should. I actually think there are more examples of where it doesn't make sense than where it does. I think if Sieves stuck onto the part of the generator they are applied on it'd make sense to keep that e.g.:

intGen.SuchThat(intLessThan1000).Map(intToTime)

But since (it seems to me) Sieves are a top level thing for generators, keeping them through map doesn't make any sense. I'll remove it 👍