
#15619: List comprehension seems to prevent some rewrite rules to fire -------------------------------------+------------------------------------- Reporter: nobrakal | 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: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): I have not looked in detail, but this looks delicate. {{{ transpose (star 0 <list>) ==> { inline star } transpose (case <list> of [] -> vertex 0 _ -> vertex 0) }}} At this point the `transpose/vertex` rule can't fire. If we discover that `<list>` is non-empty (which is the case here), the it will fire. But is `[1..2]` non empty? It expands to `enumFromTo 1 2` or something like that. It's hard for GHC to tell that's non-empty. You may say that it should expand to `[1,2]`, but if it was `[1..10000]` would you want it to expand? And what about `[n..m]`? I'm not saying we couldn't do better here, but at the moment I don't see a simple, robust way to do so. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15619#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler