@@ -1,8 +1,5 @@
1{-# LANGUAGE MagicHash #-}
1{-# LANGUAGE MagicHash #-}
2−module Control.Distributed.Process.Internal.Closure
2+module Control.Distributed.Process.Internal.Closure.Resolution (resolveClosure) where
3− ( -- * Runtime support
7import Data.Accessor ((^.))
4import Data.Accessor ((^.))
8import Data.ByteString.Lazy (ByteString)
5import Data.ByteString.Lazy (ByteString)
@@ -29,23 +26,6 @@ import Control.Distributed.Process.Internal.Dynamic
30import Control.Distributed.Process.Internal.TypeRep () -- Binary instances
27import Control.Distributed.Process.Internal.TypeRep () -- Binary instances
33−import qualified Control.Distributed.Process.Internal.Closure.BuiltIn as BuiltIn
35−import qualified Control.Distributed.Process.Internal.Closure.Combinators as Combinators
38−-- | Initial (empty) remote-call meta data
39−initRemoteTable :: RemoteTable
40−initRemoteTable = BuiltIn.remoteTable
41− . Combinators.remoteTable
42− $ RemoteTable Map.empty Map.empty
45−--------------------------------------------------------------------------------
46−-- Runtime support for closures --
47−--------------------------------------------------------------------------------
49resolveClosure :: RemoteTable -> StaticLabel -> ByteString -> Maybe Dynamic
29resolveClosure :: RemoteTable -> StaticLabel -> ByteString -> Maybe Dynamic
50-- Built-in closures
30-- Built-in closures
51resolveClosure rtable ClosureSend env = do
31resolveClosure rtable ClosureSend env = do
@@ -88,8 +68,6 @@ resolveClosure rtable CpApply env =
88resolveClosure rtable (UserStatic label) env = do
68resolveClosure rtable (UserStatic label) env = do
89 val <- rtable ^. remoteTableLabel label
69 val <- rtable ^. remoteTableLabel label
90 dynApply val (toDyn env)
70 dynApply val (toDyn env)
92−-- User-defined polymorphic closures
93resolveClosure rtable (PolyStatic label) env = do
71resolveClosure rtable (PolyStatic label) env = do
94 Dynamic _ val <- rtable ^. remoteTableLabel label
72 Dynamic _ val <- rtable ^. remoteTableLabel label
95 return (Dynamic (decode env) val)
73 return (Dynamic (decode env) val)