git.iko.soy/distributed-process
on master help sign in
More cleanup
4e9442bEdsko de Vries
distributed-process/distributed-process.cabal−3
@@ -53,7 +53,6 @@ Library
53 Control.Distributed.Process.Internal.Primitives,
53 Control.Distributed.Process.Internal.Primitives,
54 Control.Distributed.Process.Internal.CQueue,
54 Control.Distributed.Process.Internal.CQueue,
55 Control.Distributed.Process.Internal.Types,
55 Control.Distributed.Process.Internal.Types,
56− Control.Distributed.Process.Internal.Closure.MkClosure,
57 Control.Distributed.Process.Internal.Closure.TH,
56 Control.Distributed.Process.Internal.Closure.TH,
58 Control.Distributed.Process.Internal.Closure.BuiltIn,
57 Control.Distributed.Process.Internal.Closure.BuiltIn,
59 Control.Distributed.Process.Internal.Node
58 Control.Distributed.Process.Internal.Node
@@ -65,7 +64,6 @@ Library
65 GADTs,
64 GADTs,
66 GeneralizedNewtypeDeriving,
65 GeneralizedNewtypeDeriving,
67 DeriveDataTypeable,
66 DeriveDataTypeable,
68− TemplateHaskell,
69 CPP
67 CPP
70 ghc-options: -Wall
68 ghc-options: -Wall
71 HS-Source-Dirs: src
69 HS-Source-Dirs: src
@@ -99,7 +97,6 @@ Test-Suite TestCH
99 GADTs,
97 GADTs,
100 GeneralizedNewtypeDeriving,
98 GeneralizedNewtypeDeriving,
101 DeriveDataTypeable,
99 DeriveDataTypeable,
102− TemplateHaskell,
103 CPP
100 CPP
104 ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind
101 ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind
105 HS-Source-Dirs: tests src
102 HS-Source-Dirs: tests src
distributed-process/src/Control/Distributed/Process.hs−1
@@ -209,7 +209,6 @@ import Control.Distributed.Process.Internal.Primitives
209 )
209 )
210import Control.Distributed.Process.Serializable (Serializable)
210import Control.Distributed.Process.Serializable (Serializable)
211import Control.Distributed.Process.Node (forkProcess)
211import Control.Distributed.Process.Node (forkProcess)
212−import Data.Rank1Typeable (ANY, ANY1)
213
212
214-- INTERNAL NOTES
213-- INTERNAL NOTES
215--
214--
distributed-process/src/Control/Distributed/Process/Closure.hs+1−1
@@ -189,8 +189,8 @@ import Control.Distributed.Process.Internal.Closure.TH
189 , mkStatic
189 , mkStatic
190 , functionSDict
190 , functionSDict
191 , functionTDict
191 , functionTDict
192+ , mkClosure
192 )
193 )
193−import Control.Distributed.Process.Internal.Closure.MkClosure (mkClosure)
194import Control.Distributed.Process.Internal.Closure.BuiltIn
194import Control.Distributed.Process.Internal.Closure.BuiltIn
195 ( -- Static dictionaries and associated operations
195 ( -- Static dictionaries and associated operations
196 staticDecode
196 staticDecode
distributed-process/src/Control/Distributed/Process/Internal/Closure/MkClosure.hsdeleted−31
@@ -1,31 +0,0 @@
1−{-# LANGUAGE TemplateHaskell #-}
2−module Control.Distributed.Process.Internal.Closure.MkClosure (mkClosure) where
3−
4−import Data.Binary (encode)
5−import Language.Haskell.TH (Q, Exp, Name)
6−import Control.Distributed.Process.Internal.Closure.TH
7− ( mkStatic
8− , functionSDict
9− )
10−import Control.Distributed.Static (Closure(Closure), staticCompose)
11−import Control.Distributed.Process.Internal.Closure.BuiltIn (staticDecode)
12−
13−{-
14−-- import Control.Distributed.Process.Internal.Types (Closure(Closure))
15−import Control.Distributed.Process.Internal.Closure.Static
16− ( staticCompose
17− , staticDecode
18− )
19−-}
20−
21−-- | Create a closure
22−--
23−-- If @f : T1 -> T2@ is a /monomorphic/ function
24−-- then @$(mkClosure 'f) :: T1 -> Closure T2@.
25−-- Be sure to pass 'f' to
26−-- 'Control.Distributed.Process.Internal.Closure.TH.remotable'.
27−mkClosure :: Name -> Q Exp
28−mkClosure n =
29− [| Closure ($(mkStatic n) `staticCompose` staticDecode $(functionSDict n))
30− . encode
31− |]
distributed-process/src/Control/Distributed/Process/Internal/Closure/TH.hs+17−7
@@ -1,12 +1,12 @@
1-- | Template Haskell support
1-- | Template Haskell support
2−--
2+{-# LANGUAGE TemplateHaskell #-}
3−-- (In a separate file for convenience)
4module Control.Distributed.Process.Internal.Closure.TH
3module Control.Distributed.Process.Internal.Closure.TH
5 ( -- * User-level API
4 ( -- * User-level API
6 remotable
5 remotable
7 , mkStatic
6 , mkStatic
8 , functionSDict
7 , functionSDict
9 , functionTDict
8 , functionTDict
9+ , mkClosure
10 ) where
10 ) where
11
11
12import Prelude hiding (lookup)
12import Prelude hiding (lookup)
@@ -40,17 +40,21 @@ import Language.Haskell.TH
40 , sigD
40 , sigD
41 )
41 )
42
42
43−import Control.Distributed.Process.Internal.Types (Process)
43+import Data.Binary (encode)
44−import Control.Distributed.Process.Serializable
44+import Data.Rank1Dynamic (toDynamic)
45− ( SerializableDict(SerializableDict)
46− )
47import Control.Distributed.Static
45import Control.Distributed.Static
48 ( RemoteTable
46 ( RemoteTable
49 , registerStatic
47 , registerStatic
50 , Static
48 , Static
51 , staticLabel
49 , staticLabel
50+ , Closure(Closure)
51+ , staticCompose
52 )
52 )
53−import Data.Rank1Dynamic (toDynamic)
53+import Control.Distributed.Process.Internal.Types (Process)
54+import Control.Distributed.Process.Serializable
55+ ( SerializableDict(SerializableDict)
56+ )
57+import Control.Distributed.Process.Internal.Closure.BuiltIn (staticDecode)
54
58
55--------------------------------------------------------------------------------
59--------------------------------------------------------------------------------
56-- User-level API --
60-- User-level API --
@@ -86,6 +90,12 @@ functionSDict = varE . sdictName
86functionTDict :: Name -> Q Exp
90functionTDict :: Name -> Q Exp
87functionTDict = varE . tdictName
91functionTDict = varE . tdictName
88
92
93+mkClosure :: Name -> Q Exp
94+mkClosure n =
95+ [| Closure ($(mkStatic n) `staticCompose` staticDecode $(functionSDict n))
96+ . encode
97+ |]
98+
89--------------------------------------------------------------------------------
99--------------------------------------------------------------------------------
90-- Internal (Template Haskell) --
100-- Internal (Template Haskell) --
91--------------------------------------------------------------------------------
101--------------------------------------------------------------------------------
distributed-process/src/Control/Distributed/Process/Node.hs−1
@@ -9,7 +9,6 @@ module Control.Distributed.Process.Node
9 , localNodeId
9 , localNodeId
10 ) where
10 ) where
11
11
12−
13#if ! MIN_VERSION_base(4,6,0)
12#if ! MIN_VERSION_base(4,6,0)
14import Prelude hiding (catch)
13import Prelude hiding (catch)
15#endif
14#endif