Portability | non-portable (not tested) |
---|---|
Stability | experimental |
Maintainer | bjorn@bringert.net |
Safe Haskell | None |
An library for creating abstract streams. Originally part of Gray's\/Bringert's HTTP module.
- Changes by Simon Foster: - Split module up into to sepearate Network.[Stream,TCP,HTTP] modules
- data Debug x
- class Stream x where
- debugStream :: Stream a => String -> a -> IO (Debug a)
- data ConnError
- = ErrorReset
- | ErrorClosed
- | ErrorParse String
- | ErrorMisc String
- type Result a = Either ConnError a
- handleSocketError :: Socket -> SomeException -> IO (Result a)
- bindE :: Either ConnError a -> (a -> Either ConnError b) -> Either ConnError b
- myrecv :: Socket -> Int -> IO String
Streams
Streams should make layering of TLS protocol easier in future, they allow reading/writing to files etc for debugging, they allow use of protocols other than TCP/IP and they allow customisation.
Instances of this class should not trim the input in any way, e.g. leave LF on line endings etc. Unless that is exactly the behaviour you want from your twisted instances ;)
debugStream :: Stream a => String -> a -> IO (Debug a)Source
Wraps a stream with logging I/O, the first argument is a filename which is opened in AppendMode.
Errors
ErrorReset | |
ErrorClosed | |
ErrorParse String | |
ErrorMisc String |
type Result a = Either ConnError aSource
This is the type returned by many exported network functions.
handleSocketError :: Socket -> SomeException -> IO (Result a)Source