git.iko.soy/distributed-process
on master help sign in
Merge pull request #292 from bgamari/warnings

Fix various warnings

commit42c71ebc2b801bc3db34155d8921f78b2734602e authorFacundo Domínguez <facundominguez@gmail.com> dateFri 8 Jul 2016, 13:52 (10 years ago) parent7bccad24e73153
9 files changed+19−25
distributed-process-tests/distributed-process-tests.cabal−1 distributed-process-tests/src/Control/Distributed/Process/Tests/Receive.hs+1−4 src/Control/Distributed/Process.hs−1 src/Control/Distributed/Process/Internal/Closure/Explicit.hs+1−2 src/Control/Distributed/Process/Internal/Closure/TH.hs+11−7 src/Control/Distributed/Process/Internal/Messaging.hs+1−1 src/Control/Distributed/Process/Management/Internal/Types.hs−2 src/Control/Distributed/Process/Node.hs+2−2 src/Control/Distributed/Process/Serializable.hs+3−5
distributed-process-tests/distributed-process-tests.cabal−1
@@ -48,7 +48,6 @@ library
4848 DeriveDataTypeable,
4949 DeriveGeneric,
5050 GeneralizedNewtypeDeriving,
51− OverlappingInstances,
5251 RankNTypes,
5352 RecordWildCards,
5453 ScopedTypeVariables
distributed-process-tests/src/Control/Distributed/Process/Tests/Receive.hs+1−4
@@ -1,4 +1,4 @@
1−{-# LANGUAGE TemplateHaskell, DeriveDataTypeable #-}
1+{-# LANGUAGE TemplateHaskell #-}
22{-# OPTIONS_GHC -Wall #-}
33
44-- | XXX test doesn't work, because failure exceptions don't get propagated. The
@@ -14,9 +14,6 @@ import Control.Distributed.Process.Closure
1414import Control.Distributed.Process.Node
1515
1616import Control.Monad
17−import Text.Printf
18−import Data.Binary
19−import Data.Typeable
2017
2118import Test.HUnit (Assertion, (@?=))
2219import Test.Framework (Test, defaultMain)
src/Control/Distributed/Process.hs−1
@@ -327,7 +327,6 @@ import Prelude
327327#else
328328import Prelude hiding (catch)
329329#endif
330−import Control.Distributed.Process.Internal.StrictMVar (readMVar)
331330import qualified Control.Exception as Exception (onException)
332331import Data.Accessor ((^.))
333332import Data.Foldable (forM_)
src/Control/Distributed/Process/Internal/Closure/Explicit.hs+1−2
@@ -6,7 +6,6 @@
66 , UndecidableInstances
77 , KindSignatures
88 , GADTs
9− , OverlappingInstances
109 , EmptyDataDecls
1110 , DeriveDataTypeable #-}
1211module Control.Distributed.Process.Internal.Closure.Explicit
@@ -109,7 +108,7 @@ instance Binary EndOfTuple where
109108class Curry a b | a -> b where
110109 curryFun :: a -> b
111110
112−instance Curry ((a,EndOfTuple) -> b) (a -> b) where
111+instance Curry ((a, EndOfTuple) -> b) (a -> b) where
113112 curryFun f = \x -> f (x,undefined)
114113
115114instance 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
2929 , Type(AppT, ForallT, VarT, ArrowT)
3030 , Info(VarI)
3131 , TyVarBndr(PlainTV, KindedTV)
32−#if ! MIN_VERSION_template_haskell(2,10,0)
3332 , Pred
33+#if MIN_VERSION_template_haskell(2,10,0)
34+ , conT
35+ , appT
36+#else
37+ , classP
3438#endif
3539 , varT
36− , classP
3740 -- Lifted constructors
3841 -- .. Literals
3942 , stringL
@@ -71,10 +74,6 @@ import Control.Distributed.Process.Serializable
7174 )
7275import Control.Distributed.Process.Internal.Closure.BuiltIn (staticDecode)
7376
74−#if MIN_VERSION_template_haskell(2,10,0)
75−type Pred = Type
76−#endif
77−
7877--------------------------------------------------------------------------------
7978-- User-level API --
8079--------------------------------------------------------------------------------
@@ -261,7 +260,12 @@ generateStatic n xs typ = do
261260 ]
262261 where
263262 typeable :: TyVarBndr -> Q Pred
264− typeable tv = classP (mkName "Typeable") [varT (tyVarBndrName tv)]
263+ typeable tv =
264+#if MIN_VERSION_template_haskell(2,10,0)
265+ conT (mkName "Typeable") `appT` varT (tyVarBndrName tv)
266+#else
267+ classP (mkName "Typeable") [varT (tyVarBndrName tv)]
268+#endif
265269
266270-- | Generate a serialization dictionary with name 'n' for type 'typ'
267271generateDict :: Name -> Type -> Q [Dec]
src/Control/Distributed/Process/Internal/Messaging.hs+1−1
@@ -30,7 +30,7 @@ import qualified Network.Transport as NT
3030 , close
3131 )
3232import Control.Distributed.Process.Internal.Types
33− ( LocalNode(localState, localEndPoint, localCtrlChan)
33+ ( LocalNode(localEndPoint, localCtrlChan)
3434 , withValidLocalState
3535 , modifyValidLocalState
3636 , modifyValidLocalState_
src/Control/Distributed/Process/Management/Internal/Types.hs−2
@@ -1,5 +1,4 @@
11{-# LANGUAGE DeriveDataTypeable #-}
2−{-# LANGUAGE StandaloneDeriving #-}
32{-# LANGUAGE ExistentialQuantification #-}
43{-# LANGUAGE GeneralizedNewtypeDeriving #-}
54{-# LANGUAGE DeriveGeneric #-}
@@ -23,7 +22,6 @@ import Control.Distributed.Process.Internal.Types
2322 ( Process
2423 , ProcessId
2524 , Message
26− , SendPort
2725 , DiedReason
2826 , NodeId
2927 )
src/Control/Distributed/Process/Node.hs+2−2
@@ -76,7 +76,7 @@ import qualified Control.Exception as Exception
7676 , catches
7777 , finally
7878 )
79−import Control.Concurrent (forkIO, forkIOWithUnmask, killThread)
79+import Control.Concurrent (forkIO, killThread)
8080import Control.Distributed.Process.Internal.StrictMVar
8181 ( newMVar
8282 , withMVar
@@ -1060,7 +1060,7 @@ ncEffectGetInfo from pid =
10601060 , infoMonitors = Set.toList itsMons
10611061 , infoLinks = Set.toList itsLinks
10621062 }
1063− where dispatch :: (Serializable a, Show a)
1063+ where dispatch :: (Serializable a)
10641064 => Bool
10651065 -> ProcessId
10661066 -> a
src/Control/Distributed/Process/Serializable.hs+3−5
@@ -30,12 +30,10 @@ import Control.Exception (throw)
3030import GHC.Fingerprint.Type (Fingerprint(..))
3131import Data.ByteString (ByteString)
3232import qualified Data.ByteString as BS
33−import qualified Data.ByteString.Internal as BSI ( unsafeCreate
34− , inlinePerformIO
35− , toForeignPtr
36− )
33+import qualified Data.ByteString.Internal as BSI ( unsafeCreate, toForeignPtr )
3734import Foreign.Storable (pokeByteOff, peekByteOff, sizeOf)
3835import Foreign.ForeignPtr (withForeignPtr)
36+import System.IO.Unsafe (unsafePerformIO)
3937
4038-- | Reification of 'Serializable' (see "Control.Distributed.Process.Closure")
4139data SerializableDict a where
@@ -63,7 +61,7 @@ decodeFingerprint :: ByteString -> Fingerprint
6361decodeFingerprint bs
6462 | BS.length bs /= sizeOfFingerprint =
6563 throw $ userError "decodeFingerprint: Invalid length"
66− | otherwise = BSI.inlinePerformIO $ do
64+ | otherwise = unsafePerformIO $ do
6765 let (fp, offset, _) = BSI.toForeignPtr bs
6866 withForeignPtr fp $ \p -> peekByteOff p offset
6967