ixset-typed 0.5 → 0.5.1.0
raw patch · 5 files changed
+33/−25 lines, 5 filesdep ~template-haskell
Dependency ranges changed: template-haskell
Files
- CHANGELOG.md +5/−0
- ixset-typed.cabal +3/−3
- src/Data/IxSet/Typed.hs +22/−20
- src/Data/IxSet/Typed/Ix.hs +2/−1
- tests/Data/IxSet/Typed/Tests.hs +1/−1
CHANGELOG.md view
@@ -1,3 +1,8 @@+0.5.1.0 (2022-05-10)+====================++- GHC 9.0.2 and 9.2.2 compatibility.+ 0.5 (2020-03-18) ================
ixset-typed.cabal view
@@ -1,5 +1,5 @@ name: ixset-typed-version: 0.5+version: 0.5.1.0 synopsis: Efficient relational queries on Haskell sets. description: This Haskell package provides a data structure of sets that are indexed@@ -26,7 +26,7 @@ build-type: Simple cabal-version: >= 1.10 extra-source-files: CHANGELOG.md-tested-with: GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.3, GHC == 8.6.1, GHC == 8.8.1+tested-with: GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.4, GHC == 8.6.5, GHC == 8.8.4, GHC == 8.10.7, GHC == 9.0.2, GHC == 9.2.2 source-repository head type: git@@ -38,7 +38,7 @@ deepseq >= 1.3 && < 2, safecopy >= 0.8 && < 0.11, syb >= 0.4 && < 1,- template-haskell >= 2.8 && < 2.17+ template-haskell >= 2.8 && < 2.19 hs-source-dirs: src exposed-modules:
src/Data/IxSet/Typed.hs view
@@ -5,12 +5,8 @@ DataKinds, TypeOperators, StandaloneDeriving, TypeFamilies, ScopedTypeVariables, ConstraintKinds, FunctionalDependencies, FlexibleContexts, BangPatterns #-}-#if __GLASGOW_HASKELL__ < 710-{-# LANGUAGE OverlappingInstances #-}-#endif-#if __GLASGOW_HASKELL__ >= 800 {-# LANGUAGE UndecidableSuperClasses #-}-#endif+{-# OPTIONS_GHC -Wno-unused-imports #-} {- | An efficient implementation of queryable sets. @@ -191,11 +187,11 @@ ) where +import Data.Kind import Prelude hiding (null) import Control.Arrow (first, second) import Control.DeepSeq-import Data.Foldable (Foldable) import qualified Data.Foldable as Fold import Data.Generics (Data, gmapQ) -- import qualified Data.Generics.SYB.WithClass.Basics as SYBWC@@ -205,14 +201,12 @@ import Data.Map (Map) import qualified Data.Map as Map import Data.Maybe (fromMaybe)-import Data.Monoid (Monoid(mempty, mappend)) import Data.SafeCopy (SafeCopy(..), contain, safeGet, safePut) import Data.Semigroup (Semigroup(..)) import Data.Set (Set) import qualified Data.Set as Set import Data.Typeable (Typeable, cast {- , typeOf -})-import Language.Haskell.TH as TH-import GHC.Exts (Constraint)+import Language.Haskell.TH as TH hiding (Type) -------------------------------------------------------------------------- -- The main 'IxSet' datatype.@@ -230,10 +224,10 @@ -- times and subsequently selecting the result will not unnecessarily -- rebuild all indices. ---data IxSet (ixs :: [*]) (a :: *) where+data IxSet (ixs :: [Type]) (a :: Type) where IxSet :: !(Set a) -> !(IxList ixs a) -> IxSet ixs a -data IxList (ixs :: [*]) (a :: *) where+data IxList (ixs :: [Type]) (a :: Type) where Nil :: IxList '[] a (:::) :: Ix ix a -> IxList ixs a -> IxList (ix ': ixs) a @@ -274,7 +268,7 @@ -- -- > (Ord Int, Ord Char, Ord Bool) ---type family All (c :: * -> Constraint) (xs :: [*]) :: Constraint+type family All (c :: Type -> Constraint) (xs :: [Type]) :: Constraint type instance All c '[] = () type instance All c (x ': xs) = (c x, All c xs) @@ -296,7 +290,7 @@ -- | Constraint for membership in the type-level list. Says that 'ix' -- is contained in the index list 'ixs'.-class Ord ix => IsIndexOf (ix :: *) (ixs :: [*]) where+class Ord ix => IsIndexOf (ix :: Type) (ixs :: [Type]) where -- | Provide access to the selected index in the list. access :: IxList ixs a -> Ix ix a@@ -314,17 +308,13 @@ -> IxList ixs a -> IxList ixs a instance-#if __GLASGOW_HASKELL__ >= 710 {-# OVERLAPPING #-}-#endif Ord ix => IsIndexOf ix (ix ': ixs) where access (x ::: _xs) = x mapAt fh ft (x ::: xs) = fh x ::: mapIxList ft xs instance-#if __GLASGOW_HASKELL__ >= 710 {-# OVERLAPPABLE #-}-#endif IsIndexOf ix ixs => IsIndexOf ix (ix' ': ixs) where access (_x ::: xs) = access xs mapAt fh ft (x ::: xs) = ft x ::: mapAt fh ft xs@@ -405,11 +395,11 @@ rnf (IxSet a ixs) = rnf a `seq` rnf ixs instance Indexable ixs a => Semigroup (IxSet ixs a) where- (<>) = mappend+ (<>) = union instance Indexable ixs a => Monoid (IxSet ixs a) where mempty = empty- mappend = union+ mappend = (<>) instance Foldable (IxSet ixs) where fold = Fold.fold . toSet@@ -594,7 +584,13 @@ getCalType t' = error ("Unexpected type in getCalType: " ++ pprint t') -} mkEntryPoint n = (conE 'Ix) `appE`- (sigE (varE 'Map.empty) (forallT binders (return context) $+ (sigE (varE 'Map.empty) (forallT+#if MIN_VERSION_template_haskell(2,17,0)+ (map (SpecifiedSpec <$) binders)+#else+ binders+#endif+ (return context) $ appT (appT (conT ''Map) (conT n)) (appT (conT ''Set) typeCon))) `appE` (varE 'flattenWithCalcs `appE` varE calName)@@ -610,9 +606,15 @@ return $ [i, ixType'] -- ++ d _ -> error "IxSet.inferIxSet calInfo unexpected match" +#if MIN_VERSION_template_haskell(2,17,0)+tyVarBndrToName :: TyVarBndr () -> Name+tyVarBndrToName (PlainTV nm _) = nm+tyVarBndrToName (KindedTV nm _ _) = nm+#else tyVarBndrToName :: TyVarBndr -> Name tyVarBndrToName (PlainTV nm) = nm tyVarBndrToName (KindedTV nm _) = nm+#endif -- | Generically traverses the argument to find all occurences of -- values of type @b@ and returns them as a list.
src/Data/IxSet/Typed/Ix.hs view
@@ -24,6 +24,7 @@ import Control.DeepSeq -- import Data.Generics hiding (GT) -- import qualified Data.Generics.SYB.WithClass.Basics as SYBWC+import Data.Kind import qualified Data.List as List import Data.Map (Map) import qualified Data.Map as Map@@ -35,7 +36,7 @@ -- | 'Ix' is a 'Map' from some key (of type 'ix') to a 'Set' of -- values (of type 'a') for that key.-data Ix (ix :: *) (a :: *) where+data Ix (ix :: Type) (a :: Type) where Ix :: !(Map ix (Set a)) -> (a -> [ix]) -> Ix ix a instance (NFData ix, NFData a) => NFData (Ix ix a) where
tests/Data/IxSet/Typed/Tests.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE DeriveDataTypeable, TemplateHaskell, OverlappingInstances, UndecidableInstances, TemplateHaskell, DataKinds, FlexibleInstances, MultiParamTypeClasses, TypeOperators, KindSignatures #-}+{-# LANGUAGE DeriveDataTypeable, FlexibleContexts, TemplateHaskell, UndecidableInstances, TemplateHaskell, DataKinds, FlexibleInstances, MultiParamTypeClasses, TypeOperators, KindSignatures #-} {-# OPTIONS_GHC -fdefer-type-errors -fno-warn-orphans #-} -- TODO (only if SYBWC is added again):