[Haskell-cafe] Eq instance for Chan

Mitar mmitar at gmail.com
Thu Nov 25 01:48:21 CET 2010


Why is there no Eq instance for Chan? There is Eq for MVar so it is
quite possible to define also Eq for Chan?

What I would like to do is keep track how many consumers I have for
each Chan so duplicating them with dupChan as necessary. So I was
thinking of storing a list of Chans which already have a consumer and
then duplicating it if another (and every additional) consumer would
be added. But without Eq it is not possible to check if there is Chan
already in a list (and I hope Eq would compare just Chan and not its

Is there some other way to achieve this?


More information about the Haskell-Cafe mailing list