sets 0.0.5 → 0.0.5.1
raw patch · 8 files changed
+31/−72 lines, 8 filesdep +setsdep −invariantdep ~basedep ~commutativedep ~containerssetup-changed
Dependencies added: sets
Dependencies removed: invariant
Dependency ranges changed: base, commutative, containers
Files
- Setup.hs +2/−0
- sets.cabal +9/−51
- src/Data/Set/Class.hs +2/−2
- src/Data/Set/Ordered/Many/With.hs +3/−3
- src/Data/Set/Ordered/Unique/Finite.hs +1/−1
- src/Data/Set/Ordered/Unique/With.hs +6/−5
- src/Data/Set/Unordered/Many.hs +7/−8
- src/Data/Set/Unordered/Unique.hs +1/−2
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
sets.cabal view
@@ -1,11 +1,11 @@ Name: sets-Version: 0.0.5+Version: 0.0.5.1 Author: Athan Clark <athan.clark@gmail.com> Maintainer: Athan Clark <athan.clark@gmail.com> License: MIT License-File: LICENSE-Synopsis: Various set implementations in Haskell.-Description: This also includes overloaded functions for common set operations. See @Data.Set.Class@.+Synopsis: Ducktyped set interface for Haskell containers.+Description: Includes overloaded functions for common set operations. See @Data.Set.Class@. Cabal-Version: >= 1.10 Build-Type: Simple Category: Data, Math@@ -29,7 +29,7 @@ , commutative >= 0.0.1.4 , composition , contravariant- , invariant+-- , invariant , witherable , keys , semigroups@@ -42,54 +42,26 @@ Test-Suite spec Type: exitcode-stdio-1.0 Default-Language: Haskell2010- Hs-Source-Dirs: src- , test+ Hs-Source-Dirs: test Ghc-Options: -Wall -threaded Main-Is: Main.hs Other-Modules: Data.SetSpec- Data.Set.Class- Data.Set.Ordered.Many- Data.Set.Ordered.Many.With- Data.Set.Ordered.Unique.Finite- Data.Set.Ordered.Unique.With- Data.Set.Unordered.Many- Data.Set.Unordered.Unique Build-Depends: base+ , sets , tasty , tasty-quickcheck , tasty-hunit , QuickCheck , quickcheck-instances- , containers- , unordered-containers- , hashable- , commutative- , composition- , contravariant- , semigroups- , semigroupoids- , keys- , invariant- , witherable- , mtl- , transformers- , transformers-base Benchmark bench Type: exitcode-stdio-1.0 Default-Language: Haskell2010- Hs-Source-Dirs: src- , bench+ Hs-Source-Dirs: bench Ghc-Options: -Wall -threaded Main-Is: Profile.hs- Other-Modules: Data.Set.Class- Data.Set.Ordered.Many- Data.Set.Ordered.Unique.Finite- Data.Set.Ordered.Unique.With- Data.Set.Unordered.Many- Data.Set.Unordered.Unique- Data.Set.Data+ Other-Modules: Data.Set.Data Data.Map.Data Data.IntSet.Data Data.IntMap.Data@@ -97,21 +69,7 @@ Data.Set.Unordered.Many.Data Data.Set.Unordered.Unique.Data Build-Depends: base- , QuickCheck- , containers- , unordered-containers- , hashable- , commutative- , composition- , contravariant- , invariant- , witherable- , semigroups- , semigroupoids- , keys- , mtl- , transformers- , transformers-base+ , sets , criterion Source-Repository head
src/Data/Set/Class.hs view
@@ -23,7 +23,6 @@ import Data.Traversable import Data.Semigroup.Foldable as Fold1 import Data.Semigroup-import Data.Monoid as Monoid import Data.Key import Data.Commutative as Comm import Data.Composition@@ -148,7 +147,8 @@ instance (HasUnion s, HasIntersection s, HasDifference s) => HasXUnion s where xunion x y = union x y `difference` intersection x y -instance (HasXUnion s, HasUnion s, HasIntersection s, HasDifference s) => Commutative (XUnion s) where+instance ( HasXUnion s, HasUnion s+ , HasIntersection s, HasDifference s) => Commutative (XUnion s) where commute = xunion instance (HasXUnion s, HasEmpty s, HasUnion s, HasIntersection s, HasDifference s) => Monoid (XUnion s) where
src/Data/Set/Ordered/Many/With.hs view
@@ -18,15 +18,15 @@ import Data.Monoid import Data.Maybe (isJust)-import Data.Functor.Invariant+--import Data.Functor.Invariant import Data.Foldable as Fold hiding (and) import Control.Applicative hiding (empty) newtype SetsWith k c a = SetsWith {unSetsWith :: (a -> k, Map.Map k (c a))} -instance Functor c => Invariant (SetsWith k c) where- invmap = map+--instance Functor c => Invariant (SetsWith k c) where+-- invmap = map instance Fold.Foldable c => Fold.Foldable (SetsWith k c) where foldr = Data.Set.Ordered.Many.With.foldr
src/Data/Set/Ordered/Unique/Finite.hs view
@@ -16,7 +16,7 @@ -- * Query -- | /O(1)/-null :: Eq a => FiniteSet a -> Bool+null :: FiniteSet a -> Bool null (FiniteSet (_,xs)) = Set.null xs -- | /O(1)/
src/Data/Set/Ordered/Unique/With.hs view
@@ -13,12 +13,13 @@ module Data.Set.Ordered.Unique.With where -import Prelude (Show, String, Eq, Ord, Bool, Int, Maybe, fmap, not, fst, snd, zip, (.), ($), foldr)+import Prelude ( Show, String, Eq, Ord, Bool, Int, Maybe+ , fmap, not, fst, snd, zip, (.), ($), foldr) import qualified Data.Map as Map import qualified Data.List as List import Data.Maybe (isJust) import qualified Data.Foldable as Fold-import Data.Functor.Invariant+--import Data.Functor.Invariant import Control.Applicative ((<$>)) import Data.Monoid (Monoid) @@ -26,8 +27,8 @@ newtype SetWith k a = SetWith {unSetWith :: (a -> k, Map.Map k a)} deriving (Monoid) -instance Invariant (SetWith k) where- invmap = map+--instance Invariant (SetWith k) where+-- invmap = map instance Fold.Foldable (SetWith k) where foldr = Data.Set.Ordered.Unique.With.foldr@@ -115,7 +116,7 @@ splitMember x (SetWith (f,xs)) = let (l,b,r) = Map.splitLookup (f x) xs in (SetWith (f,l), isJust b, SetWith (f,r)) -splitRoot :: Ord k => SetWith k a -> [SetWith k a]+splitRoot :: SetWith k a -> [SetWith k a] splitRoot (SetWith (f,xs)) = let xss = Map.splitRoot xs in fmap (\a -> SetWith (f,a)) xss
src/Data/Set/Unordered/Many.hs view
@@ -8,8 +8,7 @@ import Data.Mergeable import Data.List as List hiding (delete) import qualified Data.List as List-import Data.Maybe (fromJust, isJust, mapMaybe)-import Control.Applicative+import Data.Maybe (mapMaybe) import Control.Monad import Test.QuickCheck@@ -51,7 +50,7 @@ -- * Query -- | /O(1)/-null :: Eq a => UMSet a -> Bool+null :: UMSet a -> Bool null (UMSet xs) = List.null xs -- | /O(n)/@@ -68,11 +67,11 @@ -- | /O(n)/ lookup :: Eq a => a -> UMSet a -> Maybe a-lookup x (UMSet xs) = lookup' x xs+lookup x (UMSet xs) = lookup' xs where- lookup' _ [] = Nothing- lookup' x (y:ys) | x == y = Just y- | otherwise = lookup' x ys+ lookup' [] = Nothing+ lookup' (y:ys) | x == y = Just y+ | otherwise = lookup' ys -- | /O(n*m)/ isSubsetOf :: Eq a => UMSet a -> UMSet a -> Bool@@ -112,7 +111,7 @@ -- * Combine -- | /O(n)/-union :: Eq a => UMSet a -> UMSet a -> UMSet a+union :: UMSet a -> UMSet a -> UMSet a union (UMSet xs) (UMSet ys) = UMSet $ xs ++ ys -- | /O(n*m)/
src/Data/Set/Unordered/Unique.hs view
@@ -16,7 +16,6 @@ import Data.Maybe (fromJust, isJust, mapMaybe) import Control.Monad.State import Control.Monad.Base-import Control.Applicative import Test.QuickCheck @@ -63,7 +62,7 @@ -- * Query -- | /O(1)/-null :: Eq a => UUSet a -> Bool+null :: UUSet a -> Bool null (UUSet xs) = List.null xs -- | /O(n)/