distributed-closure-0.4.0: Serializable closures for distributed programming.

Safe HaskellNone
LanguageHaskell2010

Control.Distributed.Closure.TH

Description

Utility Template Haskell macros.

Synopsis

Documentation

cstatic :: Name -> ExpQ Source #

$(cstatic 'foo) is an abbreviation for closure (static foo).

cdict :: ExpQ Source #

Abbreviation for closure (static Dict). Example usage:

foo :: Closure (Dict (Num a)) -> ...

foo $cdict ...

withStatic :: DecsQ -> DecsQ Source #

Auto-generates the Static instances corresponding to the given class instances. Example:

data T a = T a

withStatic [d| instance Show a => Show (T a) where ... |]
======>
instance Show a => Show (T a) where ...
instance (Static (Show a), Typeable a) => Static (Show (T a)) where
  closureDict = closure (static (Dict -> Dict)) cap closureDict

You will probably want to enable FlexibleContexts and ScopedTypeVariables in modules that use withStatic.