packages feed

bifunctors 5.5.9 → 5.5.10

raw patch · 4 files changed

+46/−4 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

CHANGELOG.markdown view
@@ -1,3 +1,8 @@+5.5.10 [2021.01.21]+-------------------+* Fix a bug in which `deriveBifoldable` could generate code that triggers+  `-Wunused-matches` warnings.+ 5.5.9 [2020.12.30] ------------------ * Explicitly mark modules as Safe or Trustworthy.
bifunctors.cabal view
@@ -1,6 +1,6 @@ name:          bifunctors category:      Data, Functors-version:       5.5.9+version:       5.5.10 license:       BSD3 cabal-version: >= 1.10 license-file:  LICENSE@@ -120,7 +120,7 @@   type: exitcode-stdio-1.0   hs-source-dirs: tests   main-is: Spec.hs-  other-modules: BifunctorSpec+  other-modules: BifunctorSpec T89Spec   ghc-options: -Wall   if impl(ghc >= 8.6)     ghc-options: -Wno-star-is-type
src/Data/Bifunctor/TH.hs view
@@ -1211,14 +1211,30 @@ -- Make a 'LamE' using a fresh variable. mkSimpleLam :: (Exp -> Q Exp) -> Q Exp mkSimpleLam lam = do-  n <- newName "n"+  -- Use an underscore in front of the variable name, as it's possible for+  -- certain Bifoldable instances to generate code like this (see #89):+  --+  -- @+  -- bifoldMap (\\_n -> mempty) ...+  -- @+  --+  -- Without the underscore, that code would trigger -Wunused-matches warnings.+  n <- newName "_n"   body <- lam (VarE n)   return $ LamE [VarP n] body  -- Make a 'LamE' using two fresh variables. mkSimpleLam2 :: (Exp -> Exp -> Q Exp) -> Q Exp mkSimpleLam2 lam = do-  n1 <- newName "n1"+  -- Use an underscore in front of the variable name, as it's possible for+  -- certain Bifoldable instances to generate code like this (see #89):+  --+  -- @+  -- bifoldr (\\_n1 n2 -> n2) ...+  -- @+  --+  -- Without the underscore, that code would trigger -Wunused-matches warnings.+  n1 <- newName "_n1"   n2 <- newName "n2"   body <- lam (VarE n1) (VarE n2)   return $ LamE [VarP n1, VarP n2] body
+ tests/T89Spec.hs view
@@ -0,0 +1,21 @@+{-# LANGUAGE TemplateHaskell #-}++-- | A regression test for #89 which ensures that a TH-generated Bifoldable+-- instance of a certain shape does not trigger -Wunused-matches warnings.+module T89Spec where++import Data.Bifunctor.TH+import Test.Hspec++data X = MkX+data Y a b = MkY a b+newtype XY a b = XY { getResp :: Either X (Y a b) }++$(deriveBifoldable ''Y)+$(deriveBifoldable ''XY)++main :: IO ()+main = hspec spec++spec :: Spec+spec = return ()