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

Antoine Latter aslatter at gmail.com
Sat Mar 26 16:43:36 CET 2011


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.

+1 on adding the above to STM, though.

Antoine



More information about the Libraries mailing list