Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
This module defines a connection interface. It could be a regular network connection, TLS connection, a mock or anything else.
- data Connection = Connection {
- read :: IO ByteString
- unread :: ByteString -> IO ()
- write :: ByteString -> IO ()
- flush :: IO ()
- close :: IO ()
- readExactly :: Connection -> Int -> IO ByteString
- fromHandle :: Handle -> IO Connection
Documentation
data Connection Source
Connection | |
|
readExactly :: Connection -> Int -> IO ByteString Source
Read specified number of bytes
If EOF is reached before N bytes then raise EOF exception.
fromHandle :: Handle -> IO Connection Source
Make connection form handle