@@ -8,6 +8,7 @@ module Control.Distributed.Process.Internal.Closure.TH
88 , functionSDict
99 , functionTDict
1010 , mkClosure
11+ , mkStaticClosure
1112 ) where
1213
1314import Prelude hiding (succ, any)
@@ -58,6 +59,7 @@ import Control.Distributed.Static
5859 , staticLabel
5960 , closure
6061 , staticCompose
62+ , staticClosure
6163 )
6264import Control.Distributed.Process.Internal.Types (Process)
6365import Control.Distributed.Process.Serializable
@@ -146,6 +148,13 @@ mkClosure n =
146148 . encode
147149 |]
148150
151+-- | Make a 'Closure' from a static function. This is useful for
152+-- making a closure for a top-level @Process ()@ function, because
153+-- using 'mkClosure' would require adding a dummy @()@ argument.
154+--
155+mkStaticClosure :: Name -> Q Exp
156+mkStaticClosure n = [| staticClosure $( mkStatic n ) |]
157+
149158--------------------------------------------------------------------------------
150159-- Internal (Template Haskell) --
151160--------------------------------------------------------------------------------