"Duplicate instance declarations"
Bulat Ziganshin
bulatz at HotPOP.com
Wed Dec 28 14:07:45 EST 2005
Hello Ashley,
Wednesday, December 28, 2005, 1:56:51 AM, you wrote:
i tried to implement your solution and failed. i will extend my
original example to show you my problem:
>> class BufStream h where
vPutBuf :: h -> Ptr a -> Int -> IO ()
>> class CharStream h where
vPutStr :: h -> String -> IO ()
>> instance (CharStream h) => BufStream h where
vPutBuf h buf len =
do str <- peekCStringLen (castPtr buf, len)
vPutStr h str
>> class MemoryStream h where
>> instance (MemoryStream h) => BufStream h where
AY> Try this:
class BufStream h where
vPutBuf :: h -> Ptr a -> Int -> IO ()
class (BufStream h) => CharStream h where
vPutStr :: h -> String -> IO ()
now i can give default implemetation of `vPutStr` via `vPutBuf`. but i
need to implement `vPutBuf` via `vPutStr`!
AY> class (BufStream h) => MemoryStream h where
the same problem here - i need to implement `vPutBuf` via functions of
MemoryStream, but it's impossible
--
Best regards,
Bulat mailto:bulatz at HotPOP.com
More information about the Glasgow-haskell-users
mailing list