id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc,os,architecture,failure,difficulty,testcase,blockedby,blocking,related
680,SCC mis-accounting,andrew@…,simonmar,"The profiles sometimes charges to the wrong account.  In this example:
{{{
foo :: (() -> () -> [()] -> [()]) -> () -> [()] -> [()]
foo k =
  \_ xs -> concatMap ($ [head xs]) [bar]
 where
  bar =
    let k' = k undefined undefined
    in  \xs ->
          let k'' = [k' xs]
          in  (() : (foldr1 (>>) k''))

k = foo (\_ -> k)
--k a = foo (\_ -> k) a
r = k undefined [] !! 4000
main = print r
}}}
almost all of the time, allocations, and heap retention are charged
to k.  However, if you use the commented definition of k, the changes
switch to foo, as expected.  This can be tested by running
{{{
ghc --make -prof -auto-all Logic.hs && ./a.out +RTS -hc && hp2ps -c a.out.hp
}}}
and watching the pretty graph change.

This is using ghc 6.4.1 from Debian unstable.  More background at
http://haskell.org/pipermail/haskell-cafe/2006-February/014139.html",bug,closed,high,7.4.1,Profiling,6.4.1,fixed,,,Unknown/Multiple,Unknown/Multiple,None/Unknown,Unknown,T680,,,
