enummapset 0.7.2.0 → 0.7.3.0
raw patch · 3 files changed
+32/−9 lines, 3 filesdep ~aesondep ~basedep ~containersPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: aeson, base, containers, deepseq
API changes (from Hackage documentation)
+ Data.EnumSet: instance GHC.Enum.Enum a => GHC.IsList.IsList (Data.EnumSet.EnumSet a)
Files
- Data/EnumMap/Base.hs +14/−2
- Data/EnumSet.hs +13/−2
- enummapset.cabal +5/−5
Data/EnumMap/Base.hs view
@@ -2,6 +2,7 @@ {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE DeriveTraversable #-}+{-# LANGUAGE TypeFamilies #-} -- | -- Module : $Header$@@ -184,6 +185,7 @@ import Data.Traversable ( Traversable ) import Data.Typeable ( Typeable ) import Data.Aeson ( FromJSON(..), ToJSON(..) )+import qualified GHC.Exts as IL import Text.Read -- | Wrapper for 'IntMap' with 'Enum' keys.@@ -207,6 +209,16 @@ instance (FromJSON a) => FromJSON (EnumMap k a) where parseJSON = fmap (EnumMap . I.fromList) . parseJSON +instance (Enum k) => IL.IsList (EnumMap k a) where+ type Item (EnumMap k a) = (k, a)++ toList = P.map (first toEnum) . I.toList . unWrap+ {-# INLINE toList #-}++ fromList = EnumMap . I.fromList . P.map (first fromEnum)+ {-# INLINE fromList #-}++ -- -- Conversion to/from 'IntMap'. --@@ -637,7 +649,7 @@ {-# INLINE assocs #-} toList :: (Enum k) => EnumMap k a -> [(k, a)]-toList = P.map (first toEnum) . I.toList . unWrap+toList = IL.toList {-# INLINE toList #-} toAscList :: (Enum k) => EnumMap k a -> [(k, a)]@@ -649,7 +661,7 @@ {-# INLINE toDescList #-} fromList :: (Enum k) => [(k, a)] -> EnumMap k a-fromList = EnumMap . I.fromList . P.map (first fromEnum)+fromList = IL.fromList {-# INLINE fromList #-} fromListWith :: (Enum k) => (a -> a -> a) -> [(k, a)] -> EnumMap k a
Data/EnumSet.hs view
@@ -4,6 +4,7 @@ {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE DerivingStrategies #-}+{-# LANGUAGE TypeFamilies #-} -- | -- Module : $Header$@@ -113,6 +114,7 @@ ( FromJSON(parseJSON), ToJSON(toEncoding, toJSON) ) import Text.Read import GHC.Generics (Generic)+import qualified GHC.Exts as IL -- | Wrapper for 'IntSet' with 'Enum' elements. newtype EnumSet k = EnumSet { unWrap :: IntSet }@@ -143,6 +145,15 @@ instance (FromJSON a) => FromJSON (EnumSet a) where parseJSON = fmap (EnumSet . I.fromList) . parseJSON +instance (Enum a) => IL.IsList (EnumSet a) where+ type Item (EnumSet a) = a++ toList = P.map toEnum . I.toList . unWrap+ {-# INLINE toList #-}++ fromList = EnumSet . I.fromList . P.map fromEnum+ {-# INLINE fromList #-}+ -- -- Conversion to/from 'IntSet'. --@@ -316,7 +327,7 @@ {-# INLINE elems #-} toList :: (Enum k) => EnumSet k -> [k]-toList = P.map toEnum . I.toList . unWrap+toList = IL.toList {-# INLINE toList #-} toAscList :: (Enum k) => EnumSet k -> [k]@@ -328,7 +339,7 @@ {-# INLINE toDescList #-} fromList :: (Enum k) => [k] -> EnumSet k-fromList = EnumSet . I.fromList . P.map fromEnum+fromList = IL.fromList {-# INLINE fromList #-} fromAscList :: (Enum k) => [k] -> EnumSet k
enummapset.cabal view
@@ -1,5 +1,5 @@ name: enummapset-version: 0.7.2.0+version: 0.7.3.0 synopsis: IntMap and IntSet with Enum keys/elements. description: This package contains simple wrappers around 'Data.IntMap' and 'Data.IntSet' with 'Enum' keys and elements respectively.@@ -16,8 +16,8 @@ , GHC==9.0.2 , GHC==9.2.8 , GHC==9.4.8- , GHC==9.6.3- , GHC==9.8.1+ , GHC==9.6.6+ , GHC==9.8.2 author: Michal Terepeta and others maintainer: Mikolaj Konarski <mikolaj.konarski@funktory.com> category: Data Structures@@ -48,7 +48,7 @@ build-depends: base >= 4.6 && < 5, aeson >= 1.3 && < 2.3,- containers >= 0.5.11 && < 0.7,+ containers >= 0.5.11 && < 0.8, deepseq >= 1.2 && < 1.6 if impl(ghc < 8.0)@@ -83,7 +83,7 @@ KindSignatures, TypeFamilies, UndecidableInstances build-depends:- base,+ base >= 4.6 && < 5, aeson, array >= 0.4.0.0, containers,