úΫ5¢2      !"#$%&'()*+,-./01Safe¸*A set of laws associated with a typeclass.+Name of the typeclass whose laws are testedPairs of law name and property623456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abc 23456789:;<=>?@ABCDEFGHIJKLMNOPQSafeVÕTests the following properties: Conjunction Idempotence n .&. n "a nDisjunction Idempotence n .|. n "a nDouble Complementcomplement (complement n) "a nSet BitsetBit n i "a n .|. bit i Clear Bit'clearBit n i "a n .&. complement (bit i)Complement Bit!complementBit n i "a xor n (bit i) Clear ZeroclearBit zeroBits i "a zeroBitsSet ZerosetBit zeroBits i "a bit i Test ZerotestBit zeroBits i "a FalsePop ZeropopCount zeroBits "a 0Count Leading Zeros of Zero,countLeadingZeros zeroBits "a finiteBitSize "¥Count Trailing Zeros of Zero-countTrailingZeros zeroBits "a finiteBitSize "¥#All of the useful instances of the d typeclass also have eL instances, so these property tests actually require that instance as well.Note:2 This property test is only available when using base-4.7 or newer.fgSafeV\Tests the following h properties: Identityi j j "a jFirst Identityk j "a jSecond Identityl j "a jBifunctor Compositioni f g "a k f . l g NoteH: This property test is only available when this package is built with  base-4.9+ or transformers-0.5+.SafeV+Tests the following applicative properties: Identitym j n v "a v Compositionm (.) n u n v n w "a u n (v n w) Homomorphismm f n m x "a m (f x) Interchangeu n m y "a m (o y) n u LiftA2 (1)(n) "a p jSafeVw+Tests the following alternative properties: Identityq r x "a x x r q "a x Associativitya r (b r c) "a (a r b) r c)SafeV ;#Tests the following alt properties:  Associativity(a <!> b) <!> c "a a <!> (b <!> c)Left Distributivity@f s (a <!> b) = (f s a) <!> (f s b) SafeV&5 Tests the following properties:  Transitivea == b "' b == c !Ò a == c Symmetrica == b !Ò b == a Reflexivea == aûSome of these properties involve implication. In the case that the left hand side of the implication arrow does not hold, we do not retry. Consequently, these properties only end up being useful when the data type has a small number of inhabitants.  SafeV/ñ Tests the following t properties: foldfold "a u jfoldMapu f "a v (w . f) xfoldrv f z t "a y (u (z . f) t ) zfoldr'foldr' f z0 xs = let f' k x z = k { f x z in | f' j xs z0foldr1}! f t "a let Just (xs,x) = unsnoc (toList t) in v f x xsfoldl| f z t "a y (~ (u ( . z . € f) t)) zfoldl'foldl' f z0 xs "a let f' x k z = k { f z x in v f' j xs z0foldl1 f t "a let x : xs = toList t in | f x xstoList‚ "a v (:) []nullƒ "a v („ („ …)) †length‡ "a getSum . foldMap („ (ˆ 1))%Note that this checks to ensure that foldl' and foldr' are suitably strict.  SafeV2 'Tests the following functor properties: Identity‰ j "a j Compositionfmap (f . g) "a ‰ f . ‰ gConst(<$) "a ‰ „  SafeV5/ Tests the following properties: Quotient Remainder(quot x y) * y + (rem x y) "a xDivision Modulus(div x y) * y + (mod x y) "a xInteger RoundtripfromInteger (toInteger x) "a x None <FQTVJY Tests the following properties: Partial IsomorphismfromList . toList "a idLength Preservation&fromList xs "a fromListN (length xs) xsNote:2 This property test is only available when using base-4.7 or newer.Property for the generate^ function, which builds a container of a given length by applying a function to each index.Property for the filterD function, which keeps elements for which the predicate holds true.Property for the filterM^ function, which keeps elements for which the predicate holds true in an applicative context.Property for the mapMaybeD function, which keeps elements for which the predicate holds true.input element typefoldr functioninput element typefoldl functioninput element typemonadic foldl functioninput element typeoutput element type map functioninput element typeoutput element typeindexed map functioninput element typeoutput element typemonadic indexed map functioninput element typeoutput element typetraverse functioninput element typeinput element typeinput element typeinput element type element type map function element typetraverse functioninput element typeoutput element type map functioninput element typeoutput element typetraverse function   NoneVNÃTests the following properties: Partial Isomorphismdecode . encode "a JustEncoding Equals Valuedecode . encode "a Just . toJSON8Note that in the second property, the type of decode is ByteString -> Value, not ByteString -> aSafeVQÙ'Tests the following monadic properties:  Left IdentityŠ a ‹ k "a k aRight Identitym ‹ Š "a m Associativitym ‹ (\x -> k x ‹ h) "a (m ‹ k) ‹ hReturnm "a ŠAp(n) "a ŒSafeVUA*Tests the following monad plus properties:  Left Identity empty x "a xRight Identity x empty "a x Associativity a ( b c) "a  ( a b) c)  Left ZeroŽ ‹ f "a Ž Right Zerom >> Ž "a ŽSafeVXÕ /Tests the following monadic zipping properties:  Naturality=liftM (f *** g) (mzip ma mb) = mzip (liftM f ma) (liftM g mb)&In the laws above, the infix function ***" refers to a typeclass method of Arrow. SafeV]Ó!Tests the following properties:  Associative1mappend a (mappend b c) "a mappend (mappend a b) c Left Identitymappend mempty a "a aRight Identitymappend a mempty "a a Concatenation$mconcat as "a foldr mappend mempty as"Tests everything from ! plus the following:  Commutativemappend a b "a mappend b a!"SafeV`$#Tests the following properties:  Antisymmetry@a "d b "' b "d a !Ò a = b  Transitivitya "d b "' b "d c !Ò a "d cTotality a "d b "( a > b#None DFTVf©$ Test that a  instance obey the several laws.destination pointer source arrayoffset into source arraynumber of prims to copy‘destination arrayoffset into destination array source arrayoffset into source arraynumber of bytes to copy’destination arrayoffset into destination array source arrayoffset into source arraynumber of bytes to copy$“”•–SafeVi•%Tests the following properties:  Associativea <> (b <> c) "a (a <> b) <> c Concatenationsconcat as "a foldr1 (<>) asTimes(stimes n a "a foldr1 (<>) (replicate n a)%NoneVqå—Tests the following properties: Additive Commutativity a + b "a b + aAdditive Left Identity 0 + a "a aAdditive Right Identity a + 0 "a aMultiplicative Associativitya * (b * c) "a (a * b) * cMultiplicative Left Identity 1 * a "a aMultiplicative Right Identity a * 1 "a a-Multiplication Left Distributes Over Additiona * (b + c) "a (a * b) + (a * c).Multiplication Right Distributes Over Addition(a + b) * c "a (a * c) + (b * c) Multiplicative Left Annihilation 0 * a "a 0!Multiplicative Right Annihilation a * 0 "a 0—SafeVr:&None DFTVrÇ'SafeV|ò(Tests the following ˜ properties:  Naturalityt . ™ f = ™ (t . f)) for every applicative transformation tIdentity™ Identity = Identity Composition™ (Compose . ‰ g . f) = Compose . ‰ (™ g) . ™ fSequence Naturalityt . š = š . ‰ t) for every applicative transformation tSequence Identityš . ‰ Identity = IdentitySequence Compositionš . ‰ Compose = Compose . ‰ š . šfoldMapu = ›fmap‰ = œ Where an applicative transformation is a function 1t :: (Applicative f, Applicative g) => f a -> g apreserving the  operations, i.e. Identity: t (m x) = m xDistributivity: t (x n y) = t x n t y(NoneF ì)LIn older versions of GHC, Proxy is not poly-kinded, so we provide Proxy2.+LIn older versions of GHC, Proxy is not poly-kinded, so we provide Proxy1.-MA convenience function for testing properties in GHCi. For example, at GHCi:0lawsCheck (monoidLaws (Proxy :: Proxy Ordering))-Monoid: Associative +++ OK, passed 100 tests./Monoid: Left Identity +++ OK, passed 100 tests.0Monoid: Right Identity +++ OK, passed 100 tests.Assuming that the ž instance for Ÿ+ is good, we now have confidence that the   instance for Ÿ satisfies the monoid laws..[A convenience function that allows one to check many typeclass instances of the same type.GspecialisedLawsCheckMany (Proxy :: Proxy Word) [jsonLaws, showReadLaws]@ToJSON/FromJSON: Encoding Equals Value +++ OK, passed 100 tests.>ToJSON/FromJSON: Partial Isomorphism +++ OK, passed 100 tests.8Show/Read: Partial Isomorphism +++ OK, passed 100 tests./‚A convenience function for checking multiple typeclass instances of multiple types. Consider the following Haskell source file: Pimport Data.Proxy (Proxy(..)) import Data.Map (Map) import Data.Set (Set) -- A ¡ for Set ¢2. setInt :: Proxy (Set Int) setInt = Proxy -- A ¡ for Map ¢ ¢å. mapInt :: Proxy (Map Int Int) mapInt = Proxy myLaws :: Proxy a -> [Laws] myLaws p = [eqLaws p, monoidLaws p] namedTests :: [(String, [Laws])] namedTests = [ ("Set Int", myLaws setInt) , ("Map Int Int", myLaws mapInt) ]  Now, in GHCi:lawsCheckMany namedTests ÿýTesting properties for common typeclasses ------------- -- Set Int -- ------------- Eq: Transitive +++ OK, passed 100 tests. Eq: Symmetric +++ OK, passed 100 tests. Eq: Reflexive +++ OK, passed 100 tests. Monoid: Associative +++ OK, passed 100 tests. Monoid: Left Identity +++ OK, passed 100 tests. Monoid: Right Identity +++ OK, passed 100 tests. Monoid: Concatenation +++ OK, passed 100 tests. ----------------- -- Map Int Int -- ----------------- Eq: Transitive +++ OK, passed 100 tests. Eq: Symmetric +++ OK, passed 100 tests. Eq: Reflexive +++ OK, passed 100 tests. Monoid: Associative +++ OK, passed 100 tests. Monoid: Left Identity +++ OK, passed 100 tests. Monoid: Right Identity +++ OK, passed 100 tests. Monoid: Concatenation +++ OK, passed 100 tests. //Element is type name paired with typeclass laws!  !"#$%&'()*+,-./!-/." !#$%&'  (+,)*)*+,£¤¥¦ ! " # $%&'()*+,-./01234 56789:;<=>?@AABBCDEFGHHIJKKLMNOOPPQRSSTUUVWXYZZ[[\\]]^_`abcdefghijklmnopqrpqsttpuvpuwpxypuzpu{px|px}px~pxpx€pxp‚ƒp„…p„†p„‡pxˆpx‰pŠ‹pŠŒpxp„Žp„pŠpŠ‘px’p„“p„”p„•px–—˜™—˜šp„›pŠœpxpxžpxŸpx px¡px¢£¤¥¦§¨©©ªª«p¬­p¬®p¬¯p¬°p¬±px²³´µ—˜¶px·p¸¹—˜º»¼½¾2quickcheck-classes-0.4.11.1-JiJlHUE2KR9IuIe63IXzMETest.QuickCheck.ClassesTest.QuickCheck.Classes.IsListTest.QuickCheck.Classes.CommonTest.QuickCheck.Classes.Bits!Test.QuickCheck.Classes.Bifunctor#Test.QuickCheck.Classes.Applicative#Test.QuickCheck.Classes.AlternativeTest.QuickCheck.Classes.AltTest.QuickCheck.Classes.Eq Test.QuickCheck.Classes.FoldableTest.QuickCheck.Classes.Functor Test.QuickCheck.Classes.IntegralTest.QuickCheck.Classes.JsonTest.QuickCheck.Classes.Monad!Test.QuickCheck.Classes.MonadPlus Test.QuickCheck.Classes.MonadZipTest.QuickCheck.Classes.MonoidTest.QuickCheck.Classes.OrdTest.QuickCheck.Classes.Prim!Test.QuickCheck.Classes.Semigroup Test.QuickCheck.Classes.Semiring Test.QuickCheck.Classes.ShowRead Test.QuickCheck.Classes.Storable#Test.QuickCheck.Classes.TraversableLaws lawsTypeclasslawsPropertiesbitsLaws bifunctorLawsapplicativeLawsalternativeLawsaltLawseqLaws foldableLaws functorLaws integralLaws isListLaws foldrProp foldlProp foldlMPropmapPropimapProp imapMProp traverseProp generateProp generateMProp replicatePropreplicateMProp filterProp filterMProp mapMaybeProp mapMaybeMPropjsonLaws monadLaws monadPlusLaws monadZipLaws monoidLawscommutativeMonoidLawsordLawsprimLaws semigroupLaws showReadLaws storableLawstraversableLawsProxy2Proxy1 lawsCheckspecialisedLawsCheckMany lawsCheckMany$fMonoidStatus$fSemigroupStatusLinearEquationTwo_linearEquationTwoX_linearEquationTwoYQuadraticEquation_quadraticEquationQuadratic_quadraticEquationLinear_quadraticEquationConstantLinearEquationMLinearEquation_linearEquationLinear_linearEquationConstantApply2 getApply2ApplygetApplyBottomBottomUndefined BottomValue LastNothing ChooseFirst ChooseSecondTriplemyForAllShrink nestedEq1 propNestedEq1toSpecialApplicativeflipPairapTransfunc1func2func3func4func5func6 reverseTriplefoldMapArunLinearEquationrunLinearEquationMrunQuadraticEquationrunLinearEquationTwobase Data.BitsBits FiniteBitsBitIndexData.Bifunctor BifunctorbimapGHC.Baseidfirstsecondpure<*>$liftA2empty<|> Data.Functor<$> Data.FoldableFoldablefoldMapfoldrmappendmempty Data.MonoidappEndoEndo$!foldlfoldr1getDualDualflipfoldl1toListnullconstghc-prim GHC.TypesFalseTruelengthSumfmapreturn>>=apmplusmzero(primitive-0.6.2.0-EI3NK1Xfv9zEcRtyXK2EwZData.Primitive.TypesPrimcopyPrimArrayToPtrcopyMutablePrimArray copyPrimArrayMutablePrimArray PrimArray semiringLawsData.Traversable Traversabletraverse sequenceAfoldMapDefault fmapDefault Applicative(QuickCheck-2.10.1-BUFYQzp5Pjm7JbQeTzW89lTest.QuickCheck.Arbitrary ArbitraryOrderingMonoid Data.ProxyProxyIntStatusBadGood