packages feed

bimap 0.4.0 → 0.5.0

raw patch · 3 files changed

+49/−5 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Data.Bimap: (!?) :: (Ord a, Ord b, MonadThrow m) => Bimap a b -> a -> m b
+ Data.Bimap: (!?>) :: (Ord a, Ord b, MonadThrow m) => Bimap a b -> b -> m a

Files

Data/Bimap.hs view
@@ -36,6 +36,8 @@     lookupR,     (!),     (!>),+    (!?),+    (!?>),     -- * Construction     empty,     singleton,@@ -103,7 +105,7 @@ import           Data.Typeable  #if __GLASGOW_HASKELL__ >= 708-import qualified GHC.Exts            as GHCExts+import qualified Data.BimapExt       as GHCExts #endif import           GHC.Generics        (Generic) @@ -346,6 +348,9 @@ This function will @return@ the result in the monad, or @fail@ if the value isn't in the bimap. +Note that the signature differs slightly from Data.Map's @lookup@. This one is more general -+it functions the same way as the "original" if @m@ is cast (or inferred) to Maybe.+ /Version: 0.2/-} lookup :: (Ord a, Ord b, MonadThrow m)        => a -> Bimap a b -> m b@@ -357,6 +362,8 @@ {-| /O(log n)/. A version of 'lookup' that is specialized to the right key, and returns the corresponding left key.++ /Version: 0.2/-} lookupR :: (Ord a, Ord b, MonadThrow m)         => b -> Bimap a b -> m a@@ -378,6 +385,16 @@ /Version: 0.2/-} (!>) :: (Ord a, Ord b) => Bimap a b -> b -> a (!>) bi y = fromMaybe (error "Data.Bimap.(!>): Right key not found") $ lookupR y bi++{-| /O(log n)/.+See 'lookup'. -}+(!?) :: (Ord a, Ord b, MonadThrow m) => Bimap a b -> a -> m b+(!?) = flip lookup++{-| /O(log n)/.+See 'lookupR'. -}+(!?>) :: (Ord a, Ord b, MonadThrow m) => Bimap a b -> b -> m a+(!?>) = flip lookupR  {-| /O(n*log n)/. Build a map from a list of pairs. If there are any overlapping
+ Data/BimapExt.hs view
@@ -0,0 +1,16 @@+{-# LANGUAGE Trustworthy #-}+{-|+An auxiliary module that exports the 'IsList' class from "GHC.Exts". We use+this intermediate module to isolate a safe feature from an otherwise non-safe+module, and prevent all of "Data.Bimap" from being marked as not safe just+because we are importing "GHC.Exts".++The module only exports a class, and the class does not define any methods in+an unsafe way. We therefore consider it safe and mark this module as+trustworthy.+-}+module Data.BimapExt (+    IsList(..)+) where++import GHC.Exts (IsList(..))
bimap.cabal view
@@ -1,6 +1,6 @@-cabal-version:       >= 1.8+cabal-version:       >= 1.10 name:                bimap-version:             0.4.0+version:             0.5.0 synopsis:            Bidirectional mapping between two key types description:   A data structure representing a bidirectional mapping between two@@ -22,11 +22,21 @@   build-depends:       base >= 4 && <5, containers, deepseq, exceptions   if impl(ghc < 7.6.1)     build-depends: ghc-prim-  extensions:          DeriveDataTypeable+    default-extensions:  CPP+                         DeriveGeneric+                         TypeFamilies+  else+    default-extensions: CPP+                        TypeFamilies+  default-language:    Haskell98      ghc-options:         -Wall   exposed-modules:       Data.Bimap +  if impl(ghc >= 7.8)+    other-modules:+      Data.BimapExt+ test-suite tests     type:            exitcode-stdio-1.0     main-is:         Test/RunTests.hs@@ -40,7 +50,8 @@                      template-haskell >= 2 && < 3     if impl(ghc < 7.6.1)       build-depends: ghc-prim-  extensions:        DeriveDataTypeable+  default-extensions:  TemplateHaskell+  default-language:    Haskell98     source-repository head     type:         git