[GHC] #9949: zipWith too strict in second argument in GHC-7.10.0

#9949: zipWith too strict in second argument in GHC-7.10.0 -------------------------------------+------------------------------------- Reporter: Lemming | Owner: ekmett Type: bug | Status: new Priority: normal | Milestone: Component: Core | Version: 7.10.1-rc1 Libraries | Operating System: Unknown/Multiple Keywords: | Type of failure: None/Unknown Architecture: | Blocked By: Unknown/Multiple | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- correct: {{{ $ ghci-7.8.4 -Wall Prelude> zipWith (==) "" undefined [] }}} incorrect: {{{ $ ghci-7.10.0.20141227 -Wall Prelude> zipWith (==) "" undefined *** Exception: Prelude.undefined }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9949 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9949: zipWith too strict in second argument in GHC-7.10.0 -------------------------------------+------------------------------------- Reporter: Lemming | Owner: ekmett Type: bug | Status: new Priority: normal | Milestone: Component: libraries/base | Version: 7.10.1-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by Lemming): * cc: hvr, ekmett (added) * component: Core Libraries => libraries/base -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9949#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9949: zipWith too strict in second argument in GHC-7.10.0 -------------------------------------+------------------------------------- Reporter: Lemming | Owner: ekmett Type: bug | Status: new Priority: normal | Milestone: Component: libraries/base | Version: 7.10.1-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by nomeata): This was a deliberate choice in #9495, implemented in changeset:488e95b433d4f7568aa89622c729e64aa3b6520d/ghc, and is a documented difference to the standard. Is this causing practical problems for you? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9949#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9949: zipWith too strict in second argument in GHC-7.10.0 -------------------------------------+------------------------------------- Reporter: Lemming | Owner: ekmett Type: bug | Status: new Priority: normal | Milestone: Component: libraries/base | Version: 7.10.1-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by nomeata): * cc: dfeuer (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9949#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9949: zipWith too strict in second argument in GHC-7.10.0 -------------------------------------+------------------------------------- Reporter: Lemming | Owner: ekmett Type: bug | Status: new Priority: normal | Milestone: Component: libraries/base | Version: 7.10.1-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by Lemming): I found the difference because my `mapAdjacent` function uses `tail` in the second argument of `zipWith`: {{{ mapAdjacent :: (a -> a -> b) -> [a] -> [b] mapAdjacent f xs = zipWith f xs (tail xs) }}} I get: {{{ $ ghci-7.10.0.20141227 *Prelude> Data.List.HT.mapAdjacent (==) ([] :: [Int]) *** Exception: Prelude.tail: empty list }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9949#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9949: zipWith too strict in second argument in GHC-7.10.0 -------------------------------------+------------------------------------- Reporter: Lemming | Owner: ekmett Type: bug | Status: new Priority: highest | Milestone: Component: libraries/base | Version: 7.10.1-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by nomeata): * priority: normal => highest Comment: Hmm, that’s indeed a problem; `zip`’ing with the tail is a very common idiom. We shouldn’t release with that unsolved. @dfeuer, what is your take on this? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9949#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9949: zipWith too strict in second argument in GHC-7.10.0 -------------------------------------+------------------------------------- Reporter: Lemming | Owner: ekmett Type: bug | Status: new Priority: highest | Milestone: Component: libraries/base | Version: 7.10.1-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: #9495 | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by hvr): * related: => #9495 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9949#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9949: zipWith too strict in second argument in GHC-7.10.0 -------------------------------------+------------------------------------- Reporter: Lemming | Owner: ekmett Type: bug | Status: new Priority: highest | Milestone: Component: libraries/base | Version: 7.10.1-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: #9495 | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by dfeuer): My take is that if we revert this change, then we should get rid of the `foldr2` rule that prompted it. I do not want to go back to the situation where semantics depended on which if either of the rules fired. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9949#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9949: zipWith too strict in second argument in GHC-7.10.0 -------------------------------------+------------------------------------- Reporter: Lemming | Owner: ekmett Type: bug | Status: new Priority: highest | Milestone: Component: libraries/base | Version: 7.10.1-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: #9495 | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by tibbe): I think we should * revert the change, * remove the rule, and * document the intended strictness. The lack of the latter has proved to be problematic elsewhere (e.g. `findWithDefault` in containers.) Without documenting the strictness properties users can't really assume anything about the strictness of functions. Not even a "lazy unless otherwise specified" assumption is warranted, as functions are rarely maximally lazy unless particular care is taken (see e.g. https://www.haskell.org/haskellwiki/Maintaining_laziness). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9949#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9949: zipWith too strict in second argument in GHC-7.10.0 -------------------------------------+------------------------------------- Reporter: Lemming | Owner: ekmett Type: bug | Status: new Priority: highest | Milestone: Component: libraries/base | Version: 7.10.1-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: #9495 | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by nomeata): I agree with tibbe. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9949#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9949: zipWith too strict in second argument in GHC-7.10.0 -------------------------------------+------------------------------------- Reporter: Lemming | Owner: ekmett Type: bug | Status: new Priority: highest | Milestone: Component: libraries/base | Version: 7.10.1-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: #9495 | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by dfeuer): I also agree with tibbe. nomeata, you expressed the opposite view in the original discussion: https://ghc.haskell.org/trac/ghc/ticket/9495#comment:3 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9949#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9949: zipWith too strict in second argument in GHC-7.10.0 -------------------------------------+------------------------------------- Reporter: Lemming | Owner: ekmett Type: bug | Status: new Priority: highest | Milestone: Component: libraries/base | Version: 7.10.1-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: #9495 | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by dfeuer): Note that if we make this change, we will need to delete the note I added to the user's manual about the deviation from the standard. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9949#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9949: zipWith too strict in second argument in GHC-7.10.0 -------------------------------------+------------------------------------- Reporter: Lemming | Owner: ekmett Type: bug | Status: new Priority: highest | Milestone: Component: libraries/base | Version: 7.10.1-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: #9495 | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by nomeata):
nomeata, you expressed the opposite view in the original discussion:
I know,but I change my opinion in light of new facts, such as breakage of idiomatic code. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9949#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9949: zipWith too strict in second argument in GHC-7.10.0 -------------------------------------+------------------------------------- Reporter: Lemming | Owner: ekmett Type: bug | Status: new Priority: highest | Milestone: Component: libraries/base | Version: 7.10.1-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: #9495 | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by ekmett): I think we are all in full accord that this needs to be reverted and documented. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9949#comment:13 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9949: zipWith too strict in second argument in GHC-7.10.0 -------------------------------------+------------------------------------- Reporter: Lemming | Owner: ekmett Type: bug | Status: new Priority: highest | Milestone: Component: libraries/base | Version: 7.10.1-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: #9495 | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by dfeuer): Never let facts get in the way of a good opinion! I'll put together a code review today. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9949#comment:14 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9949: zipWith too strict in second argument in GHC-7.10.0 -------------------------------------+------------------------------------- Reporter: Lemming | Owner: ekmett Type: bug | Status: patch Priority: highest | Milestone: 7.10.1 Component: Core Libraries | Version: 7.10.1-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime crash | Unknown/Multiple Blocked By: | Test Case: Related Tickets: #9495 | Blocking: | Differential Revisions: Phab:D602 -------------------------------------+------------------------------------- Changes (by dfeuer): * status: new => patch * failure: None/Unknown => Runtime crash * differential: => Phab:D602 * component: libraries/base => Core Libraries * milestone: => 7.10.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9949#comment:15 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9949: zipWith too strict in second argument in GHC-7.10.0
-------------------------------------+-------------------------------------
Reporter: Lemming | Owner: ekmett
Type: bug | Status: patch
Priority: highest | Milestone: 7.10.1
Component: Core Libraries | Version: 7.10.1-rc1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: Runtime crash | Unknown/Multiple
Blocked By: | Test Case:
Related Tickets: #9495 | Blocking:
| Differential Revisions: Phab:D602
-------------------------------------+-------------------------------------
Comment (by Herbert Valerio Riedel

#9949: zipWith too strict in second argument in GHC-7.10.0 -------------------------------------+------------------------------------- Reporter: Lemming | Owner: ekmett Type: bug | Status: closed Priority: highest | Milestone: 7.10.1 Component: Core Libraries | Version: 7.10.1-rc1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime crash | Unknown/Multiple Blocked By: | Test Case: Related Tickets: #9495 | Blocking: | Differential Revisions: Phab:D602 -------------------------------------+------------------------------------- Changes (by hvr): * status: patch => closed * resolution: => fixed Comment: merged to ghc-7.10 via 19ad227fbfa23f64f7422751b9559b4ac44d5081 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9949#comment:17 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC