Opened 10 months ago

Closed 5 months ago

#7986 closed bug (fixed)

make newBroadcastTChanIO match newBroadcastTChan

Reported by: WrenThornton Owned by:
Priority: normal Milestone:
Component: libraries (other) Version: 7.6.3
Keywords: stm Cc: mihaly.barasz@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty: Easy (less than 1 hour)
Test Case: Blocked By:
Blocking: Related Tickets:

Description

While looking through the pull requests for stm-chans I came across a discrepancy in the new stm. Namely, we have the following definitions:

  • stm == 2.4
        newBroadcastTChan :: STM (TChan a)
        newBroadcastTChan = do
            dummy_hole <- newTVar TNil
            write_hole <- newTVar TNil
            read <- newTVar dummy_hole
            write <- newTVar write_hole
            return (TChan read write)
    
        newBroadcastTChanIO :: IO (TChan a)
        newBroadcastTChanIO = do
            dummy_hole <- newTVarIO TNil
            write_hole <- newTVarIO TNil
            read <- newTVarIO dummy_hole
            write <- newTVarIO write_hole
            return (TChan read write)
    
  • stm == 2.4.2
        newBroadcastTChan :: STM (TChan a)
        newBroadcastTChan = do
            write_hole <- newTVar TNil
            read <- newTVar (error ...)
            write <- newTVar write_hole
            return (TChan read write)
    
        newBroadcastTChanIO :: IO (TChan a)
        newBroadcastTChanIO = do
            dummy_hole <- newTVarIO TNil
            write_hole <- newTVarIO TNil
            read <- newTVarIO dummy_hole
            write <- newTVarIO write_hole
            return (TChan read write)
    

Thus, whoever changed the definition of newBroadcastTChan in 2.4.2 forgot to change newBroadcastTChanIO to keep it in sync.

PROPOSAL: I propose changing newBroadcastTChanIO to match newBroadcastTChan.

ACCEPTED: +1: wren ng thornton, Edward Kmett, John Wiegley; -1: noone.

http://www.haskell.org/pipermail/libraries/2013-May/019808.html

Attachments (1)

broadcastTChan.patch (1.2 KB) - added by klao 9 months ago.
patch for the proposed change

Download all attachments as: .zip

Change History (4)

comment:1 Changed 9 months ago by klao

  • Cc mihaly.barasz@… added
  • Difficulty set to Easy (less than 1 hour)

Another +1 here.

Changed 9 months ago by klao

patch for the proposed change

comment:2 Changed 5 months ago by khyperia

Is this ticket still valid? If my guess is correct, these functions eventually transformed into newChan in libraries/base/Control/Concurrent/Chan.hs, but I'm not sure.

Not sure what to do about this ticket, though - it's still in "new" status. (I found it while digging for tickets to do)

Version 0, edited 5 months ago by khyperia (next)

comment:3 Changed 5 months ago by rwbarton

  • Component changed from Compiler to libraries (other)
  • Keywords stm added
  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.