[GHC] #15263: Fuse zipWith3

#15263: Fuse zipWith3 -------------------------------------+------------------------------------- Reporter: goldfire | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.4.3 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- I was surprised to discover that `zipWith3` has no `RULES` associated with it to aid fusion. Can we add these? I have no idea what I'm doing, but would this substitution work: {{{ {-# RULES "zipWith3" zipWith3 f a b c = zipWith id (zipWith f a b) c #-} }}} Those who know what they're doing will likely devise a better strategy. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15263 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15263: Fuse zipWith3 -------------------------------------+------------------------------------- Reporter: goldfire | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.4.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by mpickering): If you are going to do that, you might as well define `zipWith3` in that way to begin with? In fact, defining `zipWith3` in this way and adding an `INLINE` pragma causes it to fuse nicely with map. My example program and the resulting core here - https://gist.github.com/mpickering/c190fc25260a3460f4633d0248659192 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15263#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15263: Fuse zipWith3 -------------------------------------+------------------------------------- Reporter: goldfire | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.4.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by goldfire): I noticed that `zipWith` itself has an explicit recursive definition, even though the rule right below it universally applies and zaps it to a `build` expression. I do not know the implications of these different implementation choices. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15263#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15263: Fuse zipWith3 -------------------------------------+------------------------------------- Reporter: goldfire | Owner: TDecki Type: bug | Status: new Priority: normal | Milestone: 8.8.1 Component: Compiler | Version: 8.4.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by TDecki): * owner: (none) => TDecki -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15263#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15263: Fuse zipWith3 -------------------------------------+------------------------------------- Reporter: goldfire | Owner: TDecki Type: bug | Status: new Priority: normal | Milestone: 8.8.1 Component: Compiler | Version: 8.4.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D5241 Wiki Page: | -------------------------------------+------------------------------------- Changes (by TDecki): * differential: => Phab:D5241 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15263#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15263: Fuse zipWith3 -------------------------------------+------------------------------------- Reporter: goldfire | Owner: TDecki Type: bug | Status: new Priority: normal | Milestone: 8.8.1 Component: Compiler | Version: 8.4.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #14037 | Differential Rev(s): Phab:D5241 Wiki Page: | -------------------------------------+------------------------------------- Changes (by TDecki): * related: => #14037 Comment: Related Ticket also wants to do this. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15263#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15263: Fuse zipWith3 -------------------------------------+------------------------------------- Reporter: goldfire | Owner: TDecki Type: bug | Status: patch Priority: normal | Milestone: 8.8.1 Component: Compiler | Version: 8.4.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #14037 | Differential Rev(s): Phab:D5241 Wiki Page: | -------------------------------------+------------------------------------- Changes (by TDecki): * status: new => patch -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15263#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15263: Fuse zipWith3
-------------------------------------+-------------------------------------
Reporter: goldfire | Owner: TDecki
Type: bug | Status: patch
Priority: normal | Milestone: 8.8.1
Component: Compiler | Version: 8.4.3
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: #14037 | Differential Rev(s): Phab:D5241
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#15263: Fuse zipWith3 -------------------------------------+------------------------------------- Reporter: goldfire | Owner: TDecki Type: bug | Status: closed Priority: normal | Milestone: 8.8.1 Component: Compiler | Version: 8.4.3 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #14037 | Differential Rev(s): Phab:D5241 Wiki Page: | -------------------------------------+------------------------------------- Changes (by TDecki): * status: patch => closed * resolution: => fixed -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15263#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC