packages feed

filtrable 0.1.5.0 → 0.1.6.0

raw patch · 2 files changed

+40/−1 lines, 2 filesdep +containersdep ~tastydep ~transformersPVP ok

version bump matches the API change (PVP)

Dependencies added: containers

Dependency ranges changed: tasty, transformers

API changes (from Hackage documentation)

+ Data.Filtrable: instance Data.Filtrable.Filtrable Data.IntMap.Internal.IntMap
+ Data.Filtrable: instance Data.Filtrable.Filtrable Data.Sequence.Internal.Seq
+ Data.Filtrable: instance GHC.Classes.Ord k => Data.Filtrable.Filtrable (Data.Map.Internal.Map k)

Files

Data/Filtrable.hs view
@@ -1,3 +1,6 @@+{-# LANGUAGE CPP #-}++-- | See 'Filtrable'. module Data.Filtrable   ( Filtrable (..)   , (<$?>), (<*?>)@@ -18,6 +21,15 @@ import Data.Proxy import Data.Traversable +#ifdef MIN_VERSION_containers+import Data.IntMap (IntMap)+import qualified Data.IntMap as IntMap+import Data.Map (Map)+import qualified Data.Map as Map+import Data.Sequence (Seq)+import qualified Data.Sequence as Seq+#endif+ import qualified Data.Set.Private as Set  -- | Class of filtrable containers, i.e. containers we can map over while selectively dropping elements.@@ -109,9 +121,11 @@  infixl 4 <$?>, <*?> +-- | Infix synonym of 'mapMaybe' (<$?>) :: Filtrable f => (a -> Maybe b) -> f a -> f b (<$?>) = mapMaybe +-- | @f '<*?>' a = 'catMaybes' (f '<*>' a)@ (<*?>) :: (Applicative p, Filtrable p) => p (a -> Maybe b) -> p a -> p b f <*?> a = catMaybes (f <*> a) @@ -140,3 +154,22 @@     case Set.insertBy' compare a as of         Nothing -> (False, as)         Just as' -> (True, as')++#ifdef MIN_VERSION_containers+instance Filtrable IntMap where+    mapMaybe = IntMap.mapMaybe+    mapEither = IntMap.mapEither+    filter = IntMap.filter++instance Ord k => Filtrable (Map k) where+    mapMaybe = Map.mapMaybe+    mapEither = Map.mapEither+    filter = Map.filter++instance Filtrable Seq where+    mapMaybe f = go+      where+        go = \ case+            Seq.Empty -> Seq.Empty+            a Seq.:<| as -> maybe id (Seq.:<|) (f a) (go as)+#endif
filtrable.cabal view
@@ -1,5 +1,5 @@ name:                filtrable-version:             0.1.5.0+version:             0.1.6.0 synopsis:            Class of filtrable containers homepage:            https://github.com/strake/filtrable.hs license:             BSD3@@ -23,6 +23,8 @@     Data.Set.Private   build-depends:       base >=4.9 && <5                      , transformers >=0.5 && <0.6+  if flag(containers)+    build-depends:     containers >=0.5.11 && <0.7   default-language:    Haskell2010   default-extensions:     LambdaCase@@ -45,3 +47,7 @@                      , smallcheck >=1.2 && <1.3                      , tasty >=1.3.1 && <1.4                      , tasty-smallcheck >=0.8.1 && <0.9++flag containers+  description:         instances for containers package+  default:             True