Skip to content

Commit

Permalink
Merge pull request #467 from tmcgilchrist/cleanup
Browse files Browse the repository at this point in the history
General tidy up of dependencies and warnings
  • Loading branch information
LaurentRDC authored Feb 5, 2025
2 parents 66fae14 + e3196db commit bd37cca
Show file tree
Hide file tree
Showing 20 changed files with 21 additions and 76 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/cabal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ name: Continuous integration

on:
push:
branches: ['master']
paths-ignore:
- 'README.md'
- 'CONTRIBUTING.md'
pull_request:
branches: ['master']

jobs:
continuous-integration:
Expand Down
15 changes: 0 additions & 15 deletions packages/distributed-process-async/distributed-process-async.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,10 @@ library
import: warnings
build-depends:
base >= 4.14 && < 5,
data-accessor >= 0.2.2.3,
distributed-process >= 0.6.1 && < 0.8,
exceptions >= 0.10 && < 1.0,
binary >= 0.8 && < 0.9,
deepseq >= 1.4 && < 1.7,
mtl,
containers >= 0.6 && < 0.8,
hashable >= 1.2.0.5 && < 1.6,
unordered-containers >= 0.2.3.0 && < 0.3,
fingertree < 0.2,
stm >= 2.4 && < 2.6,
time >= 1.9,
transformers
default-extensions: CPP
InstanceSigs
hs-source-dirs: src
Expand All @@ -66,20 +57,14 @@ test-suite AsyncTests
x-uses-tf: true
build-depends:
base >= 4.14 && < 5,
ansi-terminal >= 0.5 && < 1.2,
distributed-process,
distributed-process-async,
distributed-process-systest ^>= 0.4,
exceptions >= 0.10 && < 1.0,
network >= 2.5 && < 3.3,
network-transport >= 0.4 && < 0.6,
network-transport-tcp >= 0.6 && < 0.9,
binary >= 0.8 && < 0.9,
deepseq >= 1.4 && < 1.7,
stm >= 2.3 && < 2.6,
tasty >= 1.5 && <1.6,
tasty-hunit >=0.10 && <0.11,
transformers
hs-source-dirs: tests
default-language: Haskell2010
ghc-options: -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,8 @@ library
deepseq >= 1.4 && < 1.7,
mtl,
containers >= 0.6 && < 0.8,
hashable >= 1.2.0.5 && < 1.6,
unordered-containers >= 0.2.3.0 && < 0.3,
fingertree < 0.2,
stm >= 2.4 && < 2.6,
time > 1.4 && < 1.15,
transformers,
exceptions >= 0.10 && < 0.11
hs-source-dirs: src
exposed-modules:
Expand All @@ -74,25 +70,17 @@ test-suite ManagedProcessTests
x-uses-tf: true
build-depends:
base >= 4.14 && < 5,
ansi-terminal >= 0.5 && < 1.2,
containers,
distributed-process,
distributed-process-extras,
distributed-process-async,
distributed-process-client-server,
distributed-process-systest ^>= 0.4,
network-transport >= 0.4 && < 0.7,
mtl,
fingertree,
network-transport-tcp >= 0.6 && < 0.9,
binary >= 0.8 && < 0.9,
deepseq,
network >= 2.3 && < 3.3,
stm,
tasty >= 1.5 && <1.6,
tasty-hunit >=0.10 && <0.11,
transformers,
ghc-prim,
exceptions
other-modules: Counter,
ManagedProcessCommon,
Expand All @@ -111,25 +99,18 @@ test-suite PrioritisedProcessTests
x-uses-tf: true
build-depends:
base >= 4.14 && < 5,
ansi-terminal,
containers,
distributed-process,
distributed-process-extras,
distributed-process-async,
distributed-process-client-server,
distributed-process-systest ^>= 0.4,
network-transport,
mtl,
fingertree,
network-transport-tcp,
binary,
deepseq,
network,
stm,
tasty >= 1.5 && <1.6,
tasty-hunit >=0.10 && <0.11,
transformers,
ghc-prim,
exceptions
other-modules: ManagedProcessCommon,
TestUtils
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,6 @@ module Control.Distributed.Process.ManagedProcess
import Control.Distributed.Process hiding (call, Message)
import Control.Distributed.Process.ManagedProcess.Client
import Control.Distributed.Process.ManagedProcess.Server
import qualified Control.Distributed.Process.ManagedProcess.Server.Restricted as R
import qualified Control.Distributed.Process.ManagedProcess.Server.Priority as P hiding (reject)
import qualified Control.Distributed.Process.ManagedProcess.Internal.GenProcess as Gen
import Control.Distributed.Process.ManagedProcess.Internal.GenProcess
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ import qualified Control.Distributed.Process.ManagedProcess.Internal.GenProcess
, modifyState
, setUserTimeout
, setProcessState
, GenProcess
, peek
, push
, enqueue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ import Control.Distributed.Process.Extras.Timer
import Data.Binary (Binary)
import Data.Maybe (isJust, fromJust)
import Data.Typeable (Typeable)
import GHC.Conc (registerDelay)
import GHC.Generics

