git.iko.soy/distributed-process
on master help sign in
Remove obsolete file (no more built-in closures!)
commit9c7ff1e917a13300b9d87532772a00c7a28da2a7 authorEdsko de Vries <edsko@edsko.net> dateWed 11 Jul 2012, 09:42 (14 years ago) parent55dfe3a
2 files changed−69
distributed-process/distributed-process.cabal−1 distributed-process/src/Control/Distributed/Process/Internal/Closure/BuiltIn.hs−68
distributed-process/distributed-process.cabal−1
@@ -54,7 +54,6 @@ Library
5454 Control.Distributed.Process.Internal.TypeRep,
5555 Control.Distributed.Process.Internal.MessageT,
5656 Control.Distributed.Process.Internal.Types,
57− Control.Distributed.Process.Internal.Closure.BuiltIn,
5857 Control.Distributed.Process.Internal.Closure.Derived,
5958 Control.Distributed.Process.Internal.Closure.TH,
6059 Control.Distributed.Process.Internal.Closure.Resolution,
distributed-process/src/Control/Distributed/Process/Internal/Closure/BuiltIn.hsdeleted−68
@@ -1,68 +0,0 @@
1−-- | Built-in closures
2−module Control.Distributed.Process.Internal.Closure.BuiltIn () where
3−
4−{-
5− ( -- Combinators
6− closureApply
7− -- TODO
8− , sendClosure
9− , returnClosure
10− , expectClosure
11− ) where
12−
13−import Data.Binary (encode)
14−import Data.Typeable (Typeable, typeOf)
15−import Control.Distributed.Process.Internal.Types
16− ( ProcessId
17− , Closure
18− , Process
19− , SerializableDict(..)
20− , Closure(..)
21− , Static(..)
22− , StaticLabel(..)
23− )
24−import Control.Distributed.Process.Internal.TypeRep () -- Binary instances
25−import Control.Distributed.Process.Serializable (Serializable)
26−
27−--------------------------------------------------------------------------------
28−-- Combinators --
29−--------------------------------------------------------------------------------
30−
31−closureApply :: Closure (a -> b) -> Closure a -> Closure b
32−closureApply (Closure (Static labelf) envf) (Closure (Static labelx) envx) =
33− Closure (Static ClosureApply) $ encode (labelf, envf, labelx, envx)
34−
35−closureReturn :: Serializable a => Static (SerializableDict a) -> a -> Closure a
36−closureReturn (Static dict) x = Closure (Static ClosureReturn) (encode (dict, x))
37−
38−closureStatic :: Static a -> Closure a
39−closureStatic (Static dict) = Closure (Static ClosureStatic) (encode dict)
40−
41−--------------------------------------------------------------------------------
42−-- Polymorphic closures --
43−-- --
44−-- TODO: These functions take a SerializableDict as argument. When we get --
45−-- proper support for static, ideally this argument disappears completely; --
46−-- but if not, it should turn into a static (SerializableDict a). We don't --
47−-- require them to be "static" here because we don't have a pure 'unstatic' --
48−-- function, and hence have no way of turning a static (SerializableDict a) --
49−-- into an actual SerialziableDict a (we need that in order to pattern match --
50−-- on the dictionary and bring the type class dictionary into scope, so that --
51−-- we can call 'encode' (for instance in 'returnClosure'). --
52−--------------------------------------------------------------------------------
53−
54−-- | Closure version of 'send'
55−sendClosure :: forall a. SerializableDict a -> ProcessId -> Closure (a -> Process ())
56−sendClosure SerializableDict pid =
57− Closure (Static ClosureSend) (encode (typeOf (undefined :: a), pid))
58−
59−-- | Return any value
60−returnClosure :: forall a. SerializableDict a -> a -> Closure (Process a)
61−returnClosure SerializableDict val =
62− Closure (Static ClosureReturn) (encode (typeOf (undefined :: a), encode val))
63−
64−-- | Closure version of 'expect'
65−expectClosure :: forall a. SerializableDict a -> Closure (Process a)
66−expectClosure SerializableDict =
67− Closure (Static ClosureExpect) (encode (typeOf (undefined :: a)))
68−-}