enummapset 0.0.1 → 0.1.0
raw patch · 3 files changed
+41/−5 lines, 3 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
+ Data.EnumMap: enumMapToIntMap :: EnumMap k a -> IntMap a
+ Data.EnumMap: instance Typeable2 EnumMap
+ Data.EnumMap: intMapToEnumMap :: IntMap a -> EnumMap k a
+ Data.EnumSet: enumSetToIntSet :: EnumSet e -> IntSet
+ Data.EnumSet: instance Typeable1 EnumSet
+ Data.EnumSet: intSetToEnumSet :: IntSet -> EnumSet e
Files
- Data/EnumMap.hs +19/−1
- Data/EnumSet.hs +20/−2
- enummapset.cabal +2/−2
Data/EnumMap.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} -- |@@ -18,6 +19,10 @@ module Data.EnumMap ( EnumMap + -- * Wrapping/unwrapping+ , intMapToEnumMap+ , enumMapToIntMap+ -- * Operators , (!) , (\\)@@ -148,12 +153,13 @@ import Data.Foldable ( Foldable ) import Data.Monoid ( Monoid ) import Data.Traversable ( Traversable )+import Data.Typeable ( Typeable ) import Text.Read -- | Wrapper for 'IntMap' with 'Enum' keys. newtype EnumMap k a = EnumMap { unWrap :: IntMap a }- deriving (Eq, Foldable, Functor, Ord, Monoid, Traversable)+ deriving (Eq, Foldable, Functor, Ord, Monoid, Traversable, Typeable) instance (Enum k, Show k, Show a) => Show (EnumMap k a) where showsPrec p em = showParen (p > 10) $@@ -164,6 +170,18 @@ Ident "fromList" <- lexP list <- readPrec return (fromList list)++--+-- Conversion to/from 'IntMap'.+--++-- | Wrap 'IntMap'.+intMapToEnumMap :: IntMap a -> EnumMap k a+intMapToEnumMap = EnumMap++-- | Unwrap 'IntMap'.+enumMapToIntMap :: EnumMap k a -> IntMap a+enumMapToIntMap = unWrap -- -- A few useful functions used through the module. Not exported.
Data/EnumSet.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} -- |@@ -12,11 +13,15 @@ -- This is a simple wrapper for 'Data.IntSet' that allows storing any elements -- of Enum type class. Useful if one wants to have the performance of -- 'Data.IntSet' and at the same time use something else than 'Int's (e.g. an--- 'Int' wrapped with newtype). For documentation see the one for 'Data.IntMap'.+-- 'Int' wrapped with newtype). For documentation see the one for 'Data.IntSet'. module Data.EnumSet ( EnumSet + -- * Wrapping/unwrapping+ , intSetToEnumSet+ , enumSetToIntSet+ -- * Operators , (\\) @@ -82,12 +87,13 @@ import qualified Data.IntSet as I import Data.Monoid ( Monoid )+import Data.Typeable ( Typeable ) import Text.Read -- | Wrapper for 'IntSet' with 'Enum' elements. newtype EnumSet e = EnumSet { unWrap :: IntSet }- deriving (Eq, Monoid, Ord)+ deriving (Eq, Monoid, Ord, Typeable) instance (Enum e, Show e) => Show (EnumSet e) where showsPrec p es = showParen (p > 10) $@@ -98,6 +104,18 @@ Ident "fromList" <- lexP list <- readPrec return (fromList list)++--+-- Conversion to/from 'IntSet'.+--++-- | Wrap 'IntSet'.+intSetToEnumSet :: IntSet -> EnumSet e+intSetToEnumSet = EnumSet++-- | Unwrap 'IntSet'.+enumSetToIntSet :: EnumSet e -> IntSet+enumSetToIntSet = unWrap -- -- A few useful functions used through the module; not exported.
enummapset.cabal view
@@ -1,5 +1,5 @@ name: enummapset-version: 0.0.1+version: 0.1.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.@@ -27,7 +27,7 @@ Data.EnumSet build-depends:- base < 4.4,+ base < 5, containers >= 0.3 && < 0.5 ghc-options: -Wall