| Safe Haskell | None | 
|---|---|
| Language | Haskell98 | 
Network.Transport.Internal
Description
Internal functions
- encodeInt32 :: Enum a => a -> ByteString
 - decodeInt32 :: Num a => ByteString -> a
 - encodeInt16 :: Enum a => a -> ByteString
 - decodeInt16 :: Num a => ByteString -> a
 - prependLength :: [ByteString] -> [ByteString]
 - mapIOException :: Exception e => (IOException -> e) -> IO a -> IO a
 - tryIO :: MonadIO m => IO a -> m (Either IOException a)
 - tryToEnum :: (Enum a, Bounded a) => Int -> Maybe a
 - timeoutMaybe :: Exception e => Maybe Int -> e -> IO a -> IO a
 - asyncWhenCancelled :: forall a. (a -> IO ()) -> IO a -> IO a
 - void :: Monad m => m a -> m ()
 - forkIOWithUnmask :: ((forall a. IO a -> IO a) -> IO ()) -> IO ThreadId
 - tlog :: MonadIO m => String -> m ()
 
Encoders/decoders
encodeInt32 :: Enum a => a -> ByteString Source
Serialize 32-bit to network byte order
decodeInt32 :: Num a => ByteString -> a Source
Deserialize 32-bit from network byte order Throws an IO exception if this is not a valid integer.
encodeInt16 :: Enum a => a -> ByteString Source
Serialize 16-bit to network byte order
decodeInt16 :: Num a => ByteString -> a Source
Deserialize 16-bit from network byte order Throws an IO exception if this is not a valid integer
prependLength :: [ByteString] -> [ByteString] Source
Prepend a list of bytestrings with their total length
Miscellaneous abstractions
mapIOException :: Exception e => (IOException -> e) -> IO a -> IO a Source
Translate exceptions that arise in IO computations
tryIO :: MonadIO m => IO a -> m (Either IOException a) Source
Like try, but lifted and specialized to IOExceptions
timeoutMaybe :: Exception e => Maybe Int -> e -> IO a -> IO a Source
If the timeout value is not Nothing, wrap the given computation with a timeout and it if times out throw the specified exception. Identity otherwise.
asyncWhenCancelled :: forall a. (a -> IO ()) -> IO a -> IO a Source
asyncWhenCancelled g f runs f in a separate thread and waits for it
 to complete. If f throws an exception we catch it and rethrow it in the
 current thread. If the current thread is interrupted before f completes,
 we run the specified clean up handler (if f throws an exception we assume
 that no cleanup is necessary).
Replicated functionality from "base"
forkIOWithUnmask :: ((forall a. IO a -> IO a) -> IO ()) -> IO ThreadId Source
This was introduced in "base" some time after 7.0.4