packages feed

bimap 0.3.3 → 0.4.0

raw patch · 2 files changed

+34/−9 lines, 2 filesdep +deepseqdep +ghc-primPVP ok

version bump matches the API change (PVP)

Dependencies added: deepseq, ghc-prim

API changes (from Hackage documentation)

- Data.Bimap: instance GHC.Exception.Exception Data.Bimap.BimapException
+ Data.Bimap: instance (Control.DeepSeq.NFData a, Control.DeepSeq.NFData b) => Control.DeepSeq.NFData (Data.Bimap.Bimap a b)
+ Data.Bimap: instance (GHC.Classes.Ord a, GHC.Classes.Ord b) => GHC.Exts.IsList (Data.Bimap.Bimap a b)
+ Data.Bimap: instance GHC.Exception.Type.Exception Data.Bimap.BimapException
+ Data.Bimap: instance GHC.Generics.Generic (Data.Bimap.Bimap a b)
- Data.Bimap: deleteFindMax :: (Ord b) => Bimap a b -> ((a, b), Bimap a b)
+ Data.Bimap: deleteFindMax :: Ord b => Bimap a b -> ((a, b), Bimap a b)
- Data.Bimap: deleteFindMaxR :: (Ord a) => Bimap a b -> ((b, a), Bimap a b)
+ Data.Bimap: deleteFindMaxR :: Ord a => Bimap a b -> ((b, a), Bimap a b)
- Data.Bimap: deleteFindMin :: (Ord b) => Bimap a b -> ((a, b), Bimap a b)
+ Data.Bimap: deleteFindMin :: Ord b => Bimap a b -> ((a, b), Bimap a b)
- Data.Bimap: deleteFindMinR :: (Ord a) => Bimap a b -> ((b, a), Bimap a b)
+ Data.Bimap: deleteFindMinR :: Ord a => Bimap a b -> ((b, a), Bimap a b)
- Data.Bimap: deleteMax :: (Ord b) => Bimap a b -> Bimap a b
+ Data.Bimap: deleteMax :: Ord b => Bimap a b -> Bimap a b
- Data.Bimap: deleteMaxR :: (Ord a) => Bimap a b -> Bimap a b
+ Data.Bimap: deleteMaxR :: Ord a => Bimap a b -> Bimap a b
- Data.Bimap: deleteMin :: (Ord b) => Bimap a b -> Bimap a b
+ Data.Bimap: deleteMin :: Ord b => Bimap a b -> Bimap a b
- Data.Bimap: deleteMinR :: (Ord a) => Bimap a b -> Bimap a b
+ Data.Bimap: deleteMinR :: Ord a => Bimap a b -> Bimap a b
- Data.Bimap: twisted :: (Bimap a b -> Bimap a b) -> (Bimap b a -> Bimap b a)
+ Data.Bimap: twisted :: (Bimap a b -> Bimap a b) -> Bimap b a -> Bimap b a

Files

Data/Bimap.hs view
@@ -1,3 +1,9 @@+{-# LANGUAGE CPP #-}+{-# LANGUAGE DeriveGeneric #-}+#if __GLASGOW_HASKELL__ >= 708+{-# LANGUAGE TypeFamilies #-}+#endif+ {-| An implementation of bidirectional maps between values of two key types. A 'Bimap' is essentially a bijection between subsets of@@ -87,6 +93,7 @@     twisted, ) where +import           Control.DeepSeq     (NFData) import           Control.Monad.Catch  import           Data.Function       (on)@@ -95,6 +102,11 @@ import           Data.Maybe          (fromMaybe) import           Data.Typeable +#if __GLASGOW_HASKELL__ >= 708+import qualified GHC.Exts            as GHCExts+#endif+import           GHC.Generics        (Generic)+ import           Prelude             hiding (filter, lookup, null, pred) import qualified Prelude             as P @@ -106,7 +118,7 @@ {-| A bidirectional map between values of types @a@ and @b@. -}-data Bimap a b = MkBimap !(M.Map a b) !(M.Map b a)+data Bimap a b = MkBimap !(M.Map a b) !(M.Map b a) deriving (Generic)  instance (Show a, Show b) => Show (Bimap a b) where     show x = "fromList " ++ (show . toList $ x)@@ -117,6 +129,15 @@ instance (Ord a, Ord b) => Ord (Bimap a b) where     compare = compare `on` toAscList +instance (NFData a, NFData b) => NFData (Bimap a b)++#if __GLASGOW_HASKELL__ >= 708+instance (Ord a, Ord b) => GHCExts.IsList (Bimap a b) where+    type Item (Bimap a b) = (a, b)+    fromList = fromList+    toList = toList+#endif+ {-| A 'Bimap' action failed. -}@@ -604,7 +625,7 @@ /Version: 0.2.2/-} deleteMax :: (Ord b) => Bimap a b -> Bimap a b deleteMax = snd . deleteFindMax- + {-| /O(log n)/. Delete the element with maximal right key. Calls @'error'@ if the bimap is empty.@@ -620,7 +641,7 @@ findMax = M.findMax . toMap  {-| /O(log n)/.-Find the element with maximal right key. The +Find the element with maximal right key. The right-hand key is the first entry in the pair. Calls @'error'@ if the bimap is empty. /Version: 0.2.2/-}@@ -650,7 +671,7 @@ /Version: 0.2.2/-} deleteMin :: (Ord b) => Bimap a b -> Bimap a b deleteMin = snd . deleteFindMin- + {-| /O(log n)/. Delete the element with minimal right key. Calls @'error'@ if the bimap is empty.@@ -666,10 +687,9 @@ findMin = M.findMin . toMap  {-| /O(log n)/.-Find the element with minimal right key. The +Find the element with minimal right key. The right-hand key is the first entry in the pair. Calls @'error'@ if the bimap is empty. /Version: 0.2.2/-} findMinR :: Bimap a b -> (b, a) findMinR = M.findMin . toMapR-
bimap.cabal view
@@ -1,6 +1,6 @@ cabal-version:       >= 1.8 name:                bimap-version:             0.3.3+version:             0.4.0 synopsis:            Bidirectional mapping between two key types description:   A data structure representing a bidirectional mapping between two@@ -14,12 +14,14 @@ maintainer:          Joel Williamson <joel@joelwilliamson.ca> homepage:            https://github.com/joelwilliamson/bimap build-type:          Simple-tested-with:         GHC <= 7.10.2 && >= 7.0+tested-with:         GHC <= 8.6.4 && >= 7.0 extra-source-files:     HISTORY  Library-  build-depends:       base >= 4 && <5, containers, exceptions+  build-depends:       base >= 4 && <5, containers, deepseq, exceptions+  if impl(ghc < 7.6.1)+    build-depends: ghc-prim   extensions:          DeriveDataTypeable   ghc-options:         -Wall   exposed-modules:@@ -32,9 +34,12 @@                      Test.Util     build-depends:   base >= 4 && < 5,                      containers,+                     deepseq,                      exceptions,                      QuickCheck >= 2 && < 3,                      template-haskell >= 2 && < 3+    if impl(ghc < 7.6.1)+      build-depends: ghc-prim   extensions:        DeriveDataTypeable  source-repository head