Hello Duncan,

Monday, January 30, 2006, 9:02:48 PM, you wrote:

DC> class IStream s where
DC>   readBlock :: s -> IO Block

DC> data IStream = IStream {
DC>   istream_readBlock :: IO Block
DC> }

DC> instance IStream IStream where
DC>   readBlock s = istream_readBlock s

DC> abstractIStream :: IStream s => s -> IStream
DC> abstractIStream s = IStream { istream_readBlock = readBlock s }


how that is done in my lib:

class (Monad m) => Stream m h | h->m where
    vClose :: h -> m ()
    vIsEOF :: h -> m Bool
    .....

data Handle = forall h . (Stream IO h) => Handle h

instance Stream IO Handle where
    vClose        (Handle h) = vClose        h
    vIsEOF        (Handle h) = vIsEOF        h
    .....




-- 
Best regards,
 Bulat                            mailto:[EMAIL PROTECTED]



_______________________________________________
Haskell-prime mailing list
Haskell-prime@haskell.org
http://haskell.org/mailman/listinfo/haskell-prime

Reply via email to