packages feed

commutative 0.0.1.3 → 0.0.1.4

raw patch · 3 files changed

+20/−9 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

commutative.cabal view
@@ -1,5 +1,5 @@ Name:                   commutative-Version:                0.0.1.3+Version:                0.0.1.4 Author:                 Athan Clark <athan.clark@gmail.com> Maintainer:             Athan Clark <athan.clark@gmail.com> License:                MIT
src/Data/Commutative.hs view
@@ -4,7 +4,15 @@  module Data.Commutative where -import Data.Monoid (Any (..), All (..), First (..), Last (..), Sum (..), Product (..))+import Data.Monoid ( Any (..)+                   , All (..)+                   , First (..)+                   , Last (..)+                   , Sum (..)+                   , Product (..)+                   , mappend+                   )+import Control.Applicative import System.IO.Unsafe (unsafePerformIO) import System.Random (randomIO) 
test/Data/CommutativeSpec.hs view
@@ -1,10 +1,13 @@ module Data.CommutativeSpec (spec) where +import Prelude hiding (foldr) import Data.Commutative-import Data.Mergeable import Data.Monoid+import Data.Mergeable+import Data.Foldable import Data.Maybe (isJust) import Data.List (permutations)+import Control.Applicative  import Test.Tasty import Test.Tasty.QuickCheck as QC@@ -31,7 +34,7 @@     , QC.testProperty "`Product`  should have id" (lridentity :: Product Int -> Bool)     ]   , testGroup "Mergeable"-    [ QC.testProperty "Lists should merge" (merges :: Under10 (Sum Int) -> Bool )]+    [ QC.testProperty "Lists should merge" (merges :: Under5 (Sum Int) -> Bool )]   ]  commutes :: (Eq a, Commutative a) => a -> a -> Bool@@ -41,17 +44,17 @@ lridentity x = x <~> cempty == x             && cempty <~> x == x -merges :: (Eq a, CommutativeId a) => Under10 a -> Bool-merges (Under10 xs) = let merge' = merge (<~>) cempty+merges :: (Eq a, CommutativeId a) => Under5 a -> Bool+merges (Under5 xs) = let merge' = merge (<~>) cempty                       in equal $ map merge' $ permutations xs  ----------------------------- -newtype Under10 a = Under10 {unUnder10 :: [a]}+newtype Under5 a = Under5 {unUnder5 :: [a]}   deriving (Show, Eq) -instance Arbitrary a => Arbitrary (Under10 a) where-  arbitrary = Under10 <$> arbitrary `suchThat` (\x -> length x < 10)+instance Arbitrary a => Arbitrary (Under5 a) where+  arbitrary = Under5 <$> arbitrary `suchThat` (\x -> length x < 5)  instance Arbitrary Any where   arbitrary = Any <$> arbitrary