--------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,11 @@ module Control.Distributed.Process.Extras.Internal.Containers.MultiMap

import qualified Data.Foldable as Foldable
import Data.Foldable (Foldable)

import Data.Hashable
import Data.HashMap.Strict (HashMap)
import qualified Data.HashMap.Strict as Map
import Data.HashSet (HashSet)
import qualified Data.HashSet as Set
import Data.Foldable (Foldable(foldr))
import Prelude hiding (lookup, filter, pred)

-- | Class of things that can be inserted in a map or
Expand Down
2 changes: 1 addition & 1 deletion packages/distributed-process-extras/tests/TestQueues.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import qualified Control.Distributed.Process.Extras.Internal.Queue.PriorityQ as
import Data.Function (on)
import Data.List ( sortBy )
import Test.Tasty (TestTree, testGroup, defaultMain)
import Test.Tasty.HUnit (Assertion, assertEqual, assertBool, testCase)
import Test.Tasty.HUnit (assertEqual, assertBool, testCase)
import Test.Tasty.QuickCheck (testProperty)

import Prelude
Expand Down
2 changes: 1 addition & 1 deletion packages/distributed-process-extras/tests/TestTimer.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import Control.Distributed.Process.Extras.Timer
import Control.Distributed.Process.SysTest.Utils

import Test.Tasty (TestTree, testGroup, defaultMain)
import Test.Tasty.HUnit (Assertion, assertEqual, assertBool, testCase)
import Test.Tasty.HUnit (testCase)
import Network.Transport.TCP
import qualified Network.Transport as NT

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ Library
data-accessor >= 0.2 && < 0.3,
binary >= 0.8 && < 0.9,
containers >= 0.6 && < 0.8,
transformers >= 0.2 && < 0.7,
network-transport >= 0.5 && < 0.6,
network-transport-tcp >= 0.4 && < 0.9,
distributed-process >= 0.5.0 && < 0.8
Expand Down
12 changes: 6 additions & 6 deletions packages/distributed-process-simplelocalnet/tests/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

import Control.Concurrent (forkIO, threadDelay)
import qualified Control.Concurrent.MVar as MVar
import Control.Distributed.Process (NodeId, Process, liftIO)
import Control.Distributed.Process.Node (initRemoteTable)
import Control.Distributed.Process.Backend.SimpleLocalnet
import Control.Monad (forM_)
import Control.Monad.IO.Class (liftIO)
import qualified Data.List as List
import Test.Tasty (TestTree, defaultMain, testGroup)
import Test.Tasty.HUnit (assertEqual, testCase)

main :: IO ()
main = defaultMain
$ testGroup "Test suite"
main = defaultMain
$ testGroup "Test suite"
[ testDiscoverNodes
]

Expand All @@ -24,7 +24,7 @@ testDiscoverNodes = testCase "discover nodes" $ do
backend <- initializeBackend "127.0.0.1" port initRemoteTable
_ <- forkIO $ startSlave backend
threadDelay 100000

-- initialize master node
discoveredNodesSlot <- MVar.newEmptyMVar
backend <- initializeBackend "127.0.0.1" "10004" initRemoteTable
Expand All @@ -33,12 +33,12 @@ testDiscoverNodes = testCase "discover nodes" $ do
liftIO $ MVar.putMVar discoveredNodesSlot nds

