Hi,

I am unable to compile the below code.

import Network.Socket hiding(recv) 
import Network.Socket.ByteString as S (recv) 
import qualified Data.ByteString.Lazy.Char8 as Char8  

getMessage :: Socket -> IO String 
getMessage sock =  Char8.unpack <$> S.recv sock 8888

It gives the below error.

Couldn't match type ‘Data.ByteString.Internal.ByteString’
                     with ‘ByteString’
NB: ‘ByteString’ is defined in ‘Data.ByteString.Lazy.Internal’
    ‘Data.ByteString.Internal.ByteString’
        is defined in ‘Data.ByteString.Internal’
    Expected type: IO ByteString
    Actual type: IO Data.ByteString.Internal.ByteString

In the second argument of ‘(<$>)’, namely ‘recv sock 8888’
In the expression: unpack <$> recv sock 8888
In an equation for ‘getMsg’:
      getMsg sock = unpack <$> recv sock 8888

Can somebody tell me how I can return the IO String using Network.Socket.ByteString.recv?

Best Regards,
Dinesh.