"Duplicate instance declarations"
Bulat Ziganshin
bulatz at HotPOP.com
Sun Dec 25 17:20:45 EST 2005
Hello all
why the folowing is not allowed even with all extensions enabled both
in Hugs and GHC?
class BufStream h where
class CharStream h where
instance (CharStream h) => BufStream h where
class MemoryStream h where
instance (MemoryStream h) => BufStream h where
i plan to implement many streams, some of which are supporting
getBuf/putBuf interface of MemoryStream, and some getChar/putChar
interface of CharStream and then automatically derive BufStream using
the appropriate operations. but that just fail
how can i pass around these restriction?
can this be supported in future Hugs/GHC versions?
... just now i encountered this problem again:
-- Copy entire contents of Stream to another Stream
class (Stream h1, Stream h2) => StreamCopying h1 h2 where
copyStream :: h1 -> h2 -> IO ()
instance (MemoryStream h1, BufStream h2) => StreamCopying h1 h2 where
copyStream h1 h2 = return ()
instance (BufStream h1, MemoryStream h2) => StreamCopying h1 h2 where
copyStream h1 h2 = return ()
--
Best regards,
Bulat mailto:bulatz at HotPOP.com
More information about the Glasgow-haskell-users
mailing list