#4267: Missing unboxing in pre-order fold over binary tree
---------------------------------+------------------------------------------
Reporter: tibbe | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 6.13
Keywords: | Testcase:
Blockedby: | Difficulty:
Os: Unknown/Multiple | Blocking:
Architecture: Unknown/Multiple | Failure: None/Unknown
---------------------------------+------------------------------------------
Comment(by tibbe):
To add to the confusion, using HEAD, this definition of `foldl'` gets an
unboxed accumulator:
{{{
fold' :: (a -> b -> a) -> a -> Tree b -> a
fold' f = go
where
go z Leaf = z
go z (Node a l r) = z `seq` go (f (go z l) a) r
{-# INLINE fold' #-}
}}}
but this one doesn't
{{{
fold' :: (a -> b -> a) -> a -> Tree b -> a
fold' f = go
where
go z Leaf = z
go z (Node a l r) = z `seq` go (f (go z l) a) r
}}}
Note the missing `INLINE` pragma.
The strange thing is that GHC happily inlines both versions (since they're
not recursive) but the former gets an unboxed accumulator for some reason
I don't understand.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4267#comment:5>
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