nick8325 / quickcheck

Automatic testing of Haskell programs.
Other
714 stars 119 forks source link

instance Testable Maybe #243

Closed amigalemming closed 5 years ago

amigalemming commented 5 years ago

How about that instance:

instance (Testable prop) => Testable (Maybe prop) where
  property Nothing = property rejected
  property (Just prop) = property prop

?

Reason: I have a Gen that cannot always produce something, thus it has type Gen (Maybe a). I want to turn Nothing into Discard when it is finally converted to Property. I find discard too much of a hack.

Related: #124

nick8325 commented 5 years ago

I think this is a sensible idea.