Proposal: Improve the API for TChan, TMVar, and TVar

wren ng thornton wren at freegeek.org
Sat Mar 26 21:30:41 CET 2011


On 3/26/11 11:43 AM, Antoine Latter wrote:
> On Sat, Mar 26, 2011 at 6:26 AM, Bas van Dijk<v.dijk.bas at gmail.com>  wrote:
>> On 26 March 2011 10:29, wren ng thornton<wren at freegeek.org>  wrote:
>>>     tryReadTChan :: TChan a ->  STM (Maybe a)
>>
>> +1 if we also add:
>> tryReadChan :: Chan a ->  IO (Maybe a)
>>
>>>     peekTChan :: TChan a ->  STM a
>>>     tryPeekTChan :: TChan a ->  STM (Maybe a)
>>
>> +1 if we also add:
>> peekChan :: Chan a ->  IO a
>> tryPeekChan :: Chan a ->  IO (Maybe a)
>
> Here's the last time 'tryReadChan' came up, for reference:
> http://thread.gmane.org/gmane.comp.lang.haskell.libraries/14596
>
> I feel like these sorts of operations are much easier to get right in STM.

Agreed. I'm all for adding Chan versions to base if we can get the 
implementation/semantics right, but since I don't have experience with 
Chans I'm not sure if I'm the best person for that task.

-- 
Live well,
~wren



More information about the Libraries mailing list