discoveredNodes <- (List.sort . List.nub) <$> MVar.readMVar discoveredNodesSlot
assertEqual "Discovered nodes"
assertEqual "Discovered nodes"
[ "nid://127.0.0.1:10000:0"
, "nid://127.0.0.1:10001:0"
, "nid://127.0.0.1:10002:0"
, "nid://127.0.0.1:10003:0"
]
]
(map show discoveredNodes)


Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ import Control.Distributed.Process.Supervisor.Types
, SupervisorPid
)
import Data.Binary
import Data.Foldable (mapM_)
import Data.Hashable (Hashable(..))
import Control.Distributed.Process.Extras.Internal.Containers.MultiMap (MultiMap)
import qualified Control.Distributed.Process.Extras.Internal.Containers.MultiMap as Map
Expand Down
1 change: 0 additions & 1 deletion packages/distributed-process/distributed-process.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ Library
hashable >= 1.2.0.5 && < 1.6,
network-transport >= 0.4.1.0 && < 0.6,
stm >= 2.4 && < 2.6,
transformers >= 0.2 && < 0.7,
mtl >= 2.0 && < 2.4,
data-accessor >= 0.2 && < 0.3,
bytestring >= 0.10 && < 0.13,
Expand Down
1 change: 0 additions & 1 deletion packages/network-transport-inmemory/tests/TestInMemory.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import Network.Transport.Tests
import Network.Transport.Tests.Auxiliary (runTests)
import Network.Transport.InMemory
import Network.Transport
import Control.Applicative ((<$>))

main :: IO ()
main = do
Expand Down
19 changes: 7 additions & 12 deletions packages/network-transport-tcp/src/Network/Transport/TCP.hs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ import Network.Transport.Internal
( prependLength
, mapIOException
, tryIO
, tryToEnum
, void
, timeoutMaybe
, asyncWhenCancelled
Expand Down Expand Up @@ -130,7 +129,6 @@ import Control.Concurrent.MVar
)
import Control.Concurrent.Async (async, wait)
import Control.Category ((>>>))
import Control.Applicative ((<$>))
import Control.Monad (when, unless, join, mplus, (<=<))
import Control.Exception
( IOException
Expand All @@ -151,10 +149,10 @@ import Control.Exception
)
import Data.IORef (IORef, newIORef, writeIORef, readIORef, writeIORef)
import Data.ByteString (ByteString)
import qualified Data.ByteString as BS (concat, length, null)
import qualified Data.ByteString as BS (concat, null)
import qualified Data.ByteString.Char8 as BSC (pack, unpack)
import Data.Bits (shiftL, (.|.))
import Data.Maybe (isJust, isNothing, fromJust)
import Data.Maybe (isJust, isNothing)
import Data.Word (Word32)
import Data.Set (Set)
import qualified Data.Set as Set
Expand All @@ -168,7 +166,6 @@ import qualified Data.Set as Set
)
import Data.Map (Map)
import qualified Data.Map as Map (empty)
import Data.Traversable (traverse)
import Data.Accessor (Accessor, accessor, (^.), (^=), (^:))
import qualified Data.Accessor.Container as DAC (mapMaybe)
import Data.Foldable (forM_, mapM_)
Expand Down Expand Up @@ -821,8 +818,6 @@ apiConnect transport ourEndPoint theirAddress _reliability hints =
{ send = apiSend (ourEndPoint, theirEndPoint) connId connAlive
, close = apiClose (ourEndPoint, theirEndPoint) connId connAlive
}
where
params = transportParams transport

-- | Close a connection
apiClose :: EndPointPair -> LightweightConnectionId -> IORef Bool -> IO ()
Expand Down Expand Up @@ -1025,7 +1020,7 @@ handleConnectionRequest transport socketClosed (sock, sockAddr) = handle handleE
handleConnectionRequestV0 :: (N.Socket, N.SockAddr) -> IO (Maybe (IO ()))
handleConnectionRequestV0 (sock, sockAddr) = do
-- Get the OS-determined host and port.
(numericHost, resolvedHost, actualPort) <-
(numericHost, resolvedHost, _actualPort) <-
resolveSockAddr sockAddr >>=
maybe (throwIO (userError "handleConnectionRequest: invalid socket address")) return
-- The peer must send our identifier and their address promptly, if a
Expand Down Expand Up @@ -1304,7 +1299,7 @@ handleIncomingMessages params (ourEndPoint, theirEndPoint) =

