Send Beginners mailing list submissions to
        beginners@haskell.org

To subscribe or unsubscribe via the World Wide Web, visit
        http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        beginners-requ...@haskell.org

You can reach the person managing the list at
        beginners-ow...@haskell.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1.  How to get IO String from        Network.Socket.ByteString.recv
      method (Dinesh Amerasekara)


----------------------------------------------------------------------

Message: 1
Date: Sun, 20 May 2018 07:52:33 +0000 (UTC)
From: Dinesh Amerasekara <ddines...@yahoo.com>
To: beginners@haskell.org
Subject: [Haskell-beginners] How to get IO String from
        Network.Socket.ByteString.recv method
Message-ID: <1643328860.3250152.1526802753...@mail.yahoo.com>
Content-Type: text/plain; charset="utf-8"

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 8888In 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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20180520/aa7291ee/attachment-0001.html>

------------------------------

Subject: Digest Footer

_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners


------------------------------

End of Beginners Digest, Vol 119, Issue 12
******************************************

Reply via email to