Proposal: split Chan and TChan into read and write ends

Brandon Simmons brandon.m.simmons at gmail.com
Sat Oct 27 19:05:56 CEST 2012


On Sat, Oct 27, 2012 at 12:28 PM, Johan Tibell <johan.tibell at gmail.com> wrote:
> On Fri, Oct 26, 2012 at 8:23 PM, Brandon Simmons
> <brandon.m.simmons at gmail.com> wrote:
>> Hi everybody,
>> Just discovered all the great discussion here, and although my
>> google-fu turned up no prior discussions on this subject, I apologize
>> if it has already been discussed.
>>
>> I propose that Chan and TChan should be implemented as a pair of read
>> and write ends, initialized as follows:
>>
>>     newSplitChan :: IO (InChan a, OutChan a)
>>
>> I've implemented this already here:
>> http://hackage.haskell.org/package/chan-split . You can ignore the
>> type classes I've defined; they're there for my own reasons and not
>> part of the proposal.
>
> I think this makes for a great package or perhaps an extra
> Unidirectional module nested inside the Chan module. Breaking the well
> used Chan API doesn't seem necessary in this case.

In the scenario where an extra module is added to the current
libraries, it would be logical to then implement the current non-split
Chan modules in terms of the split module. Are there arguments against
doing that?



More information about the Libraries mailing list