-- Close the socket (if we don't have any outgoing connections)
closeSocket :: N.Socket -> LightweightConnectionId -> IO Bool
closeSocket sock lastReceivedId = do
closeSocket _sock lastReceivedId = do
mAct <- modifyMVar theirState $ \st -> do
case st of
RemoteEndPointInvalid _ ->
Expand Down Expand Up @@ -1388,8 +1383,8 @@ handleIncomingMessages params (ourEndPoint, theirEndPoint) =
"handleIncomingMessages:closeSocket (closed)"
case mAct of
Nothing -> return False
Just act -> do
runScheduledAction (ourEndPoint, theirEndPoint) act
Just act' -> do
runScheduledAction (ourEndPoint, theirEndPoint) act'
return True

-- Read a message and output it on the endPoint's channel. By rights we
Expand Down Expand Up @@ -2013,7 +2008,7 @@ schedule theirEndPoint act = do
-- However, it will then wait until @p@ is executed (by this call to
-- 'runScheduledAction' or by another).
runScheduledAction :: EndPointPair -> Action a -> IO a
runScheduledAction (ourEndPoint, theirEndPoint) mvar = do
runScheduledAction (_ourEndPoint, theirEndPoint) mvar = do
join $ readChan (remoteScheduled theirEndPoint)
ma <- readMVar mvar
case ma of
Expand Down
8 changes: 1 addition & 7 deletions packages/network-transport-tcp/tests/TestTCP.hs
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,11 @@ import Control.Concurrent.MVar ( MVar
, putMVar
, takeMVar
, readMVar
, isEmptyMVar
, newMVar
, modifyMVar
, modifyMVar_
, swapMVar
)
import Control.Monad (replicateM, guard, forM_, replicateM_, when)
import Control.Applicative ((<$>))
import Control.Monad (replicateM, guard, replicateM_, when)
import Control.Exception (throwIO, try, SomeException)
import Network.Transport.TCP ( socketToEndPoint )
import Network.Transport.Internal ( prependLength
Expand All @@ -48,7 +45,6 @@ import Network.Transport.TCP.Internal
, decodeControlHeader
, ConnectionRequestResponse(..)
, encodeConnectionRequestResponse
, decodeConnectionRequestResponse
, encodeWord32
, recvWord32
, forkServer
Expand All @@ -63,12 +59,10 @@ import qualified Network.Transport.TCP.Mock.Socket as N
import qualified Network.Socket as N
#endif
( close
, ServiceName
, Socket
, AddrInfo
, shutdown
, ShutdownCmd(ShutdownSend)
, SockAddr(..)
, SocketType(Stream)
, AddrInfo(..)
, getAddrInfo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import Control.Exception
)
import Control.Monad (replicateM, replicateM_, when, guard, forM_, unless)
import Control.Monad.Except ()
import Control.Applicative ((<$>))
import Network.Transport
import Network.Transport.Internal (tlog, tryIO, timeoutMaybe)
import Network.Transport.Util (spawn)
Expand Down Expand Up @@ -652,7 +651,7 @@ testCloseEndPoint transport _ = do

-- First test (see client)
do
theirAddr <- readMVar clientAddr1
_theirAddr <- readMVar clientAddr1
ConnectionOpened cid ReliableOrdered addr <- receive endpoint
-- Ensure that connecting to the supplied address reaches the peer.
Right conn <- connect endpoint addr ReliableOrdered defaultConnectHints
Expand Down Expand Up @@ -716,7 +715,7 @@ testCloseEndPoint transport _ = do
send conn ["ping"]

-- Reply from the server
ConnectionOpened cid ReliableOrdered addr <- receive endpoint
ConnectionOpened cid ReliableOrdered _addr <- receive endpoint
Received cid' ["pong"] <- receive endpoint ; True <- return $ cid == cid'

-- Close the endpoint
Expand Down
Loading

0 comments on commit bd37cca

Please sign in to comment.