#5916: runST isn't free
---------------------------------+------------------------------------------
Reporter: tibbe | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.4.1
Keywords: | Os: Unknown/Multiple
Architecture: Unknown/Multiple | Failure: None/Unknown
Difficulty: Unknown | Testcase:
Blockedby: | Blocking:
Related: |
---------------------------------+------------------------------------------
Comment(by simonpj):
Thanks for the example. What I don't understand is ''why'' does `runST`
allocate. That's the example I'd like to see. In your code
{{{
update ary idx b
= runST (update' ary idx b)
= {- inline runST; g is a coercion between ST and STRep -}
runSTRep (update' ary idx b) |> g)
= {- inline the wrapper on update'
runSTRep ($wupdate' ary idx b)
= {- inline runSTRep, admittedly late -}
case $wupdate' ary idx b realWorld# of (# s', _ #) -> s'
}}}
No allocation. So where am I wrong? A tiny repro case of this phenomenon
would be great.
I understand about not wanting to take the `runST` outwards... apart from
anything else it makes it sequential and it should not be!
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5916#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