git.iko.soy/distributed-process
on master help sign in
Merge pull request #292 from bgamari/warnings
42c71ebFacundo Domínguez
distributed-process-tests/distributed-process-tests.cabal−1
@@ -48,7 +48,6 @@ library
48 DeriveDataTypeable,
48 DeriveDataTypeable,
49 DeriveGeneric,
49 DeriveGeneric,
50 GeneralizedNewtypeDeriving,
50 GeneralizedNewtypeDeriving,
51− OverlappingInstances,
52 RankNTypes,
51 RankNTypes,
53 RecordWildCards,
52 RecordWildCards,
54 ScopedTypeVariables
53 ScopedTypeVariables
distributed-process-tests/src/Control/Distributed/Process/Tests/Receive.hs+1−4
@@ -1,4 +1,4 @@
1−{-# LANGUAGE TemplateHaskell, DeriveDataTypeable #-}
1+{-# LANGUAGE TemplateHaskell #-}
2{-# OPTIONS_GHC -Wall #-}
2{-# OPTIONS_GHC -Wall #-}
3
3
4-- | XXX test doesn't work, because failure exceptions don't get propagated. The
4-- | XXX test doesn't work, because failure exceptions don't get propagated. The
@@ -14,9 +14,6 @@ import Control.Distributed.Process.Closure
14import Control.Distributed.Process.Node
14import Control.Distributed.Process.Node
15
15
16import Control.Monad
16import Control.Monad
17−import Text.Printf
18−import Data.Binary
19−import Data.Typeable
20
17
21import Test.HUnit (Assertion, (@?=))
18import Test.HUnit (Assertion, (@?=))
22import Test.Framework (Test, defaultMain)
19import Test.Framework (Test, defaultMain)
src/Control/Distributed/Process.hs−1
@@ -327,7 +327,6 @@ import Prelude
327#else
327#else
328import Prelude hiding (catch)
328import Prelude hiding (catch)
329#endif
329#endif
330−import Control.Distributed.Process.Internal.StrictMVar (readMVar)
331import qualified Control.Exception as Exception (onException)
330import qualified Control.Exception as Exception (onException)
332import Data.Accessor ((^.))
331import Data.Accessor ((^.))
333import Data.Foldable (forM_)
332import Data.Foldable (forM_)
src/Control/Distributed/Process/Internal/Closure/Explicit.hs+1−2
@@ -6,7 +6,6 @@
6 , UndecidableInstances
6 , UndecidableInstances
7 , KindSignatures
7 , KindSignatures
8 , GADTs
8 , GADTs
9− , OverlappingInstances
10 , EmptyDataDecls
9 , EmptyDataDecls
11 , DeriveDataTypeable #-}
10 , DeriveDataTypeable #-}
12module Control.Distributed.Process.Internal.Closure.Explicit
11module Control.Distributed.Process.Internal.Closure.Explicit
@@ -109,7 +108,7 @@ instance Binary EndOfTuple where
109class Curry a b | a -> b where
108class Curry a b | a -> b where
110 curryFun :: a -> b
109 curryFun :: a -> b
111
110
112−instance Curry ((a,EndOfTuple) -> b) (a -> b) where
111+instance Curry ((a, EndOfTuple) -> b) (a -> b) where
113 curryFun f = \x -> f (x,undefined)
112 curryFun f = \x -> f (x,undefined)
114
113
115instance Curry (b -> c) r => Curry ((a,b) -> c) (a -> r) where
114instance Curry (b -> c) r => Curry ((a,b) -> c) (a -> r) where
src/Control/Distributed/Process/Internal/Closure/TH.hs+11−7
@@ -29,11 +29,14 @@ import Language.Haskell.TH
29 , Type(AppT, ForallT, VarT, ArrowT)
29 , Type(AppT, ForallT, VarT, ArrowT)
30 , Info(VarI)
30 , Info(VarI)
31 , TyVarBndr(PlainTV, KindedTV)
31 , TyVarBndr(PlainTV, KindedTV)
32−#if ! MIN_VERSION_template_haskell(2,10,0)
33 , Pred
32 , Pred
33+#if MIN_VERSION_template_haskell(2,10,0)
34+ , conT
35+ , appT
36+#else
37+ , classP
34#endif
38#endif
35 , varT
39 , varT
36− , classP
37 -- Lifted constructors
40 -- Lifted constructors
38 -- .. Literals
41 -- .. Literals
39 , stringL
42 , stringL
@@ -71,10 +74,6 @@ import Control.Distributed.Process.Serializable
71 )
74 )
72import Control.Distributed.Process.Internal.Closure.BuiltIn (staticDecode)
75import Control.Distributed.Process.Internal.Closure.BuiltIn (staticDecode)
73
76
74−#if MIN_VERSION_template_haskell(2,10,0)
75−type Pred = Type
76−#endif
77−
78--------------------------------------------------------------------------------
77--------------------------------------------------------------------------------
79-- User-level API --
78-- User-level API --
80--------------------------------------------------------------------------------
79--------------------------------------------------------------------------------
@@ -261,7 +260,12 @@ generateStatic n xs typ = do
261 ]
260 ]
262 where
261 where
263 typeable :: TyVarBndr -> Q Pred
262 typeable :: TyVarBndr -> Q Pred
263+ typeable tv =
264+#if MIN_VERSION_template_haskell(2,10,0)
265+ conT (mkName "Typeable") `appT` varT (tyVarBndrName tv)
266+#else
264− typeable tv = classP (mkName "Typeable") [varT (tyVarBndrName tv)]
267+ classP (mkName "Typeable") [varT (tyVarBndrName tv)]
268+#endif
265
269
266-- | Generate a serialization dictionary with name 'n' for type 'typ'
270-- | Generate a serialization dictionary with name 'n' for type 'typ'
267generateDict :: Name -> Type -> Q [Dec]
271generateDict :: Name -> Type -> Q [Dec]
src/Control/Distributed/Process/Internal/Messaging.hs+1−1
@@ -30,7 +30,7 @@ import qualified Network.Transport as NT
30 , close
30 , close
31 )
31 )
32import Control.Distributed.Process.Internal.Types
32import Control.Distributed.Process.Internal.Types
33− ( LocalNode(localState, localEndPoint, localCtrlChan)
33+ ( LocalNode(localEndPoint, localCtrlChan)
34 , withValidLocalState
34 , withValidLocalState
35 , modifyValidLocalState
35 , modifyValidLocalState
36 , modifyValidLocalState_
36 , modifyValidLocalState_
src/Control/Distributed/Process/Management/Internal/Types.hs−2
@@ -1,5 +1,4 @@
1{-# LANGUAGE DeriveDataTypeable #-}
1{-# LANGUAGE DeriveDataTypeable #-}
2−{-# LANGUAGE StandaloneDeriving #-}
3{-# LANGUAGE ExistentialQuantification #-}
2{-# LANGUAGE ExistentialQuantification #-}
4{-# LANGUAGE GeneralizedNewtypeDeriving #-}
3{-# LANGUAGE GeneralizedNewtypeDeriving #-}
5{-# LANGUAGE DeriveGeneric #-}
4{-# LANGUAGE DeriveGeneric #-}
@@ -23,7 +22,6 @@ import Control.Distributed.Process.Internal.Types
23 ( Process
22 ( Process
24 , ProcessId
23 , ProcessId
25 , Message
24 , Message
26− , SendPort
27 , DiedReason
25 , DiedReason
28 , NodeId
26 , NodeId
29 )
27 )
src/Control/Distributed/Process/Node.hs+2−2
@@ -76,7 +76,7 @@ import qualified Control.Exception as Exception
76 , catches
76 , catches
77 , finally
77 , finally
78 )
78 )
79−import Control.Concurrent (forkIO, forkIOWithUnmask, killThread)
79+import Control.Concurrent (forkIO, killThread)
80import Control.Distributed.Process.Internal.StrictMVar
80import Control.Distributed.Process.Internal.StrictMVar
81 ( newMVar
81 ( newMVar
82 , withMVar
82 , withMVar
@@ -1060,7 +1060,7 @@ ncEffectGetInfo from pid =
1060 , infoMonitors = Set.toList itsMons
1060 , infoMonitors = Set.toList itsMons
1061 , infoLinks = Set.toList itsLinks
1061 , infoLinks = Set.toList itsLinks
1062 }
1062 }
1063− where dispatch :: (Serializable a, Show a)
1063+ where dispatch :: (Serializable a)
1064 => Bool
1064 => Bool
1065 -> ProcessId
1065 -> ProcessId
1066 -> a
1066 -> a
src/Control/Distributed/Process/Serializable.hs+3−5
@@ -30,12 +30,10 @@ import Control.Exception (throw)
30import GHC.Fingerprint.Type (Fingerprint(..))
30import GHC.Fingerprint.Type (Fingerprint(..))
31import Data.ByteString (ByteString)
31import Data.ByteString (ByteString)
32import qualified Data.ByteString as BS
32import qualified Data.ByteString as BS
33−import qualified Data.ByteString.Internal as BSI ( unsafeCreate
33+import qualified Data.ByteString.Internal as BSI ( unsafeCreate, toForeignPtr )
34− , inlinePerformIO
35− , toForeignPtr
36− )
37import Foreign.Storable (pokeByteOff, peekByteOff, sizeOf)
34import Foreign.Storable (pokeByteOff, peekByteOff, sizeOf)
38import Foreign.ForeignPtr (withForeignPtr)
35import Foreign.ForeignPtr (withForeignPtr)
36+import System.IO.Unsafe (unsafePerformIO)
39
37
40-- | Reification of 'Serializable' (see "Control.Distributed.Process.Closure")
38-- | Reification of 'Serializable' (see "Control.Distributed.Process.Closure")
41data SerializableDict a where
39data SerializableDict a where
@@ -63,7 +61,7 @@ decodeFingerprint :: ByteString -> Fingerprint
63decodeFingerprint bs
61decodeFingerprint bs
64 | BS.length bs /= sizeOfFingerprint =
62 | BS.length bs /= sizeOfFingerprint =
65 throw $ userError "decodeFingerprint: Invalid length"
63 throw $ userError "decodeFingerprint: Invalid length"
66− | otherwise = BSI.inlinePerformIO $ do
64+ | otherwise = unsafePerformIO $ do
67 let (fp, offset, _) = BSI.toForeignPtr bs
65 let (fp, offset, _) = BSI.toForeignPtr bs
68 withForeignPtr fp $ \p -> peekByteOff p offset
66 withForeignPtr fp $ \p -> peekByteOff p offset
69
67