smallcheck 1.0.1 → 1.0.2
raw patch · 4 files changed
+28/−20 lines, 4 files
Files
- CHANGES.md +5/−0
- Test/SmallCheck/Property.hs +2/−2
- Test/SmallCheck/Series.hs +19/−16
- smallcheck.cabal +2/−2
CHANGES.md view
@@ -1,6 +1,11 @@ Changes ======= +Version 1.0.2+-------------++Fix a bug in the generic instance+ Version 1.0.1 -------------
Test/SmallCheck/Property.hs view
@@ -109,7 +109,7 @@ -- -- 'over' does not affect the quantification context. over- :: (Monad m, Show a, Testable m b)+ :: (Show a, Testable m b) => Series m a -> (a -> b) -> Property m over = testFunction @@ -153,7 +153,7 @@ test = id testFunction- :: (Monad m, Show a, Testable m b)+ :: (Show a, Testable m b) => Series m a -> (a -> b) -> Property m testFunction s f = Property $ reader $ \env -> let
Test/SmallCheck/Series.hs view
@@ -27,7 +27,7 @@ GeneralizedNewtypeDeriving, FlexibleContexts #-} -- The following is needed for generic instances {-# LANGUAGE DefaultSignatures, FlexibleContexts, TypeOperators,- TypeSynonymInstances, FlexibleInstances #-}+ TypeSynonymInstances, FlexibleInstances, OverlappingInstances #-} module Test.SmallCheck.Series ( -- {{{@@ -306,7 +306,7 @@ alts0 :: Series m a -> Series m a alts0 s = s -alts1 :: (Monad m, CoSerial m a) => Series m b -> Series m (a->b)+alts1 :: CoSerial m a => Series m b -> Series m (a->b) alts1 rs = decDepthChecked (constM rs) (coseries rs) @@ -333,7 +333,7 @@ (coseries $ coseries $ coseries $ coseries rs) -- | Same as 'alts1', but preserves the depth.-newtypeAlts :: (Monad m, CoSerial m a) => Series m b -> Series m (a->b)+newtypeAlts :: CoSerial m a => Series m b -> Series m (a->b) newtypeAlts = coseries -- }}}@@ -363,7 +363,7 @@ {-# INLINE gCoseries #-} instance GSerial m U1 where- gSeries = cons0 U1+ gSeries = pure U1 {-# INLINE gSeries #-} instance GCoSerial m U1 where gCoseries rs = constM rs@@ -391,6 +391,9 @@ R1 y -> g y {-# INLINE gCoseries #-} +instance GSerial m f => GSerial m (C1 c f) where+ gSeries = M1 <$> decDepth gSeries+ {-# INLINE gSeries #-} -- }}} ------------------------------@@ -465,19 +468,19 @@ coseries rs >>- \f -> return $ \c -> f (N (fromEnum c - fromEnum 'a')) -instance (Monad m, Serial m a, Serial m b) => Serial m (a,b) where+instance (Serial m a, Serial m b) => Serial m (a,b) where series = cons2 (,)-instance (Monad m, CoSerial m a, CoSerial m b) => CoSerial m (a,b) where+instance (CoSerial m a, CoSerial m b) => CoSerial m (a,b) where coseries rs = uncurry <$> alts2 rs -instance (Monad m, Serial m a, Serial m b, Serial m c) => Serial m (a,b,c) where+instance (Serial m a, Serial m b, Serial m c) => Serial m (a,b,c) where series = cons3 (,,)-instance (Monad m, CoSerial m a, CoSerial m b, CoSerial m c) => CoSerial m (a,b,c) where+instance (CoSerial m a, CoSerial m b, CoSerial m c) => CoSerial m (a,b,c) where coseries rs = uncurry3 <$> alts3 rs -instance (Monad m, Serial m a, Serial m b, Serial m c, Serial m d) => Serial m (a,b,c,d) where+instance (Serial m a, Serial m b, Serial m c, Serial m d) => Serial m (a,b,c,d) where series = cons4 (,,,)-instance (Monad m, CoSerial m a, CoSerial m b, CoSerial m c, CoSerial m d) => CoSerial m (a,b,c,d) where+instance (CoSerial m a, CoSerial m b, CoSerial m c, CoSerial m d) => CoSerial m (a,b,c,d) where coseries rs = uncurry4 <$> alts4 rs instance Monad m => Serial m Bool where@@ -488,15 +491,15 @@ rs >>- \r2 -> return $ \x -> if x then r1 else r2 -instance (Monad m, Serial m a) => Serial m (Maybe a) where+instance (Serial m a) => Serial m (Maybe a) where series = cons0 Nothing \/ cons1 Just-instance (Monad m, CoSerial m a) => CoSerial m (Maybe a) where+instance (CoSerial m a) => CoSerial m (Maybe a) where coseries rs = maybe <$> alts0 rs <~> alts1 rs -instance (Monad m, Serial m a, Serial m b) => Serial m (Either a b) where+instance (Serial m a, Serial m b) => Serial m (Either a b) where series = cons1 Left \/ cons1 Right-instance (Monad m, CoSerial m a, CoSerial m b) => CoSerial m (Either a b) where+instance (CoSerial m a, CoSerial m b) => CoSerial m (Either a b) where coseries rs = either <$> alts1 rs <~> alts1 rs @@ -508,11 +511,11 @@ alts2 rs >>- \f -> return $ \xs -> case xs of [] -> y; x:xs' -> f x xs' -instance (CoSerial m a, Serial m b, Monad m) => Serial m (a->b) where+instance (CoSerial m a, Serial m b) => Serial m (a->b) where series = coseries series -- Thanks to Ralf Hinze for the definition of coseries -- using the nest auxiliary.-instance (Serial m a, CoSerial m a, Serial m b, CoSerial m b, Monad m) => CoSerial m (a->b) where+instance (Serial m a, CoSerial m a, Serial m b, CoSerial m b) => CoSerial m (a->b) where coseries r = do args <- unwind series
smallcheck.cabal view
@@ -1,5 +1,5 @@ Name: smallcheck-Version: 1.0.1+Version: 1.0.2 Cabal-Version: >= 1.6 License: BSD3 License-File: LICENSE@@ -27,7 +27,7 @@ Source-repository this type: git location: git://github.com/feuerbach/smallcheck.git- tag: v1.0.1+ tag: v1.0.2 Library