Discard on failed pattern matches within a Generator#257
Discard on failed pattern matches within a Generator#257HuwCampbell wants to merge 1 commit intohedgehogqa:masterfrom
Conversation
abd765b to
4121279
Compare
|
A similar issue exists for |
|
See this conversation regarding |
|
I've spent some time thinking about this and the problem I have with it is that ideally one should aim to write tests / generators that don't ever discard. Discarding slows things down and I would consider its use a bit of an anti-pattern. I think it should only really be used as a last resort. You're better of using the just :: MonadGen m => m (Maybe a) -> m a
filter :: MonadGen m => (a -> Bool) -> m a -> m aSo I'm just a bit unsure about making it syntactically convenient to discard, as often there are more appropriate options. I actually wonder if it would be better to remove the |
This aligns pretty well with @sol's comment on the same topic (QC): nick8325/quickcheck#228 (comment) If we decide to get rid of |
Too late 😅 I think this topic has too many trade-offs to rush the decision, so I'm not that concerned. What we ended up releasing is the same as what it has always been. |
4139585 to
c228279
Compare
|
I'm going to bump this, as I still think this is a better behaviour. |
|
@HuwCampbell, in which scenario(s) do you rely more on discards? |
As discussed in #233.