partial-order 0.1.2.1 → 0.2.0.0
raw patch · 4 files changed
+30/−8 lines, 4 filesdep ~HUnitdep ~containersPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: HUnit, containers
API changes (from Hackage documentation)
- Data.PartialOrd: instance GHC.Classes.Ord a => Data.PartialOrd.PartialOrd (Data.Set.Base.Set a)
+ Data.PartialOrd: instance GHC.Classes.Ord a => Data.PartialOrd.PartialOrd (Data.Set.Internal.Set a)
- Data.PartialOrd: class PartialOrd a where a >= a' = a' <= a a == a' = a <= a' && a' <= a a /= a' = not (a == a') a < a' = a <= a' && (a /= a') a > a' = a' <= a && (a /= a') compare a a' = if | a == a' -> Just EQ | a <= a' -> Just LT | a >= a' -> Just GT | otherwise -> Nothing
+ Data.PartialOrd: class PartialOrd a
Files
- LICENSE +1/−1
- partial-order.cabal +21/−6
- src/Data/PartialOrd.hs +4/−0
- test/Spec.hs +4/−1
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2016-2017 Moritz Schulte+Copyright (c) 2016-2020 Moritz Clasmeier All rights reserved. Redistribution and use in source and binary forms, with or without
partial-order.cabal view
@@ -1,5 +1,5 @@ name: partial-order-version: 0.1.2.1+version: 0.2.0.0 synopsis: Provides typeclass suitable for types admitting a partial order description: This packages provides the PartialOrd typeclass suitable for types admitting a partial order.@@ -13,34 +13,49 @@ homepage: https://github.com/mtesseract/haskell-partial-order license: BSD3 license-file: LICENSE-author: Moritz Schulte+author: Moritz Clasmeier maintainer: mtesseract@silverratio.net-copyright: (c) 2016-2017 Moritz Schulte+copyright: (c) 2016-2020 Moritz Clasmeier category: Data build-type: Simple -- extra-source-files: cabal-version: >=1.10 +flag extra-instances+ description:+ Include additional instances of PartialOrd in Data.Set+ library hs-source-dirs: src exposed-modules: Data.PartialOrd build-depends: base >= 4.7 && < 5- , containers >= 0.5.0.0 && < 0.6 default-language: Haskell2010 + default-extensions: CPP++ if flag(extra-instances)+ build-depends: containers >= 0.5.0.0 && < 0.7+ CPP-Options: -DEXTRA_INSTANCES+ test-suite partial-order-test type: exitcode-stdio-1.0 hs-source-dirs: test main-is: Spec.hs build-depends: base , partial-order- , HUnit >= 1.5.0.0 && < 1.6+ , HUnit >= 1.5.0.0 && < 1.7 , test-framework >= 0.8.1.1 && < 0.9 , test-framework-hunit >= 0.3.0.2 && < 0.4 , test-framework-quickcheck2 >= 0.3.0.3 && < 0.4- , containers >= 0.5.0.0 && < 0.6+ , containers >= 0.5.0.0 && < 0.7 ghc-options: -threaded -rtsopts -with-rtsopts=-N default-language: Haskell2010++ default-extensions: CPP++ if flag(extra-instances)+ build-depends: containers >= 0.5.0.0 && < 0.7+ CPP-Options: -DEXTRA_INSTANCES source-repository head type: git
src/Data/PartialOrd.hs view
@@ -30,7 +30,9 @@ import qualified Data.Ord as Ord import qualified Data.Eq as Eq import qualified Data.List as List+#if EXTRA_INSTANCES import qualified Data.Set as Set+#endif import qualified Data.Foldable as Foldable class PartialOrd a where@@ -82,9 +84,11 @@ instance PartialOrd Float where (<=) = (Ord.<=) +#if EXTRA_INSTANCES -- | Define the partial order in terms of the subset relation. instance (Ord.Ord a) => PartialOrd (Set.Set a) where (<=) = Set.isSubsetOf+#endif -- | Define the partial order in terms of the sublist relation. instance PartialOrd a => PartialOrd [a] where
test/Spec.hs view
@@ -5,7 +5,9 @@ import Test.Framework.Providers.QuickCheck2 (testProperty) import Data.List import Data.Ord+#if EXTRA_INSTANCES import qualified Data.Set as S+#endif import qualified Data.PartialOrd as PO import Test.HUnit ((@?=)) @@ -56,6 +58,7 @@ , testProperty "antisymmetry" (\ a b -> prop_antisymmetry (a :: [Int]) (b :: [Int])) ]+#if EXTRA_INSTANCES , testGroup "Set Properties" [ testProperty "=="@@ -83,7 +86,7 @@ , testProperty "antisymmetry" (\ a b -> prop_antisymmetry (a :: S.Set Int) (b :: S.Set Int)) ]-+#endif , testGroup "Maxima & Minima" [ testProperty "maxima exist"