#2684: Stack overflow in stream-fusion library with GHC 6.10 RC
------------------------------+---------------------------------------------
Reporter: dons | Owner:
Type: bug | Status: new
Priority: high | Milestone: 6.10.1
Component: Compiler | Version: 6.9
Severity: major | Resolution:
Keywords: | Difficulty: Unknown
Testcase: | Architecture: Unknown/Multiple
Os: Unknown/Multiple |
------------------------------+---------------------------------------------
Comment (by rl):
FWIW, I don't think it is necessary to do anything about this. The library
code and the pattern in general are arguably wrong since the `fusible`
rule really shouldn't be applied in the rhs of `mapx`. It is also easily
fixed:
{{{
mapx = id mapz
mapz f (x:xs) = f x : mapz f xs
{-# INLINE [1] mapx #-}
{-# RULES
"mapx -> fusible" [~1] forall f xs.
mapx f xs = unstream (mapy f (stream xs))
"mapx -> unfused" [1] forall f xs.
unstream (mapy f (stream xs)) = mapz f xs
#-}
}}}
or simply
{{{
mapx f xs = unstream (mapy f (stream xs))
mapz f (x:xs) = f x : mapz f xs
{-# INLINE mapx #-}
{-# RULES
"mapx -> unfused" [1] forall f xs.
unstream (mapy f (stream xs)) = mapz f xs
#-}
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2684#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs