git.iko.soy/distributed-process
on master help sign in
Define "void" manually for older ghc
466ab5eEdsko de Vries
network-transport-2/src/Network/Transport/Internal.hs+6−1
@@ -9,13 +9,14 @@ module Network.Transport.Internal ( -- * Encoders/decoders
9 , mapExceptionIO
9 , mapExceptionIO
10 , tryIO
10 , tryIO
11 , tryToEnum
11 , tryToEnum
12+ , void
12 -- * Debugging
13 -- * Debugging
13 , tlog
14 , tlog
14 ) where
15 ) where
15
16
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
81-}
82-}
82
83
84+-- | Not all versions of "base" export 'void'
85+void :: Monad m => m a -> m ()
86+void p = p >> return ()
87+
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
network-transport-2/src/Network/Transport/TCP.hs+2−1
@@ -39,6 +39,7 @@ import Network.Transport.Internal ( encodeInt32
39 , mapExceptionIO
39 , mapExceptionIO
40 , tryIO
40 , tryIO
41 , tryToEnum
41 , tryToEnum
42+ , void
42 )
43 )
43import qualified Network.Socket as N ( HostName
44import qualified Network.Socket as N ( HostName
44 , ServiceName
45 , ServiceName
@@ -71,7 +72,7 @@ import Control.Concurrent.MVar ( MVar
71 )
72 )
72import Control.Category ((>>>))
73import Control.Category ((>>>))
73import Control.Applicative ((<$>))
74import Control.Applicative ((<$>))
74−import Control.Monad (forM, forM_, void, when, unless)
75+import Control.Monad (forM, forM_, when, unless)
75import Control.Exception (IOException, SomeException, handle, throw, try, bracketOnError)
76import Control.Exception (IOException, SomeException, handle, throw, try, bracketOnError)
76import Data.IORef (IORef, newIORef, writeIORef, readIORef)
77import Data.IORef (IORef, newIORef, writeIORef, readIORef)
77import Data.ByteString (ByteString)
78import Data.ByteString (ByteString)