Skip to content

Commit 0551433

Browse files
committed
Merge branch 'master' into dev
2 parents e6701d9 + e827753 commit 0551433

File tree

26 files changed

+1512
-1116
lines changed

26 files changed

+1512
-1116
lines changed

README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,15 @@ This repository holds an implementation of [Cloud Haskell][1].
55

66
At present, this repository hosts
77

8-
* network-transport
9-
* network-transport-tcp
10-
* network-transport-inmemory (incomplete)
11-
* distributed-process
12-
* distributed-process-simplelocalnet
13-
* azure-service-api (skeleton only)
8+
* network-transport: Generic Network.Transport API
9+
* network-transport-tcp: TCP instantiation of Network.Transport
10+
* network-transport-inmemory: In-memory instantiation of Network.Transport (incomplete)
11+
* distributed-static: Support for static values
12+
* distributed-process: The main Cloud Haskell package
13+
* distributed-process-simplelocalnet: Simple backend for local networks
14+
* distributed-process-azure: Azure backend for Cloud Haskell (work in progress)
15+
* azure-service-api: Haskell bindings for the Azure service API (work in progress)
16+
* rank1dynamic: Like Data.Dynamic and Data.Typeable but with support for polymorphic values
1417

1518
For more detailed information about the interfaces provided by these packages,
1619
please refer to the [distributed-process repository wiki][2]. People who wish

distributed-process/distributed-process.cabal

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Name: distributed-process
2-
Version: 0.2.3.0
2+
Version: 0.3.0
33
Cabal-Version: >=1.8
44
Build-Type: Simple
55
License: BSD3
@@ -43,21 +43,19 @@ Library
4343
time >= 1.2 && < 1.5,
4444
template-haskell >= 2.6 && < 2.8,
4545
random >= 1.0 && < 1.1,
46-
ghc-prim >= 0.2 && < 0.3
46+
ghc-prim >= 0.2 && < 0.3,
47+
distributed-static >= 0.1 && < 0.2,
48+
rank1dynamic >= 0.1 && < 0.2,
49+
syb >= 0.3 && < 0.4
4750
Exposed-modules: Control.Distributed.Process,
4851
Control.Distributed.Process.Serializable,
4952
Control.Distributed.Process.Closure,
5053
Control.Distributed.Process.Node,
5154
Control.Distributed.Process.Internal.Primitives,
5255
Control.Distributed.Process.Internal.CQueue,
53-
Control.Distributed.Process.Internal.Dynamic,
54-
Control.Distributed.Process.Internal.TypeRep,
5556
Control.Distributed.Process.Internal.Types,
56-
Control.Distributed.Process.Internal.Closure.Static,
57-
Control.Distributed.Process.Internal.Closure.MkClosure,
58-
Control.Distributed.Process.Internal.Closure.CP,
5957
Control.Distributed.Process.Internal.Closure.TH,
60-
Control.Distributed.Process.Internal.Closure.Resolution,
58+
Control.Distributed.Process.Internal.Closure.BuiltIn,
6159
Control.Distributed.Process.Internal.Node
6260
Extensions: RankNTypes,
6361
ScopedTypeVariables,
@@ -67,7 +65,6 @@ Library
6765
GADTs,
6866
GeneralizedNewtypeDeriving,
6967
DeriveDataTypeable,
70-
TemplateHaskell,
7168
CPP
7269
ghc-options: -Wall
7370
HS-Source-Dirs: src
@@ -90,7 +87,9 @@ Test-Suite TestCH
9087
template-haskell >= 2.6 && < 2.8,
9188
random >= 1.0 && < 1.1,
9289
ghc-prim >= 0.2 && < 0.3,
93-
ansi-terminal >= 0.5 && < 0.6
90+
ansi-terminal >= 0.5 && < 0.6,
91+
distributed-static >= 0.1 && < 0.2,
92+
rank1dynamic >= 0.1 && < 0.2
9493
Extensions: RankNTypes,
9594
ScopedTypeVariables,
9695
FlexibleInstances,
@@ -99,7 +98,6 @@ Test-Suite TestCH
9998
GADTs,
10099
GeneralizedNewtypeDeriving,
101100
DeriveDataTypeable,
102-
TemplateHaskell,
103101
CPP
104102
ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind
105103
HS-Source-Dirs: tests src
@@ -122,7 +120,10 @@ Test-Suite TestClosure
122120
template-haskell >= 2.6 && < 2.8,
123121
random >= 1.0 && < 1.1,
124122
ghc-prim >= 0.2 && < 0.3,
125-
ansi-terminal >= 0.5 && < 0.6
123+
ansi-terminal >= 0.5 && < 0.6,
124+
distributed-static >= 0.1 && < 0.2,
125+
rank1dynamic >= 0.1 && < 0.2,
126+
syb >= 0.3 && < 0.4
126127
Other-modules: TestAuxiliary
127128
Extensions: RankNTypes,
128129
ScopedTypeVariables,

