nick8325 / quickcheck

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

instances for Down from Data.Ord? #347

Open imuli opened 1 year ago

imuli commented 1 year ago

I occasionally run into cases where I want to use Down in a data type, use some generic derivation for Arbitrary, and end up needing to write the orphan instances (or make my own type for it):

deriving instance Arbitrary a => Arbitrary (Down a)
instance Arbitrary1 Down where
  liftArbitrary = fmap Down
  liftShrink shr = fmap Down . shr . getDown

It's not that big of a deal (and I admittedly rarely use the Arbitrary1 instance) but it would be nice if these were included, as they are for most other types in base.