git.iko.soy/distributed-process
on master help sign in
Define "void" manually for older ghc
commit466ab5ea7e104e900f69b50db8e33ca0730e0c51 authorEdsko de Vries <edsko@green.well-typed.com> dateTue 15 May 2012, 15:34 (14 years ago) parenta585379
2 files changed+8−2
network-transport-2/src/Network/Transport/Internal.hs+6−1 network-transport-2/src/Network/Transport/TCP.hs+2−1
network-transport-2/src/Network/Transport/Internal.hs+6−1
@@ -9,13 +9,14 @@ module Network.Transport.Internal ( -- * Encoders/decoders
99 , mapExceptionIO
1010 , tryIO
1111 , tryToEnum
12+ , void
1213 -- * Debugging
1314 , tlog
1415 ) where
1516
1617import Prelude hiding (catch)
1718import Foreign.Storable (pokeByteOff, peekByteOff)
18−import Foreign.C (CInt(..), CShort(..))
19+import Foreign.C (CInt, CShort)
1920import Foreign.ForeignPtr (withForeignPtr)
2021import Data.ByteString (ByteString)
2122import qualified Data.ByteString as BS (length)
@@ -80,6 +81,10 @@ tlog msg = liftIO $ do
8081 putStrLn $ show tid ++ ": " ++ msg
8182-}
8283
84+-- | Not all versions of "base" export 'void'
85+void :: Monad m => m a -> m ()
86+void p = p >> return ()
87+
8388-- | Safe version of 'toEnum'
8489tryToEnum :: (Enum a, Bounded a) => Int -> Maybe a
8590tryToEnum = go minBound maxBound
network-transport-2/src/Network/Transport/TCP.hs+2−1
@@ -39,6 +39,7 @@ import Network.Transport.Internal ( encodeInt32
3939 , mapExceptionIO
4040 , tryIO
4141 , tryToEnum
42+ , void
4243 )
4344import qualified Network.Socket as N ( HostName
4445 , ServiceName
@@ -71,7 +72,7 @@ import Control.Concurrent.MVar ( MVar
7172 )
7273import Control.Category ((>>>))
7374import Control.Applicative ((<$>))
74−import Control.Monad (forM, forM_, void, when, unless)
75+import Control.Monad (forM, forM_, when, unless)
7576import Control.Exception (IOException, SomeException, handle, throw, try, bracketOnError)
7677import Data.IORef (IORef, newIORef, writeIORef, readIORef)
7778import Data.ByteString (ByteString)