Haskell初心者です。
質問なのですが、
parseDnsMessage :: BG.BitGet DnsMessage
recQuery :: BS.ByteString -> String -> IO BS.ByteString
resolveName :: [Word8] -> [Word8] -> BS.ByteString -> String
resolveName qname name bstr = do
let newbstr = BSL.toStrict $ replace (BS.pack qname) (BS.pack name) bstr
retbstr <- recQuery newbstr (head rootServers4)
let msg = BG.runBitGet retbstr parseDnsMessage
case msg of
Right m -> (intercalate "." $ map show (rdata $ head $ answer $ m))
---以下エラーメッセージ---
Couldn't match expected type ‘[BSI.ByteString]’
with actual type ‘IO BSI.ByteString’
In a stmt of a 'do' block:
retbstr <- recQuery newbstr (head rootServers4)
In the expression:
do { let newbstr
= BSL.toStrict $ replace (BS.pack qname) (BS.pack name) bstr;
retbstr <- recQuery newbstr (head rootServers4);
let msg = BG.runBitGet retbstr parseDnsMessage;
case msg of {
Right m
-> (intercalate "." $ map show (rdata $ head $ answer $ m)) } }
このような場合どのように書くのが適切なのでしょうか?
よろしくお願いします。