happstack-ixset 0.2.1 → 0.3.1
raw patch · 2 files changed
+22/−5 lines, 2 filesdep ~happstack-datadep ~happstack-utilPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: happstack-data, happstack-util
API changes (from Hackage documentation)
+ Happstack.Data.IxSet: null :: IxSet a -> Bool
Files
- happstack-ixset.cabal +9/−4
- src/Happstack/Data/IxSet.hs +13/−1
happstack-ixset.cabal view
@@ -1,5 +1,5 @@ Name: happstack-ixset-Version: 0.2.1+Version: 0.3.1 Synopsis: Efficient relational queries on Haskell sets. Description: Just pick which parts of your data structures you want indexed using an easy to use template-haskell function. Spare yourself the need to write, run, and maintain code that marshalls your data to/from an external relational database just for efficient queries. happstack-ixset relies on generics and TH to spare you the boilerplate normally required for such tasks. License: BSD3@@ -9,8 +9,13 @@ homepage: http://happstack.com Category: Web, Distributed Computing Build-Type: Simple-Cabal-Version: >= 1.2.3+Cabal-Version: >= 1.6 +source-repository head+ type: darcs+ subdir: happstack-ixset+ location: http://patch-tag.com/publicrepos/happstack+ flag base4 Flag tests@@ -24,8 +29,8 @@ Build-Depends: base < 4 Build-Depends: containers,- happstack-data >= 0.2.1 && < 0.3,- happstack-util >= 0.2.1 && < 0.3,+ happstack-data >= 0.3.1 && < 0.4,+ happstack-util >= 0.3.1 && < 0.4, mtl, syb-with-class, template-haskell
src/Happstack/Data/IxSet.hs view
@@ -163,6 +163,12 @@ noCalcs :: t -> () noCalcs _ = () +{- | Helper function for automatically building an Indexable instance+ from a data type, e.g. @data Foo = Foo Int String@ and+ @$(inferIxSet "FooDB" ''Foo 'noCalcs [''Int,''String])@ will + build a type synonym @type FooDB = IxSet Foo@ with @Int@ and+ @String@ as indexes.+-} inferIxSet :: String -> TH.Name -> TH.Name -> [TH.Name] -> Q [Dec] inferIxSet ixset typeName calName entryPoints = do calInfo <- reify calName@@ -287,6 +293,13 @@ getOneOr :: Ord a => a -> IxSet a -> a getOneOr def = fromMaybe def . getOne +-- | return True if the IxSet is empty, False otherwise.+null :: IxSet a -> Bool+null (IxSet (Ix ix:_)) = Map.null ix+null (ISet lst) = List.null lst+null (IxSet []) = True+null _ = error "IxSet.null: unexpected match"+ -- set operations -- | An infix intersection operation@@ -469,4 +482,3 @@ instance (Show a,Indexable a b,Data a,Ord a) => Monoid (IxSet a) where mempty=empty mappend = union-