Towards Haskell in the Cloud (Epstein et al., Haskell Symposium 2011)
proposes a new type construct called static that characterizes values that
are known statically. Cloud Haskell uses the
Static implementation from
Control.Distributed.Static. That module comes with its own extensive
documentation, which you should read if you want to know the details. Here
we explain the Template Haskell support only.

Static values

Given a top-level (possibly polymorphic, but unqualified) definition

f :: forall a1 .. an. T
f = ...

you can use a Template Haskell splice to create a static version of f:

Every module that you write that contains calls to mkStatic needs to
have a call to remotable:

remotable [ 'f, 'g, ... ]

where you must pass every function (or other value) that you pass as an
argument to mkStatic. The call to remotable will create a definition

__remoteTable :: RemoteTable -> RemoteTable

which can be used to construct the RemoteTable used to initialize
Cloud Haskell. You should have (at most) one call to remotable per module,
and compose all created functions when initializing Cloud Haskell:

(*) If T1 is not serializable you will get a type error in the generated
code. Unfortunately, the Template Haskell infrastructure cannot check
a priori if T1 is serializable or not due to a bug in the Template
Haskell libraries (http://hackage.haskell.org/trac/ghc/ticket/7066)

(**) Even though call is passed an explicit serialization
dictionary, we still need the Serializable constraint because
Static is not the true static. If it was, we could unstatic
the dictionary and pattern match on it to bring the Typeable
instance into scope, but unless proper static support is added to
ghc we need both the type class argument and the explicit dictionary.

remotableDecl creates the function specified as well as the various
dictionaries and static versions that remotable also creates.
remotableDecl is sometimes necessary when you want to refer to, say,
$(mkClosure 'f) within the definition of f itself.