@@ -9,13 +9,14 @@ module Network.Transport.Internal ( -- * Encoders/decoders
9 , mapExceptionIO
9 , mapExceptionIO
11 , tryToEnum
11 , tryToEnum
12 -- * Debugging
13 -- * Debugging
16import Prelude hiding (catch)
17import Prelude hiding (catch)
17import Foreign.Storable (pokeByteOff, peekByteOff)
18import Foreign.Storable (pokeByteOff, peekByteOff)
18−import Foreign.C (CInt(..), CShort(..))
19+import Foreign.C (CInt, CShort)
19import Foreign.ForeignPtr (withForeignPtr)
20import Foreign.ForeignPtr (withForeignPtr)
20import Data.ByteString (ByteString)
21import Data.ByteString (ByteString)
21import qualified Data.ByteString as BS (length)
22import qualified Data.ByteString as BS (length)
@@ -80,6 +81,10 @@ tlog msg = liftIO $ do
80 putStrLn $ show tid ++ ": " ++ msg
81 putStrLn $ show tid ++ ": " ++ msg
84+-- | Not all versions of "base" export 'void'
85+void :: Monad m => m a -> m ()
86+void p = p >> return ()
83-- | Safe version of 'toEnum'
88-- | Safe version of 'toEnum'
84tryToEnum :: (Enum a, Bounded a) => Int -> Maybe a
89tryToEnum :: (Enum a, Bounded a) => Int -> Maybe a
85tryToEnum = go minBound maxBound
90tryToEnum = go minBound maxBound