Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC

Commits:

2 changed files:

Changes:

  • libraries/base/changelog.md
    ... ... @@ -7,6 +7,7 @@
    7 7
       * Modify the implementation of `Data.List.sortOn` to use `(>)` instead of `compare`. ([CLC proposal #332](https://github.com/haskell/core-libraries-committee/issues/332))
    
    8 8
       * `GHC.Exts.IOPort#` and its related operations have been removed  ([CLC #213](https://github.com/haskell/core-libraries-committee/issues/213))
    
    9 9
       * Fix bug where `naturalAndNot` was incorrectly truncating results ([CLC proposal #350](github.com/haskell/core-libraries-committee/issues/350))
    
    10
    +  * Remove extra laziness from `Data.Bifunctor.Bifunctor` instances for all tuples to have the same laziness as their `Data.Functor.Functor` counterparts (i.e. they became more strict than before) ([CLC proposal #339](https://github.com/haskell/core-libraries-committee/issues/339))
    
    10 11
     
    
    11 12
     ## 4.22.0.0 *TBA*
    
    12 13
       * Shipped with GHC 9.14.1
    

  • libraries/base/src/Data/Bifunctor.hs
    ... ... @@ -133,39 +133,39 @@ class (forall a. Functor (p a)) => Bifunctor p where
    133 133
         second = bimap id
    
    134 134
     
    
    135 135
     
    
    136
    --- | Class laws for tuples hold only up to laziness. Both
    
    137
    --- 'first' 'id' and 'second' 'id' are lazier than 'id' (and 'fmap' 'id'):
    
    136
    +-- | Tuple instances have the same laziness as for 'Functor'. Both
    
    137
    +-- 'first' 'id' and 'second' 'id' have the same laziness as 'id' (and 'fmap' 'id'):
    
    138 138
     --
    
    139
    --- >>> first id (undefined :: (Int, Word)) `seq` ()
    
    140
    --- ()
    
    141
    --- >>> second id (undefined :: (Int, Word)) `seq` ()
    
    142
    --- ()
    
    139
    +-- >>> first id (errorWithoutStackTrace "error!" :: (Int, Word)) `seq` ()
    
    140
    +-- *** Exception: error!
    
    141
    +-- >>> second id (errorWithoutStackTrace "error!" :: (Int, Word)) `seq` ()
    
    142
    +-- *** Exception: error!
    
    143 143
     -- >>> id (errorWithoutStackTrace "error!" :: (Int, Word)) `seq` ()
    
    144 144
     -- *** Exception: error!
    
    145 145
     --
    
    146 146
     -- @since 4.8.0.0
    
    147 147
     instance Bifunctor (,) where
    
    148
    -    bimap f g ~(a, b) = (f a, g b)
    
    148
    +    bimap f g (a, b) = (f a, g b)
    
    149 149
     
    
    150 150
     -- | @since 4.8.0.0
    
    151 151
     instance Bifunctor ((,,) x1) where
    
    152
    -    bimap f g ~(x1, a, b) = (x1, f a, g b)
    
    152
    +    bimap f g (x1, a, b) = (x1, f a, g b)
    
    153 153
     
    
    154 154
     -- | @since 4.8.0.0
    
    155 155
     instance Bifunctor ((,,,) x1 x2) where
    
    156
    -    bimap f g ~(x1, x2, a, b) = (x1, x2, f a, g b)
    
    156
    +    bimap f g (x1, x2, a, b) = (x1, x2, f a, g b)
    
    157 157
     
    
    158 158
     -- | @since 4.8.0.0
    
    159 159
     instance Bifunctor ((,,,,) x1 x2 x3) where
    
    160
    -    bimap f g ~(x1, x2, x3, a, b) = (x1, x2, x3, f a, g b)
    
    160
    +    bimap f g (x1, x2, x3, a, b) = (x1, x2, x3, f a, g b)
    
    161 161
     
    
    162 162
     -- | @since 4.8.0.0
    
    163 163
     instance Bifunctor ((,,,,,) x1 x2 x3 x4) where
    
    164
    -    bimap f g ~(x1, x2, x3, x4, a, b) = (x1, x2, x3, x4, f a, g b)
    
    164
    +    bimap f g (x1, x2, x3, x4, a, b) = (x1, x2, x3, x4, f a, g b)
    
    165 165
     
    
    166 166
     -- | @since 4.8.0.0
    
    167 167
     instance Bifunctor ((,,,,,,) x1 x2 x3 x4 x5) where
    
    168
    -    bimap f g ~(x1, x2, x3, x4, x5, a, b) = (x1, x2, x3, x4, x5, f a, g b)
    
    168
    +    bimap f g (x1, x2, x3, x4, x5, a, b) = (x1, x2, x3, x4, x5, f a, g b)
    
    169 169
     
    
    170 170
     
    
    171 171
     -- | @since 4.8.0.0