indexed-traversable-instances 0.1 → 0.1.1
raw patch · 4 files changed
+48/−4 lines, 4 filesdep +OneTupledep ~basedep ~indexed-traversabledep ~quickcheck-instancesPVP ok
version bump matches the API change (PVP)
Dependencies added: OneTuple
Dependency ranges changed: base, indexed-traversable, quickcheck-instances, vector
API changes (from Hackage documentation)
+ Data.Functor.WithIndex.Instances: instance WithIndex.FoldableWithIndex () Data.Tuple.Solo.Solo
+ Data.Functor.WithIndex.Instances: instance WithIndex.FunctorWithIndex () Data.Tuple.Solo.Solo
+ Data.Functor.WithIndex.Instances: instance WithIndex.TraversableWithIndex () Data.Tuple.Solo.Solo
Files
- indexed-traversable-instances.cabal +19/−4
- src/Data/Functor/WithIndex/Instances.hs +17/−0
- tests/main.hs +2/−0
- tests/safe.hs +10/−0
indexed-traversable-instances.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.12 name: indexed-traversable-instances-version: 0.1+version: 0.1.1 build-type: Simple license: BSD2 license-file: LICENSE@@ -30,7 +30,9 @@ || ==8.4.4 || ==8.6.5 || ==8.8.4- || ==8.10.2+ || ==8.10.7+ || ==9.0.1+ || ==9.2.1 source-repository head type: git@@ -42,14 +44,26 @@ ghc-options: -Wall hs-source-dirs: src build-depends:- base >=4.5 && <4.16+ base >=4.5 && <4.17 , indexed-traversable >=0.1 && <0.2+ , OneTuple >=0.3 && <0.4 , tagged >=0.8.6 && <0.9 , unordered-containers >=0.2.8.0 && <0.3 , vector >=0.12.1.2 && <0.13 exposed-modules: Data.Functor.WithIndex.Instances +test-suite safe+ type: exitcode-stdio-1.0+ default-language: Haskell2010+ ghc-options: -Wall+ hs-source-dirs: tests+ main-is: safe.hs+ build-depends:+ base+ , indexed-traversable+ , indexed-traversable-instances+ test-suite indexed-tests type: exitcode-stdio-1.0 default-language: Haskell2010@@ -61,13 +75,14 @@ , containers , indexed-traversable , indexed-traversable-instances+ , OneTuple , transformers , unordered-containers , vector build-depends: QuickCheck >=2.14.2 && <2.15- , quickcheck-instances >=0.3.25.1 && <0.4+ , quickcheck-instances >=0.3.26 && <0.4 , tasty >=1.2.3 && <1.5 , tasty-quickcheck >=0.10.1.1 && <0.11
src/Data/Functor/WithIndex/Instances.hs view
@@ -21,6 +21,7 @@ import Control.Applicative ((<$>)) import Data.HashMap.Lazy (HashMap) import Data.Tagged (Tagged (..))+import Data.Tuple.Solo (Solo (Solo)) import Data.Vector (Vector) import qualified Data.HashMap.Lazy as HM@@ -81,4 +82,20 @@ {-# INLINE ifoldl' #-} instance TraversableWithIndex k (HashMap k) where itraverse = HM.traverseWithKey+ {-# INLINE itraverse #-}++-------------------------------------------------------------------------------+-- OneTuple+-------------------------------------------------------------------------------++instance FunctorWithIndex () Solo where+ imap f (Solo a) = Solo (f () a)+ {-# INLINE imap #-}++instance FoldableWithIndex () Solo where+ ifoldMap f (Solo a) = f () a+ {-# INLINE ifoldMap #-}++instance TraversableWithIndex () Solo where+ itraverse f (Solo a) = Solo <$> f () a {-# INLINE itraverse #-}
tests/main.hs view
@@ -7,6 +7,7 @@ import Data.Foldable (toList) import Data.Functor.Identity (Identity (..)) import Data.Monoid (Endo (..), Monoid (..))+import Data.Tuple.Solo (Solo (Solo)) import Test.QuickCheck (Arbitrary, CoArbitrary, Fun, Function, Property, applyFun, (===)) import Test.QuickCheck.Poly (A, B)@@ -52,6 +53,7 @@ , battery $ mkT (HM.keys :: forall a. HM.HashMap I a -> [I]) , battery $ mkT (zipWith const [0 ..] . toList :: forall a. Seq.Seq a -> [Int]) , battery $ mkT $ zipWith const [0 ..] . V.toList+ , battery $ mkT $ \(Solo _) -> [()] #if MIN_VERSION_containers(0,6,3) , battery $ mkT IntMap.keys #endif
+ tests/safe.hs view
@@ -0,0 +1,10 @@+{-# LANGUAGE Safe #-}+module Main (main) where++import Data.Functor.WithIndex ()+import Data.Functor.WithIndex.Instances ()+import Data.Foldable.WithIndex ()+import Data.Traversable.WithIndex ()++main :: IO ()+main = return ()