leancheck 0.9.6 → 0.9.8
raw patch · 4 files changed
+73/−2 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- changelog.md +7/−0
- leancheck.cabal +2/−2
- src/Test/LeanCheck/Utils/Types.hs +5/−0
- test/types.hs +59/−0
changelog.md view
@@ -1,6 +1,13 @@ Changelog for LeanCheck ======================= +v0.9.8+------++* `Test.LeanCheck.Utils.Type`: Typeable instances on GHC 7.10.+ Behaviour on newer GHCs (>= 8.0) versions is unaffected+ as they automatically derive Typeable instances for all types.+ v0.9.6 ------
leancheck.cabal view
@@ -11,7 +11,7 @@ -- this cabal file too complicated. -- Rudy name: leancheck-version: 0.9.6+version: 0.9.8 synopsis: Enumerative property-based testing description: LeanCheck is a simple enumerative property-based testing library.@@ -89,7 +89,7 @@ source-repository this type: git location: https://github.com/rudymatela/leancheck- tag: v0.9.6+ tag: v0.9.8 library exposed-modules: Test.LeanCheck
src/Test/LeanCheck/Utils/Types.hs view
@@ -8,6 +8,11 @@ -- a simple enumerative property-based testing library. -- -- Types to aid in property-based testing.+{-# LANGUAGE CPP #-}+#if __GLASGOW_HASKELL__ == 710+{-# LANGUAGE AutoDeriveTypeable #-}+-- from GHC 8.0 onward, Typeable instances are created automatically for all types.+#endif module Test.LeanCheck.Utils.Types ( -- * Integer types
test/types.hs view
@@ -8,6 +8,9 @@ import Data.Word import Data.Int import Data.Char hiding (Space)+#if __GLASGOW_HASKELL__ >= 710+import Data.Typeable (typeOf)+#endif main :: IO () main = do@@ -147,6 +150,8 @@ , holds n $ \(Digits s) -> all isDigit s , holds n $ \(AlphaNums s) -> all isAlphaNum s , holds n $ \(Letters s) -> all isLetter s++ , allTypeable || True ] where unXs (Xs xs) = xs@@ -201,3 +206,57 @@ (_:_) `permutation` [] = False [] `permutation` (_:_) = False (x:xs) `permutation` ys = x `elem` ys && xs `permutation` delete x ys+++allTypeable :: Bool+#if __GLASGOW_HASKELL__ >= 710+allTypeable = True+ where+ _ = [ typeOf (undefined :: Int1)+ , typeOf (undefined :: Int1)+ , typeOf (undefined :: Int2)+ , typeOf (undefined :: Int3)+ , typeOf (undefined :: Int4)+ , typeOf (undefined :: Word1)+ , typeOf (undefined :: Word2)+ , typeOf (undefined :: Word3)+ , typeOf (undefined :: Word4)+ , typeOf (undefined :: Nat)+ , typeOf (undefined :: Nat1)+ , typeOf (undefined :: Nat2)+ , typeOf (undefined :: Nat3)+ , typeOf (undefined :: Nat4)+ , typeOf (undefined :: Nat5)+ , typeOf (undefined :: Nat6)+ , typeOf (undefined :: Nat7)+ , typeOf (undefined :: Natural)+ , typeOf (undefined :: X A)+ , typeOf (undefined :: Xs [A])+ , typeOf (undefined :: NoDup [A])+ , typeOf (undefined :: Bag [A])+ , typeOf (undefined :: Set [A])+ , typeOf (undefined :: Map [A] [A])+ , typeOf (undefined :: Space)+ , typeOf (undefined :: Lower)+ , typeOf (undefined :: Upper)+ , typeOf (undefined :: Alpha)+ , typeOf (undefined :: Digit)+ , typeOf (undefined :: AlphaNum)+ , typeOf (undefined :: Letter)+ , typeOf (undefined :: Spaces)+ , typeOf (undefined :: Lowers)+ , typeOf (undefined :: Uppers)+ , typeOf (undefined :: Alphas)+ , typeOf (undefined :: Digits)+ , typeOf (undefined :: AlphaNums)+ , typeOf (undefined :: Letters)+ , typeOf (undefined :: A)+ , typeOf (undefined :: B)+ , typeOf (undefined :: C)+ , typeOf (undefined :: D)+ , typeOf (undefined :: E)+ , typeOf (undefined :: F)+ ]+#else+allTypeable = False+#endif