distributed-process/src/Control/Distributed/Process.hs

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ module Control.Distributed.Process
100100
, spawnChannelLocal
101101
) where
102102

103-
104103
#if ! MIN_VERSION_base(4,6,0)
105104
import Prelude hiding (catch)
106105
#endif
@@ -109,13 +108,15 @@ import Data.Typeable (Typeable)
109108
import Control.Monad.IO.Class (liftIO)
110109
import Control.Applicative ((<$>))
111110
import Control.Monad.Reader (ask)
111+
import Control.Distributed.Static
112+
( Closure(..)
113+
, Static
114+
, RemoteTable
115+
)
112116
import Control.Distributed.Process.Internal.Types
113-
( RemoteTable
114-
, NodeId(..)
117+
( NodeId(..)
115118
, ProcessId(..)
116119
, Process(..)
117-
, Closure(..)
118-
, Static
119120
, MonitorRef(..)
120121
, ProcessMonitorNotification(..)
121122
, NodeMonitorNotification(..)
@@ -126,29 +127,28 @@ import Control.Distributed.Process.Internal.Types
126127
, DiedReason(..)
127128
, SpawnRef(..)
128129
, DidSpawn(..)
129-
, Closure(..)
130130
, SendPort(..)
131131
, ReceivePort(..)
132-
, SerializableDict(..)
133132
, SendPortId(..)
134133
, WhereIsReply(..)
135134
, LocalProcess(processNode)
136135
)
137-
import Control.Distributed.Process.Internal.Closure.CP
138-
( cpSeq
139-
, cpBind
140-
, cpSend
141-
, cpExpect
136+
import Control.Distributed.Process.Serializable (SerializableDict)
137+
import Control.Distributed.Process.Internal.Closure.BuiltIn
138+
( sdictUnit
139+
, sdictSendPort
140+
, sndStatic
141+
, idCP
142+
, seqCP
143+
, bindCP
144+
, splitCP
142145
, cpLink
143146
, cpUnlink
147+
, cpExpect
148+
, cpSend
144149
, cpNewChan
145-
, cpCancelL
146-
, cpSplit
147-
)
148-
import Control.Distributed.Process.Internal.Closure.Static
149-
( sdictUnit
150-
, sdictSendPort
151150
)
151+
import Control.Distributed.Static (closureCompose, staticClosure)
152152
import Control.Distributed.Process.Internal.Primitives
153153
( -- Basic messaging
154154
send
@@ -289,9 +289,9 @@ spawn nid proc = do
289289
-- that was already set up
290290
mRef <- monitorNode nid
291291
sRef <- spawnAsync nid $ cpLink us
292-
`cpSeq` cpExpect sdictUnit
293-
`cpSeq` cpUnlink us
294-
`cpSeq` proc
292+
`seqCP` cpExpect sdictUnit
293+
`seqCP` cpUnlink us
294+
`seqCP` proc
295295
mPid <- receiveWait
296296
[ matchIf (\(DidSpawn ref _) -> ref == sRef)
297297
(\(DidSpawn _ pid) -> return $ Just pid)
@@ -333,7 +333,7 @@ spawnMonitor nid proc = do
333333
call :: Serializable a => Static (SerializableDict a) -> NodeId -> Closure (Process a) -> Process a
334334
call dict nid proc = do
335335
us <- getSelfPid
336-
(_, mRef) <- spawnMonitor nid (proc `cpBind` cpSend dict us)
336+
(_, mRef) <- spawnMonitor nid (proc `bindCP` cpSend dict us)
337337
-- We are guaranteed to receive the reply before the monitor notification
338338
-- (if a reply is sent at all)
339339
-- NOTE: This might not be true if we switch to unreliable delivery.
@@ -353,7 +353,7 @@ spawnSupervised :: NodeId
353353
-> Process (ProcessId, MonitorRef)
354354
spawnSupervised nid proc = do
355355
us <- getSelfPid
356-
them <- spawn nid (cpLink us `cpSeq` proc)
356+
them <- spawn nid (cpLink us `seqCP` proc)
357357
ref <- monitor them
358358
return (them, ref)
359359

@@ -370,10 +370,10 @@ spawnChannel dict nid proc = do
370370
where
371371
go :: ProcessId -> Closure (Process ())
372372
go pid = cpNewChan dict
373-
`cpBind`
374-
(cpSend (sdictSendPort dict) pid `cpSplit` proc)
375-
`cpBind`
376-
cpCancelL
373+
`bindCP`
374+
(cpSend (sdictSendPort dict) pid `splitCP` proc)
375+
`bindCP`
376+
(idCP `closureCompose` staticClosure sndStatic)
377377

378378
--------------------------------------------------------------------------------
379379
-- Local versions of spawn --

0 commit comments

Comments
 (0)