
Hello Henrik, Monday, October 22, 2007, 10:02:20 PM, you wrote:
In particular, I want to define two classes 'Channel' and 'Port' (see below) that define a common interface for several concrete implementations with different synchronization characteristics.
may be this my code will be useful for you: class PipeElement e where getP :: e a -> IO a putP :: e a -> a -> IO () instance PipeElement MVar where getP = takeMVar putP = putMVar instance PipeElement Chan where getP = readChan putP = writeChan data PairFunc a = PairFunc (IO a) (a -> IO ()) instance PipeElement PairFunc where getP (PairFunc get_f put_f) = get_f putP (PairFunc get_f put_f) = put_f -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com