[GHC] #13457: unsafeInterleaveST is too unsafe

GHC ghc-devs at haskell.org
Mon Mar 20 16:34:53 UTC 2017


#13457: unsafeInterleaveST is too unsafe
-------------------------------------+-------------------------------------
        Reporter:  dfeuer            |                Owner:  dfeuer
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.4.1
       Component:  Core Libraries    |              Version:  8.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect result  |  Unknown/Multiple
  at runtime                         |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by ekmett):

 If you don't read or write to the same STRef (or STArray element) like you
 state (and don't use unsafeIOToST, etc.) then this is a sufficient
 condition for your operation to be idempotent. =)

 You can actually strengthen to not reading from a ref that you write to
 before you write to it. The write washes away your sins by destroying any
 information leaked. I actually exploit that extra structure in my monadic
 revisions code.

 But again, this is just a weak way to state a demand for idempotence.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13457#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list